A file system is a means for organizing data on a storage device. In other words, a file system may be used to control how data is stored and retrieved from a storage system. Typically, data may be stored as a “file”. A file system provides the basic structure for organizing files in a storage device. For instance, a file may be placed in a directory or subdirectory of a file system. The file system keeps track of file locations (physical or virtual) on a storage medium.
For a better understanding of the solution, embodiments will now be described, purely by way of example, with reference to the accompanying drawings, in which:
A file system is an integral part of an operating system. It provides the underlying structure that a computing device uses to organize data on a storage medium. A computer file or “file” is the basic component of a file system. Each piece of data on a storage device may be called a “file”. A file may contain data, such as text files, image files, video files, and the like, or it may be an executable file or program.
Files may be organized by storing related files in a directory or sub-directory. A directory or sub-directory is also a file. The term “directory” (or “file directory), as used herein, may include a file that contains references (for example, names) to other files. Thus, a directory may be considered as a container for files. Each directory might consist of several files and in order to store these file names and respective inode number (i.e. (filename, inode number)), it may require several on-disk pages. Each such page is called as directory page. Directory page, thus, is a container which may hold a finite set of filenames and respective inode mapping i.e. {filename, inode number}. Apart from {filename, inode number}, a directory page may hold other metadata relevant to an inode or a file.
In a hierarchical file system, a directory contained inside another directory is called a subdirectory. The top-most directory in such a file system, which does not have a parent of its own, is called the root directory.
Increased adoption of technology by businesses has led to an explosion of data, which is typically organized by a file system as a collection of files and directories. A file system may be associated with a volume, which is, generally, a single accessible storage area on a single partition of a storage medium, such as a hard disk, optical disc, NAND flash memory, etc. A volume may be divided into blocks, which is a sequence of bits or bytes. Many file systems use blocks to store file and directories. In an instance, a file or directory may be stored over several blocks that may be located at various places on a volume. In other words, a directory may be spread over different physical areas of a storage medium. One of the reasons for fragmentation of directory extents is that a directory page allocation request is serviced from same free space pool on a storage medium which is used for servicing other storage allocation requests such as a data or tag page allocation request.
If the directories and their pages on a storage medium are fragmented i.e. they are not close enough; it may cause a number of issues. For instance, it may result in a longer read latency since a directory may be scattered over multiple blocks in a storage medium. It may lead to a longer disk spindle movement and, consequently, more power consumption since multiple I/O reads may be required. In another instance, it may impact the performance of a file correction tool, such as a file system check (fsck), since in order to validate a directory tree and correct name space connectivity, an fsck tool may need to walk the name space resulting in read of several directories and their respective directory pages on disk. If the directories and their pages on disk are not close enough, it may result in longer read latency and affect the performance of fsck tool.
To prevent these issues, the present disclosure describes various examples for storing file directories on a storage device. In an example, a portion of available free space on a storage device may be assigned or demarcated for storing file directories only. When a request for allocating storage space for a file directory is received, the assigned portion may be used to store the file directory. In an instance, this would lead to aggregation of the directories and directory pages, which would help bring the directories close to each other, thereby improving the read latency, directory listing and fsck tool directory tree connectivity phase.
In the example of
In an example, storage device 102 may store data based on a block-based file system. In a block based file system, files are typically stored in units known as blocks, which is a sequence of bytes or bits. Many file systems use blocks to store file and directories. In such case, data is read as a whole block. A block includes data only from a single file. In many instances, a storage device (example, 102) may contain empty blocks. These may include unused blocks i.e. blocks on which no data have been written so far or blocks from which data has been deleted. Such areas (or blocks) on a storage device (example, 102) may be termed as “free space.”
Some non-limiting examples of file systems that may be used on storage device (example, 102) may include FAT (FAT12, FAT16, FAT32), NTFS, HFS and HFS+, HPFS, UFS, ext2, ext3, and ext4. Further, various allocation methods may be used to allocate a file on storage device (example, 102). An allocation method refers to how disk blocks are allocated for files. For example, in contiguous allocation, each file may occupy a set of contiguous blocks on the storage device (example, 102). In another form of contiguous allocation, a file system may allocate disk blocks in extents. An extent is a contiguous block of disks, which may be used for file allocation. A file may consist of one or more extents. In linked allocation, each file may be a linked list of disk blocks, and the blocks may be scattered anywhere on the disk. In indexed allocation, all pointers to file data are brought together in an index block.
In an example, a section of available free storage space on a storage device (example, 102) may be assigned or reserved for storing file directories or directory pages only. In others words, free space available on a storage medium (example, 102) may be analyzed, and a portion of such free space may be reserved for storing file directories or directory pages only. The reserved area of free storage space may not be used for storing any other file, such as a data file, a metadata file, an executable file, etc., apart from a file directory or directory page.
When a request is received for allocating storage space to a directory (or directory page) on the storage device 102, system module 104 may allocate storage space to the directory (or directory page), from the assigned section only. In other words, all directory or directory page allocation requests may get storage space from the reserved section of the storage device (example, 102) only. This results in aggregation of directories and directory pages in a specific physical area of the storage device (example, 102). Likewise, if a request is received for allocating storage space to a sub-directory of a file directory already stored in the assigned section of the storage device (example, 102), the sub-directory may be allocated a storage space in physical proximity of the file directory in the assigned portion of the storage space. In another instance, upon receipt of a request for allocating storage space to a sub-directory of a file directory already stored in the assigned section of the storage device, system module 104 may allocate to the sub-directory a storage space contiguous to the storage space allocated to the file directory in the assigned portion of the available free space. In a contiguous allocation, both the file directory and the sub-directory may occupy a set of contiguous blocks on the disk.
In the event a request is received for allocating storage space to a file associated with a file directory (for e.g., a data file), such request may be fulfilled from the unassigned portion of the available free storage space.
In an example, the portion of available free space assigned only for storing a file directory (or a directory page) is proportionate (for example, percentage) to the available free space on the storage device (example, 102). This is illustrated in
In an instance, computing device 100 may include a file system check (fsck) module 106. An fsck module 106 may be used for checking and repairing file system inconsistencies on the storage device. A file system may become inconsistent, for example, due to power failure, a nonstandard shutdown, hardware failure, etc. This may cause inconsistencies and mismatched information relating to data blocks, free blocks, inodes, etc. in a file system. In an example, allocating a portion of available free space on a storage device for storing file directories only, and utilizing the assigned portion to store a file directory, may enable an fsck module 106 to improve read latency during directory tree validation involving the file directories. It may also enable a file system check (fsck) module 106 to check consistency of a file system that includes such directories (or directory pages).
The term “module” may refer to a software component (machine readable instructions), a hardware component or a combination thereof. A module may include, by way of example, components, such as software components, processes, tasks, co-routines, functions, attributes, procedures, drivers, firmware, data, databases, data structures, Application Specific Integrated Circuits (ASIC) and other computing devices. A module may reside on a volatile or non-volatile storage medium (for example, 102) and configured to interact with a processor of a computing device (e.g. 100).
Storage device 300 may be a primary storage device such as, but not limited to, random access memory (RAM), read only memory (ROM), processor cache, or another type of dynamic storage device that may store information and machine-readable instructions that may be executed by a processor. For example, Synchronous DRAM (SDRAM), Double Data Rate (DDR), Rambus DRAM (RDRAM), Rambus RAM, etc. Storage device 102 may be a secondary storage device such as, but not limited to, a floppy disk, a hard disk, a CD-ROM, a DVD, a pen drive, a flash memory (e.g. USB flash drives or keys), a paper tape, an Iomega Zip drive, and the like. Storage device 300 may be a tertiary storage device such as, but not limited to, a tape library, an optical jukebox, and the like. In another example, storage device 300 may be a Direct Attached Storage (DAS) device, a Network Attached Storage (NAS) device, a tape drive, a magnetic tape drive, a data archival storage system, or a combination of these devices.
In an example, storage device may include a section 302 dedicated for storing only file directories (or directory pages) of a file system. The section 302 is a portion of available free space on the storage device wherein all file directories (or directory pages) of the file system may be stored. Storing all file directories (or directory pages) in the dedicated section 302 improves the read latency during directory tree validation involving such file directories.
Storage device may include a file system check (fsck) module 106, which may be analogous to the fsck module described earlier. In an example, fsck module 106 may perform directory tree validation of a file system comprising file directories (and/or directory pages) stored in the dedicated section of the storage device.
In an example, prior to reserving a portion of available free space on a storage device for storing file directories (or directory pages); the free space available on the storage space may be determined. In another example, the portion of available free space assigned or reserved for allocating storage space to a directory (or directory page) may increase or decrease (i.e. it may grow or shrink dynamically, as required) depending on various pre-defined factors. These may include, by way of example, the available free space on a storage device at a given time or period, number of directory (or directory page) requests in a given period, etc.
At block 404, upon receipt of a request for allocating storage space to a file directory on the storage device (example, 102), the portion of the available free space assigned for storing file directories (or directory pages) may be utilized to store the file directory. In an example, if a request is received for allocating storage space to a sub-directory of a file directory already stored in the assigned section of the storage device, the sub-directory may be allocated a storage space in physical proximity of the file directory in the assigned portion of the storage space. In another instance, upon receipt of a request for allocating storage space to a sub-directory of a file directory already stored in the assigned section of the storage device (example, 102), the sub-directory may be allocated a storage space contiguous to the storage space allocated to the file directory in the assigned portion of the available free storage space. Allocating directories (or directory pages) in a reserved area of storage space, the directory pages are stored close to each other, thereby reducing directory fragmentation.
For the purpose of simplicity of explanation, the example method of
It may be noted that the above-described examples of the present solution is for the purpose of illustration only. Although the solution has been described in conjunction with a specific embodiment thereof, numerous modifications may be possible without materially departing from the teachings and advantages of the subject matter described herein. Other substitutions, modifications and changes may be made without departing from the spirit of the present solution. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and/or all of the steps of any method or process so disclosed, may be combined in any combination, except combinations where at least some of such features and/or steps are mutually exclusive.
Number | Date | Country | Kind |
---|---|---|---|
3722/CHE/2014 | Jul 2014 | IN | national |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/US2014/056337 | 9/18/2014 | WO | 00 |