Anda di halaman 1dari 10

CSE451 Introduction to Operating Systems

Spring 2008

Tour of the Windows NT File Systems

Gary Kimura & Mark Zbikowski


History
• Portable System Group formed November 1988
– Started with five software engineers
– Later became Windows NT
• FAT for NT was written in early 1989
– Supported DOS disk format
– Entirely new code base and programming model
– FASTFAT started in late 1989 (two person effort)
• Other file systems done by the Core NT group were
– HPFS, NTFS, CDFS, NPFS
• FS development was done concurrently with kernel
development
– A lot of cooperative design between the file systems, I/O system,
Memory Management, and the Cache manager
2
Fat on-disk Structure
• Boot sector, followed by reserved sector Area
• File Allocation Table (FAT)
– 12, 16, and 32 bit FAT
– Clusters size
– Typically two copies of FAT
• Root Directory
– Fixed size
– 32 byte Directory Entries (dirent)
– 8.3 names
• Data area
– Once only for file data, later expanded to include subdirectories

3
1.44 MB Floppy format

• Number of sectors = 0xB40 (2,880)


• Sector size = 0x200 (512)
• Number of Fats = 0x2, Sectors per Fat = 0x9
• Root directory Size = 0xE (14) sectors, 0xE0 (224) entries
• Layout
– Sector 0x0: boot sector
– Sector 0x1: start of first FAT
– Sector 0xA: start of second FAT
– Sector 0x13: start of root directory
– Sector 0x21: start of data area
• Disk Edit utility to help in your project
– Added to the project4 directory (copy everything to your vhd)
4
I/O – FS Interface
• Layering of drivers (file systems, disks, etc.)
– All orchestrated by the I/O System
– Driver Objects (one per file system). Each driver “registers” with
the I/O system, see DriverEntry(…) in FatInit.c
– Device Objects (one per volume). Created when a new volume is
mounted, see FatMountVolume(…) in Fsctrl.c
– File Objects (one per CreateFile call). See FatCommonCreate(…)
in create.c
• I/O Call Driver model using I/O Request Packets (IRP)
– IRP Stack locations (see “inc\ddk\wdm.h”)
– Major and minor functions
– IoCallDriver(…) and IoCompleteRequest(…)
• File Object
– FsContext and FsContext2
5
Windows FS Architecture
• Data Structure Layout
– Mimics as much as practical the on-disk directory/file
hierarchy
– Keeps in memory the opened files and directories
– Volume Control Block (VCB)
– File Control Block (FCB) and Directory Control Block
(DCB)
– Context Control Block (CCB)
– All rooted in FatData (See FatStruc.h)

6
Windows FS Architecture (Continued)
• FSD/FSP Model
– User Thread versus Worker Thread
– Driven off of IRP Major Function
• See DriverEntry(…) in FatInit.c
– Fat Common Routines
• Everything looks like a file
– FatReadVolumeFile(…)
• Some things to watch out for
– Kernel Stack Space Limitation
– Being able to wait for I/O
– Recursive routines

7
Cache/MM Interaction
• Virtual caching
• Memory Mapped Files
• Fast read and fast write
• Ancillary file system data also cached
– Borrowing a pin and unpin logic from databases
• Noncached I/O
– Where the actual read/write to disk occur
– Synchronous and Asynchronous I/O
– See read.c, write,c and deviosup.c

8
CreateFile Operation
• Some of the main files and functions to look at
• Create.c and dirsup.c
• FatFsdCreate
• FatCommonCreate
• FatCreateNewFile
• FatCreateNewDirent
• FatConstructDirent

9
Programming Style

• Engineering practices
• Comments
• Indentation
• Variable names
• Project 4 description has a synopsis of each source file

10

Anda mungkin juga menyukai