Storing a small file with a reduced storage and memory footprint

An I/O request to store a file in a file-system is received. A determination is made whether the size of the file does not exceed a threshold size. Exceeding the threshold results in storing at least a portion of the file in a block of the file-system devoid of sub-blocks. A determination is made whether the size of the file does not exceed a size of unallocated space within a single block in the file-system. The single block includes a set of sub-blocks. Responsive to the size of the file not exceeding the threshold size and the size of unallocated space within the single block, the file is stored, at an address, in a first subset of the set of the sub-blocks of the single block. The address identifies the single block and a position of a sub-block in the subset.

TECHNICAL FIELD

The present invention relates generally to a method, system, and computer program product for an improved data storage. Particularly, the present invention relates to a method, system, and computer program product for storing a small file with a reduced storage and memory footprint.

BACKGROUND

A file is a data structure for storing data using a file-system on a data storage device. Some examples of the data storage devices (storage devices) on which file-systems are constructed include magnetic hard disk drives and tape drives, flash memory cards and other solid-state data storage devices, and optical data storage devices.

When an application requests a file, the file is loaded from the storage device into a working memory (memory). To enable this loading, reading, and writing of data to the storage device, the file data is stored on the storage device in blocks (pages) of a fixed size (page size). For example, data storage blocks in a particular configuration may be 64 Kilobytes (KB) in size, with a file's data being stored in one or more of such blocks.

A file-system being used, an operating system under which the file-system executes, a memory manager, or a combination thereof define the size of blocks used to store files in the file-system. The file-system keeps track of the blocks that comprise a file. As and when a file is requested, the blocks where the data of the requested file is stored are identified by the file-system, and some or all of the blocks storing the data of a file are loaded from, read from, or written to the storage device.

SUMMARY

The illustrative embodiments provide a method, system, and computer program product for storing a small file with a reduced storage and memory footprint.

In at least one embodiment, a method for storing files is provided. The method includes a processor receiving a first I/O request to store a first file in a file-system of a data storage device. The method further includes the processor determining whether the size of the first file does not exceed a threshold size, wherein exceeding the threshold results in storing at least a portion of the first file in a block of the file-system devoid of sub-blocks. The method further includes the processor determining whether the size of the first file does not exceed a size of unallocated space within a single block in the file system, the single block including a set of sub-blocks. The method further includes the processor, responsive to determining that the size of the first file does not exceed the threshold size, and responsive to determining that the size of the first file does not exceed the size of unallocated space within the single block in the file-system, storing, at a first address, the first file in a first subset of the set of the sub-blocks of the single block. The first address identifies the single block and a position of a sub-block in the subset.

In at least one embodiment, a computer program product for storing files is provided. The computer program product includes one or more computer-readable tangible storage devices. The computer program product further includes program instructions, stored on at least one of the one or more storage devices, to receive a first I/O request to store a first file in a file-system of a data storage device. The computer program product further includes program instructions, stored on at least one of the one or more storage devices, to determine whether the size of the first file does not exceed a threshold size, wherein exceeding the threshold results in storing at least a portion of the first file in a block of the file-system devoid of sub-blocks. The computer program product further includes program instructions, stored on at least one of the one or more storage devices, to determine whether the size of the first file does not exceed a size of unallocated space within a single block in the file system, the single block including a set of sub-blocks. The computer program product further includes program instructions, stored on at least one of the one or more storage devices, to, responsive to determining that the size of the first file does not exceed the threshold size, and responsive to determining that the size of the first file does not exceed the size of unallocated space within the single block in the file-system, store, at a first address, the first file in a first subset of the set of the sub-blocks of the single block. The first address identifies the single block and a position of a sub-block in the subset.

In at least one embodiment, a computer system for storing files is provided. The computer system includes one or more processors, one or more computer-readable memories and one or more computer-readable tangible storage devices. The computer system further includes program instructions, stored on at least one of the one or more storage devices for execution by at least one of the one or more processors via at least one of the one or more memories, to receive a first I/O request to store a first file in a file-system of a data storage device. The computer system further includes program instructions, stored on at least one of the one or more storage devices for execution by at least one of the one or more processors via at least one of the one or more memories, to determine whether the size of the first file does not exceed a threshold size, wherein exceeding the threshold results in storing at least a portion of the first file in a block of the file-system devoid of sub-blocks. The computer system further includes program instructions, stored on at least one of the one or more storage devices for execution by at least one of the one or more processors via at least one of the one or more memories, to determine whether the size of the first file does not exceed a size of unallocated space within a single block in the file system, the single block including a set of sub-blocks. The computer system further includes program instructions, stored on at least one of the one or more storage devices for execution by at least one of the one or more processors via at least one of the one or more memories, to, responsive to determining that the size of the first file does not exceed the threshold size, and responsive to determining that the size of the first file does not exceed the size of unallocated space within the single block in the file-system, store, at a first address, the first file in a first subset of the set of the sub-blocks of the single block. The first address identifies the single block and a position of a sub-block in the subset.

DETAILED DESCRIPTION

The size of blocks used for storing file data on storage devices has increased with improvements in operating system and data storage technologies. Blocks having a 64 KB block size are commonly used in a variety of presently available file-systems and operating systems.

The illustrative embodiments recognize that while using large block sizes for file-systems may improve data read/write performance of a storage device, large block sizes waste data storage space on the storage device and memory under certain circumstances. For the purposes of this disclosure, a large block size (large page size) is a block size larger than a threshold size. A large block is a block having a large block size. Further for the purposes of this disclosure, a “block” means a “large block” unless qualified otherwise.

A file smaller than a fraction of the block size is called a small file within the scope of this disclosure. As an example of the wastage of storage and memory space, consider the common situation where a significant number of files are small files. In fact, some file-systems, such as email storage systems or text message storage systems in mobile communication devices, are specifically configured to support small files. When a large block is used to store a small file, a significant amount of space in that large block is unused on the storage device. When the large block is loaded in memory, the unused space of the large block translates into occupied but unused space in the corresponding memory page. Thus, storing a small file in a large block wastes data storage space on the storage device as well as in the memory.

A typical file-system is designed with the expectation that most small files will grow to occupy an entire block or more than one block. Therefore, as the illustrative embodiments recognize, where files are stored outside of a file's metadata or inode, presently available file-systems do not treat the storage mechanism of small files any differently than the storage mechanism of a file that occupies several blocks.

The illustrative embodiments further recognize that modern file-systems and operating systems are being improved to support increasingly larger block and page sizes, respectively, further exacerbating the data storage space wastage. Thus, in a typical implementation of a presently available file-system, the combination of small files and large blocks or pages results in wasted space on the storage devices and memory.

The illustrative embodiments used to describe the invention generally address and solve the above-described problems and other problems related to wasteful storage of small files. The illustrative embodiments provide a method, system, and computer program product for storing a small file with a reduced storage and memory footprint. A footprint of a file is an amount of space the file occupies on a given data storage device, and is typically larger than the amount of data present in the file due to the reasons explained above.

Generally, an embodiment provides a data storage and addressing scheme to achieve a reduction in the footprint of small files on both the data storage device as well as the working memory of a data processing system. Furthermore, an embodiment utilizes a common block size for storing large files and the small files, and improves the utilization of the block when used for storing a small file. A large file according to an embodiment is a file whose data size exceeds a certain fraction of the size of a block. A size corresponding to that fraction is called an upgrade size. A file is considered small if the file data is of a size up to the upgrade size, and large if the file data size exceeds the upgrade size.

Additionally, an embodiment provides a way to read, write, load, or otherwise manipulate an entire block. An embodiment maps different parts of a common block to different small files. The mapping according to an embodiment enables the reading, writing, and other operations on the small files without requiring read/write or load of partial blocks from the storage device. Thus, as improved by an embodiment, a presently available file-system continues to track the files and I/O operations at the block level without any complications of tracking partial blocks.

The illustrative embodiments are described with respect to certain data and data structures only as examples. Such descriptions are not intended to be limiting on the invention. For example, an illustrative embodiment described with respect to a particular block size, sub-block size, or address format can be implemented with additional or different sizes and formats within the scope of the illustrative embodiments.

Furthermore, the illustrative embodiments may be implemented with respect to any type of data, data source, or access to a data source over a data network. Any type of data application or storage device may provide the data, such as file data, to an embodiment of the invention, either locally at a data processing system or over a data network, within the scope of the invention.

The illustrative embodiments are further described with respect to certain applications only as examples. Such descriptions are not intended to be limiting on the invention. An embodiment of the invention may be implemented with respect to any type of application, such as, for example, applications that are served, the instances of any type of server application, a platform application, a stand-alone application, an administration application, or a combination thereof.

An application, including an application implementing all or part of an embodiment, may further include data objects, code objects, encapsulated instructions, application fragments, services, and other types of resources available in a data processing environment. For example, a Java® object, an Enterprise Java Bean (EJB), a servlet, or an applet may be manifestations of an application with respect to which the invention may be implemented. (Java and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle Corporation and/or its affiliates).

An illustrative embodiment may be implemented in hardware, software, or a combination thereof. An illustrative embodiment may further be implemented with respect to any type of data storage resource, such as a physical or a virtual data storage device that may be available in a given data processing system configuration.

The illustrative embodiments are described using specific code, designs, architectures, layouts, schematics, and tools only as examples and are not limiting on the illustrative embodiments. Furthermore, the illustrative embodiments are described in some instances using particular software and data processing environments only as an example for the clarity of the description. The illustrative embodiments may be used in conjunction with other comparable or similarly purposed structures.

FIG. 1depicts a pictorial representation of a network of data processing systems in which illustrative embodiments may be implemented. Data processing environment100is a network of computers in which the illustrative embodiments may be implemented. Data processing environment100includes network102. Network102is the medium used to provide communications links between various devices and computers connected together within data processing environment100. Network102may include connections, such as wire, wireless communication links, or fiber optic cables. Server104and server106couple to network102along with storage unit108. Software applications may execute on any computer in data processing environment100.

In addition, clients110,112, and114couple to network102. A data processing system, such as server104or106, or client110,112, or114, may contain data and may have software applications or software tools executing thereon.

As an example, storage108includes file system109modified to use blocks that include sub-blocks in the manner of an embodiment. Volume manager111is an example application for managing file-system109, such as for reading and writing data in blocks and sub-blocks of file-system109. For example, file-system109is shown to use 64 KB blocks, some of which include sub-blocks according to an embodiment. In operation, an application executing in client114(not shown) may request to manipulate a file stored in file-system109. Consequently, one or more blocks from file-system109are loaded into client114's memory (not shown) so that the application executing in client114can manipulate the file data stored in those blocks. If the file being manipulated is a small file, the block storing the small file stores additional data according to an embodiment to reduce wasted data storage space on storage108and wasted page space in the memory of client114.

In the depicted example, data processing system200employs a hub architecture including North Bridge and memory controller hub (NB/MCH)202and south bridge and input/output (I/O) controller hub (SB/ICH)204. Processing unit206, main memory208, and graphics processor210are coupled to north bridge and memory controller hub (NB/MCH)202. Processing unit206may include one or more processors and may be implemented using one or more heterogeneous processor systems. Graphics processor210may be coupled to NB/MCH202through an accelerated graphics port (AGP) in certain implementations.

An operating system runs on processing unit206. The operating system coordinates and provides control of various components within data processing system200inFIG. 2. The operating system may be a commercially available operating system such as Microsoft® Windows® (Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other countries, or both), or Linux® (Linux is a trademark of Linus Torvalds in the United States, other countries, or both). An object oriented programming system, such as the Java™ programming system, may run in conjunction with the operating system and provide calls to the operating system from Java™ programs or applications executing on data processing system200(Java and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle and/or its affiliates).

Program instructions for the operating system, the file-system, the processes of the illustrative embodiments, and applications or programs, such as volume manager111ofFIG. 1, are located on one or more storage devices, such as hard disk drive226, and may be loaded into a memory, such as, for example, main memory208, read only memory224, or one or more peripheral devices, for execution by processing unit206. Program instructions may also be stored permanently in non-volatile memory and either loaded from there or executed in place. For example, the synthesized program according to an embodiment can be stored in non-volatile memory and loaded from there into DRAM.

With reference toFIG. 3, this figure depicts a block diagram of storing a small file with a reduced storage and memory footprint in accordance with an illustrative embodiment. File-system302is usable as file-system109inFIG. 1.

Only as an example and without implying any limitation there from, file-system302is depicted to include blocks of 64 KB size. A block in file system302, such as block304, stores more than one small file for reducing the footprint of small files according to an embodiment. Another block of the same size, such as block306, stores all or part of a large file, thus avoiding the need for blocks of different sizes. Small file boundary (SFB)308separates the blocks that store small files from the blocks that store large files.

In one embodiment, SFB308is dynamically adjusted as a function of the number of small files existing in file-system302. For example, an application, such as volume manager111inFIG. 1, can utilize a rule or policy to trigger the dynamic adjustment of SFB308.

In another embodiment, an application, such as volume manager111inFIG. 1, can set SFB308at the file-system creation time. Regardless of how determined, SFB308is adjustable. For example, as the number of small files increases in file-system302, the application may move SFB308further to the right as depicted, to include more blocks similar to block304to accommodate more small files. Conversely, if the number of small files decreases in file-system302, the application may move SFB308to the left as depicted, to allow more space for large files by increasing the number of blocks similar to block306and reducing the number of blocks similar to block304.

A block that stores one or more small files, such as block304, includes a set of sub-blocks of a sub-block size. A set of sub-blocks is one or more sub-blocks. The sub-block size is a size that can be determined according to a particular implementation.

As an example, in a given file-system, a significant number of small files may be of 4 KB size or less. Accordingly, in one embodiment, block304of size 64 KB includes sixteen sub-blocks of 4 KB size each.

A subset of the set of sub-blocks can be used for storing a small file. For example, a small file of size 4 KB occupies one sub-block of size 4 KB; another small file of size 8 KB occupies two sub-blocks of 4 KB each. Similarly, a small file of size 12 KB occupies three sub-blocks of 4 KB each.

The number of sub-blocks in the subset of sub-blocks that is used to store a small file depends on the upgrade size. The upgrade size is also determined based on the requirements of a particular implementation.

Continuing with the above example of 64 KB blocks with 4 KB sub-blocks, an administrator may select the upgrade size to be 16 KB. In other words, a small file can be stored using no more than four sub-blocks of 4 KB each.

A small file may increase in size, such as when data is written/added to the file. Once a small file exceeds the upgrade size, the small file becomes a large file. An application, such as volume manager111inFIG. 1, migrates the (formerly small) file (upgrade) from being stored using a subset of sub-blocks in a block, such as in block304, to a block that is occupied by all or part of only one file, such as block306. In one embodiment, the application copies the data of the formerly-small file from block304to block306, and the application frees the sub-blocks previously occupied by the file in block304.

Conversely, a large file may decrease in size, such as when data is deleted from the file. Once a large file shrinks at or below the upgrade size, the large file becomes a small file. Optionally, the (formerly large) file can be migrated (downgraded) by the application from being stored using a large block, such as block306, to being stored using a subset of sub-blocks in a block, such as in block304. In one embodiment, the application copies the data of the formerly-large file from block306to a subset of sub-blocks of block304, and frees block306previously occupied by the file.

Continuing with the example using block size of 64 KB, sub-block size of 4 KB, and upgrade size of 16 KB, as an example, block304is depicted in an enlarged view inFIG. 3, showing the sub-blocks therein, the contents of the sub-blocks, and addressing of those contents according to an embodiment. In the depicted example, block304includes file312labeled “File1” of size 16 KB and occupying four sub-blocks as depicted by shading. Block304further includes file314labeled “File2” of size 8 KB and occupying two sub-blocks as depicted by shading. Block304further includes file316labeled “File3” of size 12 KB and occupying three sub-blocks as depicted by shading. Block304further includes file318labeled “File4” of size 4 KB and occupying one sub-block as depicted by shading.

Addresses322,324,326, and328are constructed by an application managing file-system302, such as volume manager111inFIG. 1, according to an embodiment such that applications requesting access to one of files312-318, such as file314, can access the sub-blocks holding file314's data without reading or writing file312or file316's sub-blocks.

The sub-blocks in block304are addressable using a two part addressing technique according to an embodiment. For example, address322allows an application to access file312, address324allows an application to access file314, address326allows an application to access file316, and address328allows an application to access file318. Each of addresses322-328are, as an example, 32-bit addresses. Further, only as an example and not as a limitation on an embodiment, each of addresses322-328comprises a lower part of the address and an upper part of the address.

For example, the lower order 24 bits, depicted as Hexadecimal “000007”, form the lower part in each of addresses322-328, and the higher order 8 bits depicted as Hexadecimal “04” in address322, Hexadecimal “42” in address324, Hexadecimal “83” in address326, and Hexadecimal “c1” in address328, form the upper part in those corresponding addresses. The lower order bits designate the starting block number (offset) for block304in file-system302. As depicted, block304occupied the eighth position in file-system302(7, when blocks are numbered 0-n), hence, the value of “000007” in the lower order bits of addresses322-328.

When a block includes sub-blocks, such as block304, the high order bits represent information about the sub-blocks. When the block stores a large file without the sub-blocks, such as block306, the higher order bits denote the number of large blocks used for storing the large file. In the case of blocks with sub-blocks, such as block304, a first portion of the higher order bits denotes the starting sub-block number within a large block, and a second portion of the higher order bits denotes the number of sub-blocks used to store the small file.

As an example and not as a limitation, the highest four bits in address322, having a value “0” (depicted as underlined) represents that small file312addressed by address322begins at sub-block0in block304at offset7in file-system302. Similarly, the highest four bits in address324, having a value “4” (depicted as underlined) represents that small file314addressed by address324begins at sub-block4in block304at offset7in file-system302. Similarly, the highest four bits in address326, having a value “8” (depicted as underlined) represents that small file316addressed by address326begins at sub-block8in block304at offset7in file-system302. Similarly, the highest four bits in address328, having a value “c” (depicted as underlined) represents that small file318addressed by address328begins at sub-block12in block304at offset7in file-system302.

Also as an example and not as a limitation, the next highest four bits in address322, having a value “4” (depicted as boldfaced) represents that small file312addressed by address322occupies4sub-blocks starting at sub-block0in block304at offset7in file-system302. Similarly, the next highest four bits in address324, having a value “2” (depicted as boldfaced) represents that small file314addressed by address324occupies2sub-blocks starting at sub-block4in block304at offset7in file-system302. Similarly, the next highest four bits in address326, having a value “3” (depicted as boldfaced) represents that small file316addressed by address326occupies3sub-blocks starting at sub-block8in block304at offset7in file-system302. Similarly, the next highest four bits in address328, having a value “1” (depicted as boldfaced) represents that small file318addressed by address328occupies1sub-block starting at sub-block12in block304at offset7in file-system302.

In one embodiment, upon first storage into a block with sub-blocks, an application managing file system302, such as volume manager111inFIG. 1, allocates a subset of sub-blocks to a small file, the size of the subset being the upgrade size divided by the sub-block size. For example, the application allocates to file312four sub-blocks (16 KB upgrade size, divided by 4 KB sub-block size) and file312occupies all four sub-blocks. Similarly, the application allocates to file314four sub-blocks but file314occupies only two of the four sub-blocks. Similarly, the application allocates to file316four sub-blocks but file316occupies only three of the four sub-blocks. Similarly, the application allocates to file318four sub-blocks but file318occupies only one of the four sub-blocks.

As an example and not as a limitation, for a large file stored using a block to the right of SFB308, the full 32-bit address represents the 64 KB blocks. The highest 8 bits may be used to count up to 256 contiguous 64 KB blocks forming a large file, and the lower order 24 bits designate the 64 KB block number, or offset, in a manner similar to the lower order bits of addresses of blocks to the left of SFB308. For example, address330indicates that block306is the eleventh block (Hexadecimal “00000b”) in file-system302and the starting block of a large file that consumes four (“Hexadecimal “04”, depicted as underlined) 64 KB blocks.

In other words, the lower part of the address operates as an offset into the blocks array in the file-system, and the upper part of the address operates as a vector into the block for locating a small file therein or indicates a size of a large block array used to store a large file. Thus, the addressing scheme allows storing multiple small files using sub-blocks in a block, yet maintains addressability of each individual small file within the block.

The addressing scheme further allows storing large files and small files using the same block sizes in a manner that is transparent to the file-system, yet reducing the footprint of small files in the file-system. When a small file block is loaded into memory as a page, the addressing scheme allows applications to transparently access the small files in the page without corrupting adjacent small files in the same page, yet reduces the footprint of small files in the memory. Addressing of small files in memory is described in further detail with respect toFIG. 4.

While an addressing scheme is described using 32 bit addresses split into 24 bits and 8 bits, an embodiment can be implemented with an address of any size, partitioned into two parts of any size as needed in a particular implementation within the scope of the illustrative embodiments. Furthermore, while a small file is allocated a number of sub-blocks based on an example calculation using the upgrade size and the sub-block size, an implementation can chose to allocate a different number of sub-blocks, computed using a different algorithm, within the scope of the illustrative embodiments. Allocating different numbers of sub-blocks to different small files within a block is not precluded by any description of any illustrative embodiment.

With reference toFIG. 4, this figure depicts an address mapping technique for addressing separate small files within a common memory page in accordance with an illustrative embodiment. File-system402corresponds to file-system302inFIG. 3. Block404corresponds to block304inFIG. 3and includes a set of sub-blocks are depicted in the enlarged view406of block404. As an example, block404is of 64 KB size and includes four files occupying four, two, three, and one sub-blocks respectively, as an example configuration described with respect to block304inFIG. 3and as depicted in enlarged view406inFIG. 4. File-system402knows at page-in time, if file-system402is paging in a small file block or a large file block. If the block number is smaller than SFB, such as depicted for example block404, the block being paged-in is a known to be small file block; otherwise the block is considered a large file block.

Block406is paged into real memory, such as main memory208ofFIG. 2, as page408. Page408is a 64 KB real page frame located at an example real memory address 0x2eb. “File1” is located at sub-blocks 0x0-0x3, occupying four 4 KB sub-blocks in page408as shown. “File2” is located at sub-blocks 0x4-0x7, occupying two 4 KB sub-blocks in page408as shown. “File3” is located at sub-blocks 0x8-0xb, occupying three 4 KB sub-blocks in page408as shown. “File4” is located at sub-blocks 0xc-0xf, occupying one 4 KB sub-block in page408as shown.

As an example, assume that File2and File4are in use by applications and are therefore in memory and have their own virtual memory segments—virtual memory segment410for File2at virtual address 0x10b and virtual memory segment412for File4at virtual address 0x10e. Assuming a 64 KB page size to correspond with the 64 KB block size in this example, File2and File4can each have at most one 64 KB virtual page as they are small files (smaller than 16 KB in this example). File2has virtual page414, and File4has virtual page416as shown.

On a data storage device, File2has two 4K sub-blocks and File4has one 4K sub-block as described earlier, and therefore, File2has two 4K sub-blocks and File4one 4K sub-block in the real page frame of 64 KB (real memory page408) when loaded. In virtual memory, as referenced by the applications accessing File2and File4, the two blocks of File2have virtual addresses 0x10b0 and 0x10b1, and the one block of File4has the virtual address 0x10e0. These virtual addresses are used by the applications for manipulating the contents of Files2and4.

An application that manages memory access in a data processing system maintains the information included in page frame table418. Page frame table418includes a mapping of virtual addresses of small file sub-blocks to real addresses of the corresponding sub-blocks in page408. For example, as depicted in row420, virtual address 0x10b0 maps to real address 0x2eb4, for a (sub) block size of 4 KB. As depicted in row422, virtual address 0x10b1 maps to real address 0x2eb5, for a (sub) block size of 4 KB. Similarly, as depicted in row424, virtual address 0x10e0 maps to real address 0x2ebc, for a (sub) block size of 4 KB. Note that the virtual addresses 0x10b0, 0x10b1, and 0x10e0 are virtual page numbers and not full byte offsets. Similarly, 0x2eb is a real page frame number and not a full byte offset. In other words, the full byte addresses corresponding to the depicted virtual addresses (page numbers) would be 0x10b0000, 0x10b1000, and 0x10e0000, respectively, and an implementation can use page numbers or full byte offsets within the scope of the illustrative embodiments.

Page frame table418also includes permissions for each sub-block, such as access permission per thread accessing a particular sub-block. For example, as depicted in row420, a thread accessing virtual address 0x10b0, which maps to real address 0x2eb4, has only Read permission for that (sub) block size of 4 KB. As depicted in row422, another thread accessing virtual address 0x10b1, which maps to real address 0x2eb5, has Read and write permissions for that (sub) block size of 4 KB. Similarly, as depicted in row424, a thread accessing virtual address 0x10e0, which maps to real address 0x2ebc, has Read and Execute permissions for that (sub) block size of 4 KB.

As this example illustrates, the sub-blocks based storage of a small file according to an embodiment is transparent to an application accessing the small file. The address mapping directs the file operation for a small file from the virtual address to a real address where the required sub-block of the small file is located. Furthermore, the mapping maintains the isolation between small files sharing a common block. The mapping prevents accidental read or write of sub-blocks that do not belong to a target small file by specifying the size of the (sub) block to which a row in page frame table418pertains.

With reference toFIG. 5, this figure depicts a flowchart of an example process of storing a small file with a reduced storage and memory footprint in accordance with an illustrative embodiment. Process500can be implemented in an application to manage a file-system, such as volume manager111inFIG. 1. The application including process500can take the form of program instructions of an application storable on at least one of one or more computer readable mediums and executed by at least one of one or more processors via at least one of one or more memories for managing a file-system, such as file-system402inFIG. 4. Volume manager111inFIG. 1is only one example of such an application, without implying a limitation on the illustrative embodiments to only a volume manager form of such an application.

The application defines a set of sub-blocks within a data storage block for a given file-system (block502). For example, in block502of process500, the application defines a sub-block size, a number of sub-blocks in a block of a given size in the file-system, a location of a SFB (e.g., after a defined number of blocks on a disk), or a combination thereof.

The application receives a file to store using the blocks of the file-system (block504). The application determines whether the size of the file exceeds a threshold size (block506). In other words, at block506, the application determines whether the file will fit within a number of sub-blocks allocable to a single small file (such as a number computed using the upgrade size and the sub-block size).

If the application determines that the size of the file exceeds the threshold (“Yes” path of block506), the application stores at least a portion of the file using a large block without using the sub-blocks (block508). If the application determines that the size of the file does not exceed the threshold (“No” path of block506), the application determines whether the size of the file is less than the unallocated space in a given block with sub-blocks (block510).

For example, a 64 KB block may be defined to have sixteen sub-blocks of 4 KB each as in previous examples. Of the sixteen sub-blocks, four sub-blocks may have been occupied by another small file, leaving twelve sub-blocks available for other small files. The application may determine at block510of process500that the file received in block504of process500is 8 KB in size that could fit in two of the remaining twelve unallocated sub-blocks. The application may further determine that the two sub-blocks is less than four sub-blocks that are allocable to a single small file.

If the application determines that the size of the file is less than (or equal to) the unallocated space in the block with sub-blocks, and that the file is a small file that would fit in less than or equal to defined number of sub-blocks (“Yes” path of block510), the application stores the file using a distinct subset of sub-blocks in the block (block512). If the size of the file is greater than the unallocated space in the block with sub-blocks, or that the file would not fit in less than or equal to defined number of sub-blocks (“No” path of block510), the application stores at least a portion of the file using a large block without using the sub-blocks at block508.

The application determines whether more files remain to be stored (block514). If another file remains to be stored (“Yes” path of block514), the application returns to block506. If no more files are to be stored (“No” path of block514), the application ends process500.

If the other file to be stored is also a small file, in one execution of process500, the application stores the second small file in the same block as the first small file at block512, but using a subset of sub-blocks that is distinct from the subset of sub-blocks storing the first small file. If the other file is a large file, the application stores at least a portion of the large file using another large block at block508.

With reference toFIG. 6, this process depicts a flowchart of an example process of configuring a file-system for storing a small file with a reduced storage and memory footprint in accordance with an illustrative embodiment. Process600can be implemented in an application to manage a file-system, such as volume manager111inFIG. 1, which can take the form of program instructions storable on at least one of one or more computer readable mediums and executed by at least one of one or more processors via at least one of one or more memories for managing a file-system, such as file-system402inFIG. 4.

The application defines a sub-block size to be used within a block for a given file-system (block602). The application further defines an upgrade size to be used as described earlier with respect to an embodiment (block604). The application also defines a small file boundary that can be used as described earlier with respect to an embodiment (block606). The application terminates process600thereafter.

Thus, a method, system, and computer program product are provided in the illustrative embodiments for storing a small file with a reduced storage and memory footprint. Although some embodiments are described with respect to a particular type of storage device, file-system, block size, or a combination thereof, an embodiment can be practiced with other types of storage devices, file-systems, and block sizes without limitation. An embodiment can be used to reduce the wasted space in storing a small file on a storage device, and in loading a small file into memory.

An embodiment can conserve storage space and memory by suitably adjusting the upgrade size and SFB. Furthermore, an embodiment can conserve the storage space and memory in a manner that allows continued exploitation of the advantages from large block sizes, and in a manner that avoids having to change the architectures of applications that manipulate small files.

A large block of an embodiment can be of the largest size of blocks handled by a given file-system. A sub-block of an embodiment can be of the smallest page size for which a page table entry can be made. While certain embodiments are described using blocks and pages of equal sizes, such equality is not intended to be limiting on the illustrative embodiments. An embodiment can be implemented in an environment where the block size supported by a file-system is smaller than a page size supported by the operating system, or vice versa, within the scope of the illustrative embodiments.

Any combination of one or more computer readable storage device(s) or computer readable media may be utilized. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage device may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage device would include the following: an electrical connection having one or more wires,—a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage device may be any tangible device or medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.

Program code embodied on a computer readable storage device or computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to one or more processors of one or more general purpose computers, special purpose computers, or other programmable data processing apparatuses to produce a machine, such that the instructions, which execute via the one or more processors of the computers or other programmable data processing apparatuses, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.

These computer program instructions may also be stored in one or more computer readable storage devices or computer readable media that can direct one or more computers, one or more other programmable data processing apparatuses, or one or more other devices to function in a particular manner, such that the instructions stored in the one or more computer readable storage devices or computer readable medium produce an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.

The computer program instructions may also be loaded onto one or more computers, one or more other programmable data processing apparatuses, or one or more other devices to cause a series of operational steps to be performed on the one or more computers, one or more other programmable data processing apparatuses, or one or more other devices to produce a computer implemented process such that the instructions which execute on the one or more computers, one or more other programmable data processing apparatuses, or one or more other devices provide processes for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.