Mounting means attaching a disk to a filesystem.
When mount option get selected in the storage manager, these are following operations performed:
- It asked for device information. It will check against read only and set the variable as if after set, it will be read-only disk.
- Now it will get device info and will set FAT FS for the device flag variable.
- Find out the total number of sectors.
- There is read and write operation performed on the disk for which we allocate a buffer. It’s an interesting operation. There is two term FAT Cache and Data Cache comes into picture. FAT Cache is cache of actual sector which comprises the FAT table. Necessity of FAT Cache is that it allow to access very large chunk of files hence we have to traverse in the table of 2^17 for 32k clusters. So with increasing the FAT cache size will resolve the traversing so long. Data Cache is to keeping the cache of file names with a directory. Like to create a new file in a directory will lead to check all file name and then only we can use the new file name.
Using the registry you can increase or decrease
[HKEY_LOCAL_MACHINE\System\StorageManager\FATFS]
"FatCacheSize"=0xXXXXX - Size of the FAT Table Cache
"DataCacheSize"=0xXXXX - Size of the Data Cache
It also checks for cache ID. If it does not exist it also means that the area if for boot and it’s cache disable so there will be normal read and write operation will happen but if it is under cache ID the read or write operation will only perform on the cache. No direct access will be on the sector.
It also finished the reading and writing of disk.
- Now it will find the volume. It also means that it will check for the same volume name and will add the new disk name to the disk link list structure.
- It will now mount the volume with the filesystem. In turn will perform the following operation:
- Open the volume – It first tries to find the volume. If it does not exist then will create one. Then initialize the volume. This operation makes sure that all registry entry parameter is added with volume. Also the volume structure contains all information from size of volume to cluster related parameter. The cluster related value will contain take care of root directory to nested one.
- Refresh the volume – This operation required as it can have many open handle. We do even if we have invalid volume.
- Format volume if it unformatted or invalid or read only or other invalid conditions – This will format the volume again if required.
- Register the volume with filesystem – It will give a name to the volume.
- Close the volume – Close the volume handle. This operation comes in picture only if we can’t allocate enough buffers or there is any problem in registering with the file system.
Note: In all these operation, we are using HeapAlloc not VirtualAlloc. The reason is that it will allocate the size of memory asked for not in 4k chuck or what ever like VirtualAlloc.
No comments:
Post a Comment
Please add your valuable feedback and suggestion...
Note: Only a member of this blog may post a comment.