Zhanglifen 13 FILE SYSTEM FRAMEWORK 13 FILE SYSTEM FRAMEWORK —— virtual file system framework.

Slides:



Advertisements
Similar presentations
Chapter 12: File System Implementation
Advertisements

1 UNIX Internals – The New Frontiers Chapters 8 & 9 File Systems.
File System Implementation 1 Chapter 9. File System Implementation Introduction System V File System Berkeley Fast File System Temporary File System Special-purpose.
Chapter 11: File System Implementation
File System Implementation
Chapter 11: File System Implementation. File-System Structure File-System Implementation Directory Implementation Allocation Methods Free-Space Management.
Files. System Calls for File System Accessing files –Open, read, write, lseek, close Creating files –Create, mknod.
I/O Hardware n Incredible variety of I/O devices n Common concepts: – Port – connection point to the computer – Bus (daisy chain or shared direct access)
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
Linux Operating System
File System Implementation
NFS. The Sun Network File System (NFS) An implementation and a specification of a software system for accessing remote files across LANs. The implementation.
Dr. Kalpakis CMSC 421, Operating Systems File System Implementation.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
CHAPTER 12: FILE SYSTEM IMPLEMENTATION
Networked File System CS Introduction to Operating Systems.
CS 6560 Operating System Design Lecture 13 Finish File Systems Block I/O Layer.
CSCC69: Operating Systems Assignment 3 Review. Assignment Review Implement the file-related system calls – open, close, dup2 – read, write, lseek – chdir,
Operating Systems CMPSC 473 I/O Management (4) December 09, Lecture 25 Instructor: Bhuvan Urgaonkar.
Distributed Systems. Interprocess Communication (IPC) Processes are either independent or cooperating – Threads provide a gray area – Cooperating processes.
SIMULATED UNIX FILE SYSTEM Implementation in C Tarek Youssef Bipanjit Sihra.
Page 1 of John Wong CTO Twin Peaks Software Inc. Mirror File System A Multiple Server File System.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
Chapter 5 File Management File System Implementation.
Chapter 16 - File Systems –Persistent storage: storage that will continue to exist after a program that uses or creates it completes. –Sometimes called.
Chapter 6 Distributed File Systems. Topics Review of UNIX Sun NFS VFS architecture caching.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 11: File System Implementation.
File System Implementation
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Implementation.
12.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 12: File System Implementation Chapter 12: File System Implementation.
Ridge Xu 12.1 Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation Directory Implementation.
Digital UNIX Internals II4 - 1Buffer Caches Chapter Four.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 11-2: File System Implementation Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
11.1 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 12: File System Implementation Chapter 12: File System Implementation File.
Files & File system. A Possible File System Layout Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 11: File System Implementation Chapter.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
Modul ke: Fakultas Program Studi File System Implementation SISTEM OPERASI Misbahul Fajri, ST., MTI. 1 FASILKOM Teknik Informatika.
Page 112/7/2015 CSE 30341: Operating Systems Principles Chapter 11: File System Implementation  Overview  File system structure – layered, block based.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 File-System Structure.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File System Implementation.
GLOBAL EDGE SOFTWERE LTD1 R EMOTE F ILE S HARING - Ardhanareesh Aradhyamath.
UNIX File System (UFS) Chapter Five.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
Slide: 1 UNIX FILE SYSTEM By:Qing Yang ID: Operating System Research Topic December, 2000.
CSC414 “Introduction to UNIX/ Linux” Lecture 2. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Operating Systems, Spring 2003 Local File Systems in UNIX Ittai Abraham Zinovi Rabinovich (recitation)
CSCC69: Operating Systems Tutorial 10. Hints on testing Assignment 3 How to test tlb replacement algorithms? – Write a program that creates an array larger.
4P13 Week 9 Talking Points
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 2.
FILE SYSTEM IMPLEMENTATION 1. 2 File-System Structure File structure Logical storage unit Collection of related information File system resides on secondary.
1 The File System. 2 Linux File System Linux supports 15 file systems –ext, ext2, xia, minix, umsdos, msdos, vfat, proc, smb, ncp, iso9660, sysv, hpfs,
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Outline n File-System.
CSE Operating System Principles File System Interface.
Lecture 13 Page 1 CS 111 Online Basics of File System Design Where do file systems fit in the OS? File control data structures.
Chapter 12: File System Implementation
Introduction to Kernel
Module 12: I/O Systems I/O hardware Application I/O Interface
Chapter 11: File System Implementation
Chapter 12: File System Implementation
File System Implementation
4.3 Network File System (NFS)
An overview of the kernel structure
Chapter 2: The Linux System Part 2
Chapter 15: File System Internals
Chapter 11: File System Implementation
Chapter 15: File System Internals
Chapter 15: File System Internals
Introduction to Operating Systems
Presentation transcript:

zhanglifen 13 FILE SYSTEM FRAMEWORK 13 FILE SYSTEM FRAMEWORK —— virtual file system framework

2 Outline  Solaris File System Framework  The vnode  The vfs Object

Solaris FILE SYSTEM FRAMEWORK  Solaris virtual file system framework  the virtual file system framework implementes multiple file system types.  It allows Sun ’ s distributed computing file system (NFS) to coexist with the UFS file system in SunOS 2.0  Solaris file systems can be categorized into the following types:  Storage based — Regular file systems. The Solaris UFS and PC/DOS file systems are examples.  Network file systems — for example, NFS  Pseudo file systems — The /proc pseudo file system is example.

Unified File System Interface  The framework provides a single set of well-defined interfaces.  Two key objects represent these interfaces:  the virtual file, or vnode: The vnode interfaces implement file-related functions.  the virtual file system, or vfs objects: the vfs interfaces implement file system management functions.

5 the file system layers is shown below Figure 13.1 shows the file system layers. TOP ENDTOP END BOTTOM ENDBOTTOM END

File System Framework Facilities  The vnode/vfs interfaces > The “top end” of the file system module implement vnode and vfs objects. > The “bottom end” of the file system uses other kernel interfaces to access, store, and cache the data they represent. > Disk-based file systems interface to device drivers to provide persistent storage of their data. > they interface to network file systems access the networking subsystem to transmit and receive data to remote systems. > Pseudo file systems typically access local kernel functions and structures to gather the information they represent.

File System Framework Facilities

8  Loadable file system modules are dynamically loaded at the time each file system type is first mounted.  The vnode/vfs framework implementes file functions and file system management functions.  File system caching implements caching interface with the HAT layer of the virtual memory system to map, unmap, and manage the memory used for caching.  Path-name management converts paths into vnode pointers.  Directory name caching provides a mechanism to cache pathname-to-vnode mappings.

The vnode  A vnode is a representation of a file in the Solaris kernel.  The vnode is said to be objectlike.  it is an encapsulation of a file ’ s state and the methods that can be used to perform operations on that file.  The vnode hides the implementation of the file system and exposes file system-independent data and methods for that file to the rest of the kernel.

10 A vnode object Figure 13.2 A vnode object

11 A vnode object contains three important items  File-system-independent data  the type of vnode :file, directory, character device, Block device, Hard link, Named pipe, etc.  flags of vnode : state, pointers to the file system that contains the vnode, a reference count to the vnode.  Functions to implement file methods  A structure of pointers to file-system-dependent functions, to implement file ’ s open(),close(), read(), and write().  File-system-specific data  Data that is used internally by each file system implementation; typically the in-memory inode. UFS uses an inode, NFS uses an rnode,and tmpfs uses a tmpnode.

12 A vnode object  For example, to read from a file without knowing that it resides on a UFS file system, the kernel would simply call the file-system-independent macro for read(), VOP_READ(), which would call the vop_read() method of the vnode, which in turn calls the UFS function, ufs_read().

13 The data structure of a vnode  typedef struct vnode {  kmutex_t v_lock; /* protects vnode fields */ ushort_t v_flag; /* vnode flags (see below) */ uint_t v_count; /* reference count */ struct vfs *v_vfsmountedhere; /* ptr to vfs mounted here */ struct vnodeops *v_op; /* vnode operations */ struct vfs *v_vfsp; /* ptr to containing VFS */ struct stdata *v_stream; /* associated stream */ struct page *v_pages; /* vnode pages list */ enum vtype v_type; /* vnode type */ dev_t v_rdev; /* device (VCHR, VBLK) */ caddr_t v_data; /* private data for fs */ struct filock *v_filocks; /* ptr to filock list */ struct shrlocklist *v_shrlocks; /* ptr to shrlock list */ kcondvar_t v_cv; /* synchronize locking */ } vnode_t;

Vnode Methods  The vnode interface provides the set of file system object methods  The Vnode Methods perform all file- system-specific file operations.  The figure is shown below.

Vnode Methods

vnode Reference Count  A vnode is created by the file system at the time a file is first opened or created and stays active until the file system decides the vnode is no longer needed.  The vnode framework provides an infrastructure that keeps track of the number of references to a vnode.  It is important to distinquish a vnode reference from a lock:  A lock ensures exclusive access to the data,  the reference count ensures persistence of the object.

Interfaces for Paging vnode Cache  Solaris unifies file and memory management by using a vnode to represent the backing store for virtual memory.  A page of memory represents a particular vnode and offset.  The file system uses the memory relationship to implement caching for vnodes within a file system.  The virtual memory system provides a set of functions for cache management and I/O for vnodes.

Block I/O on vnode Pages  The block I/O subsystem provides Three functions for initiating I/O to and from vnode pages.  The table shows to initiate I/O between a physical page and a device: FunctionDescription bdev_strategy() Initiates an I/O, using the block I/O device. pageio_done()Waits for the block device I/O to complete. pageio_setup()Sets up a block buffer for I/O on a page of memoryso that it bypasses the block buffer cache by setting the B_PAGEIO flag and putting the page list on the b_pages field.

The vfs Object  The vfs layer provides an administrative interface into the file system to support commands like mount and umount in a file-system- independent manner.  The interface achieves independence by means of a virtual file system (vfs) object.  The vfs object represents an encapsulation of a file system ’ s state and a set of methods for each of the file system administrative interfaces. Figure 13.3 illustrates the vfs object.

20 Structure per mounted file system typedef struct vfs { struct vfs *vfs_next; /* next VFS in VFS list */ struct vfsops *vfs_op; /* operations on VFS */ struct vnode *vfs_vnodecovered; /* vnode mounted on */ uint_t vfs_flag; /* flags */ uint_t vfs_bsize; /* native block size */ int vfs_fstype; /* file system type index */ fsid_t vfs_fsid; /* file system id */ caddr_t vfs_data; /* private data */ dev_t vfs_dev; /* device of mounted VFS */ ulong_t vfs_bcount; /* I/O count (accounting) */ ushort_t vfs_nsubmounts; /* immediate sub-mount count */ struct vfs *vfs_list; /* sync list pointer */ struct vfs *vfs_hash; /* hash list pointer */ ksema_t vfs_reflock; } /* mount/unmount/sync lock */

21 Operations supported on virtual file system  typedef struct vfsops {  int (*vfs_mount)(struct vfs *, struct vnode *, struct mounta *,  struct cred *);  int (*vfs_unmount)(struct vfs *, struct cred *);  int (*vfs_root)(struct vfs *, struct vnode **);  int (*vfs_statvfs)(struct vfs *, struct statvfs64 *);  int (*vfs_sync)(struct vfs *, short, struct cred *);  int (*vfs_vget)(struct vfs *, struct vnode **, struct fid *);  int (*vfs_mountroot)(struct vfs *, enum whymountroot);  int (*vfs_swapvp)(struct vfs *, struct vnode **, char *);  }

The File System Switch Table  The file system switch table is a systemwide table of file system types.  Each file system type that is loaded on the system can be found in the virtual file system switch table.  The file system switch table provides an ASCII list of file system names (e.g., ufs, nfs), the initialization routines, and vfs object methods for that file system.  The vfs_fstype field of the vfs object is an index into the file system switch table.

The File System Switch Table  File system type switch table is shown below: typedef struct vfssw { char *vsw_name; /* type name string */ int (*vsw_init)(struct vfssw *, int); /* init routine */ struct vfsops *vsw_vfsops; /* file system operations vector */ int vsw_flag; /* flags */ } vfssw_t;

The Mounted vfs List  You can obtain a list of mounted file systems by starting at rootvfs and following the vfs -> vfs_next chain, as shown in Figure Figure 13.4 The Mounted vfs List

25 Reference  Jim Mauro, Richard McDougall, Solaris Internals-Core Kernel Components, Sun Microsystems Press, 2000  Solaris internals and performance management, Richard McDougall, 2002