# Patent

## Title
System and method for managing small-size files in an aggregated file system

## Abstract

In an aggregated file system, a method of processing a user file retrieves user file metadata and user data from a metadata server and applies operations to the user data in accordance with a file open request from a client. At the end of the process, the method stores the processed user data at a location in accordance with a predefined rule and updates the metadata in the metadata server to reference the processed user data at the location. In some embodiments, the predefined rule is to choose a location between the metadata server and a separate storage server in accordance with the size of the processed user data. If the size is still smaller than a predetermined threshold, the user data is stored in the metadata server. Otherwise, the user data is stored in the storage server.

## Background
RELATED APPLICATIONS
This application is related to U.S. patent application Ser. No. 10/043,413, entitled FILE SWITCH AND SWITCHED FILE SYSTEM, filed Jan. 10, 2002, and U.S. Provisional Patent Application No. 60/261,153, entitled FILE SWITCH AND SWITCHED FILE SYSTEM and filed Jan. 11, 2001, both of which are incorporated herein by reference.
FIELD OF THE INVENTION
The present invention relates generally to the field of network associated storage, and more specifically to systems and methods for managing small-size files in an aggregated file system.
BACKGROUND
An aggregated file system is typically used for hosting a large number of user files. Each user file includes two distinct portions, user data and metadata. User data is the actual data of a user file that is requested and processed by a client, while metadata is information characterizing the properties and state of the user data, e.g., its location in the file system. When a file switch receives a file open request for the user file, it first retrieves the metadata from a metadata server that is part of the file system. Based on the metadata, the file switch then retrieves different stripes of the user data from one or more storage servers in response to a subsequent file read/write request and applies operations to them accordingly. At the end of the process, the metadata and user data stripes are stored back in their respective hosting metadata server and storage servers.
When a user file includes a large number of user data stripes, this scheme can improve the throughput of the aggregated file system. However, when the user file is small, e.g., including only a single data stripe, this scheme has a serious impact on the performance of the system. One reason is that even in this case the scheme requires at least two round-trip visits, one from the file switch to a metadata server and the other from the file switch to a storage server. Therefore, there is a need for a more efficient scheme for managing small-size user files in an aggregated file system.
SUMMARY
A method of processing a user file retrieves user file metadata and user data from a metadata server and applies operations to the user data in accordance with a file open request from a client. At the end of the process, the method stores the processed user data at a location in accordance with a predefined rule and updates the metadata in the metadata server to reference the processed user data at the location. In some embodiments, the predefined rule is to choose a location between the metadata server and a separate storage server in accordance with the size of the processed user data. If the size is smaller than a predetermined threshold, the user data is stored in the metadata server. Otherwise, the user data is stored in the storage server.



BRIEF DESCRIPTION OF THE DRAWINGS
The aforementioned features and advantages of the invention as well as additional features and advantages thereof will be more clearly understood hereinafter as a result of a detailed description of embodiments of the invention when taken in conjunction with the drawings.
FIG. 1 is a diagram illustrating an exemplary network environment including an aggregated file system according to some embodiments of the present invention.
FIG. 2 is a flowchart illustrating how an aggregated file system operates in response to a file open request for a small-size user file according to some embodiments of the present invention.
FIG. 3 is a schematic diagram illustrating a file switch of the aggregated file system that is implemented using a computer system according to some embodiments of the present invention.



Like reference numerals refer to corresponding parts throughout the several views of the drawings.
DESCRIPTION OF EMBODIMENTS
Definitions
User File. A “user file” is a file that a client computer works with (e.g., to read, write, or modify the file's contents). A user file may be divided into data stripes and stored in multiple storage servers of an aggregated file system.
Stripe. In the context of a file switch, a “stripe” is a portion of a user file having a fixed size. In some cases, an entire user file will be contained in a single stripe. But if the file being striped is larger than the stripe size, the file will be split into two or more stripes.
Metadata File. In the context of a file switch, a “metadata file” is a file that contains the metadata of a user file and is stored in a designated metadata server. While an ordinary client may not directly access the content of a metadata file by issuing read or write commands, it nonetheless has indirect access to certain metadata information stored therein, such as file layout, file length, etc.
File Switch. A “file switch” is a device performing various file operations in accordance with client instructions. The file switch is logically positioned between a client computer and a set of servers. To the client computer, the file switch appears to be a file storage device having enormous storage capacities and high throughput. To the servers, the file switch appears to be a client computer. The file switch directs the storage of individual user files over the servers, using striping and mirroring techniques to improve the system's throughput and fault tolerance.
Overview
FIG. 1 illustrates an exemplary network environment including a plurality of clients 120, an aggregated file system 150 and a network 130. The network 130 may include the Internet, other wide area networks, local area networks, metropolitan area networks, wireless networks, and the like, or any combination thereof. A client 120 can be a personal computer, a personal digital assistant, a mobile phone, or any equivalents capable of connecting to the network 130. To access a particular user file, a client 120 typically submits one or more file access requests to the aggregated file system 150 through the network 130. The aggregated file system 150, in response, applies certain operations to the requested user file to satisfy the requests.
The aggregated file system 150 includes a group of storage servers 180, one or more metadata servers 170 and a group of file switches 160 having communication channels 165 with the storage servers 180 and the metadata servers 170, respectively. The aggregated file system 150 manages a large number of user files, each one having a unique file name. The aggregated file system 150 may be used to store many types of user files, including user files for storing data (e.g., database files, music files, MPEGs, videos, etc) and user files that contain applications and programs used by computer users, etc. These user files may range in size from a few bytes to multiple terabytes. Different types of user files may have dramatically distinct client access rates. For example, some files may be accessed very frequently (e.g., more than 50 times per hour on average, with peak access rates of over 100 times per hour) and others may be requested infrequently (e.g., less than once per day on average).
In some embodiments, a user file is typically split into a plurality of data stripes, each data stripe further including multiple stripe fragments with each fragment stored at one of the storage servers 180. The metadata of the user file is stored in a metadata server 170. As mentioned above, this storage scheme is desired for increasing the throughput of the aggregated file system 150, especially when processing an operation associated with a user file having a large amount of user data.
This storage scheme, however, requires a file switch to complete at least two transactions even when accessing a small user file that has only one user data stripe fragment. In particular, the file switch performs a first transaction to retrieve metadata from a metadata server, the metadata including such as information about the identity of a storage server hosting the user data stripe fragment. Second, the file switch performs a second transaction to retrieve the user data stripe fragment from the hosting storage server.
According to some embodiments, to improve the throughput of the file system when dealing with a small-size user file, the user data and metadata of the user file are no longer stored on two different servers. Instead, the user data resides on the same metadata server where the metadata is located. Further, a single access to the metadata server retrieves both the metadata and the user data to the requesting client and, as a result, the file access overhead is significantly reduced.
Process
FIG. 2 is a flowchart illustrating how an aggregated file system operates in response to a file open request for a small-size user file according to some embodiments of the present invention.
Upon receipt of a file open request for a user file from a client (210), a file switch visits a metadata server to retrieve metadata associated with the user file (220). The metadata includes information about the location of user data associated with the user file and the size of the user data. In some embodiments, if the size of the user data for a particular user file is smaller than a predetermined threshold (e.g., 8KB), the user data is stored in the same metadata server where the metadata is found. Otherwise, the user data is stored in one or more of the storage servers.
Therefore, in the case that the size of the user data is smaller than the threshold, the metadata server returns the user data to the file switch (235). In some embodiments, the user data is cached in the file switch to be processed according to subsequent client requests. Otherwise, the metadata server returns information identifying those storage servers hosting the user data (240). The file switch, in response to a subsequent file read/write request from the client, visits (i.e., sends requests to) the identified storage servers to retrieve one or more of the user data stripe fragments (243, 247).
In some embodiments, in response to at least some types of client requests the file switch processes the user data in accordance with the client request (250). In other embodiments, or in response to other types of client requests, the file switch delivers the user data to the requesting client computer through the network, waits for the client computer to apply operations to the user data, and then receives the processed user data from the client computer. The processing of the user data at the client or file switch, or both, may modify, replace or append data to the user data.
Depending on the size of the processed user data, it may or may not be desirable to store it in the metadata server. Therefore, the file switch needs to identify an appropriate location in the aggregated file system to store the processed user data.
In some embodiments, the file switch checks if a predetermined condition is met or not (260). If the user data is retrieved from a metadata server previously and the size of the processed (i.e., new or modified) user data is still below the predefined threshold, the processed user data is then sent back to the same metadata server, which overwrites the old copy therein with the processed user data (265). In other words, a user file that remains small after the process stays in the metadata server to facilitate efficient access.
Otherwise, the processed user data is stored in a storage server (270). Note that this scenario includes three sub-scenarios:

    
    
        the user data is retrieved from a metadata server, and after the user data has been processed (e.g., by the file switch or client), the size of the processed user data is now above the predefined threshold;
        the user data is retrieved from storage servers, and after the user data has been processed, the size of the processed user data is still above the predefined threshold; and
        the user data is retrieved from storage servers, and after the user data has been processed the size of the processed user data is below the predefined threshold.
    
    


System operations in response to the first two sub-scenarios are straightforward. As long as the file size of a user file is above the predetermined threshold, a distributed storage scheme is employed to store the user data and the metadata separately. Note that in the first sub-scenario, the metadata server is responsible for updating the user file metadata with information about its newly designated hosting storage servers (at which the user data is now stored) so that a subsequent file switch operation will be able to determine where to retrieve the updated user data.
In contrast, the last sub-scenario requires special treatment. This sub-scenario occurs when the user data size of a user file that was above the threshold level now drops below that level, e.g., due to operations at a client or requested by a client. In some embodiments, since the user file has demonstrated a capability beyond the predetermined threshold associated with small-size files, the file is not treated as a small-size file despite its current small size, and its user data remains in the storage servers.
In an alternative embodiment, the user data is stored in a metadata server whenever its current size is below the predetermined threshold and is stored in the storage servers otherwise. This scheme may improve the throughput of the file system. However, if the user data size frequently moves above and below the threshold level, the benefit of a higher throughput may be outweighed by the cost of managing the transitions between the two user data storage regimes (i.e., transitions between a metadata server and the storage servers). In some embodiments, a system administrator is given an option of choosing a storage scheme for a user file based on its client access characteristics, e.g., how often a client updates the user data and the typical magnitude of user data update.
In each scenario, the metadata server updates the metadata associated with the user file to reference the user data at its current location (280). Information about the size of the user data may also be updated if the size of the file's user data has changed. Finally, the file switch sends a response to the client computer, notifying it that its requested operation has been completed (285).
In some embodiments, the predetermined threshold is the same for all the user files in the aggregated file system. In some embodiments, the threshold is configurable by a system administrator. In some other embodiments, different types of user files are associated with different thresholds. These thresholds may be determined in accordance with the client access characteristics associated with the different types of user files. For example, a user file (or user files of a particular type) which has a high client access rate (e.g., above a predefined access rate threshold) should be assigned a threshold value higher than that associated with a user file with a lower client access rate. As a result, the user data of a user file having a high client access rate is kept in a metadata server (along with its metadata) unless its size exceeds a second, higher predefined threshold, thereby improving the system's throughput.
After updating the user data of a user file and sending it back to the aggregated file system, a client computer may require a completion response from the system in order to proceed to next operation. In some embodiments, since different user files may have different requirements about data integrity, the file system may choose different moments of a client access transaction to respond in accordance with a predetermined write policy. For example, if the client computer submits a file write request that indicates, or is associated with a high data integrity requirement, a write-through I/O completion response is signaled only after the user data and metadata have been completely stored in the file system. On the other hand, if the client computer submits a file write request that indicates, or is associated with a lower data integrity requirement (which may be designated as the normal or default data integrity requirement in some embodiments), a write-back I/O completion response is signaled when the file switch receives the user data from the client computer. In the context of the process represented by FIG. 2, the latter option requires that the file switch notify the client computer of a completion of processing the user data before storing it in a metadata or storage server. In other words, step 285 of FIG. 2 would occur after step 250 but ahead of step 260.
A risk associated with the write-back I/O completion is that the metadata and/or user data of a user file may be lost when a system failure occurs before the data is completely written into a metadata or storage server, resulting in a corrupted file system. In contrast, the risk associated with the write-through I/O completion is significantly lower because the data has already been completely stored in a server upon the invocation of the option.
System Architecture
In some embodiments, a file switch 160 of the aggregated file system is implemented using a computer system schematically shown in FIG. 3. The file switch 160 includes one or more processing units (CPUs) 300, memory 309, one or more communication interfaces 305 for coupling the file switch to one or more communication networks 350, and one or more system buses 301 that interconnect these components. In one embodiment, the one or more communication interfaces 305 include network interface circuits (NIC) 304 for coupling the file switch to a network switch 303, with each of the network interface circuits 304 coupled to a respective communication network 350.
The file switch 160 may optionally have a user interface 302, although in some embodiments the file switch 160 is managed using a workstation connected to the file switch 160 via communications interface 305. In alternate embodiments, much of the functionality of the file switch may be implemented in one or more application specific integrated circuits (ASICs), thereby either eliminating the need for the CPU, or reducing the role of the CPU in the handling of file access requests initiated by clients 120. The file switch 160 may be interconnected to a plurality of clients 120, storage servers 180, and one or more metadata servers 170, by the one or more communications interfaces 305.
The memory 309 may include high speed random access memory and may also include non volatile memory, such as one or more magnetic disk storage devices. The memory 309 may include mass storage that is remotely located from the CPU(s) 300. The memory 309 stores the following elements, or a subset or superset of such elements:

    
    
        an operating system 310 that includes procedures for handling various basic system services and for performing hardware dependent tasks;
        a network communication module (or set of instructions) 311 that is used for controlling communication between the system and clients 120, storage servers 180 and metadata servers 170 via the network or communication interface circuit 304 and one or more communication networks (represented by network switch 303), such as the Internet, other wide area networks, local area networks, metropolitan area networks, or combinations of two or more of these networks;
        a file switch module (or set of instructions) 312, for implementing many of the main aspects of the aggregated file system, the file switch module 312 including a file read module 313 and a file write module 314;
        file state information 330, including transaction state information 331, open file state information 332 and locking state information 333; and
        cached information 340 for caching metadata information of one or more user files being processed by the file switch.
    
    


The file switch module 312, the state information 330 and the cached information 340 may include executable procedures, sub-modules, tables or other data structures. In other embodiments, additional or different modules and data structures may be used, and some of the modules and/or data structures listed above may not be used. More detailed descriptions of the file read module 313 and the file write module 314 have been provided above in connection with FIG. 2. For example, when handling a small-size user file, the file read module 313 and the file write module 314 need only access a metadata server to retrieve or store both the metadata and user data.
Illustratively, one of the metadata severs 170 includes information about a plurality of user files. In particular, the metadata server 170 includes metadata and user data location information for user file A. To retrieve user file A, the file switch performs two transactions, one with the metadata server in response to a file open request and the other with the one or more storage servers designated by the user data location information in response to a subsequent file read/write request. In contrast, both metadata and user data of user file B are stored in the metadata server 170. A file switch only needs to perform one transaction, with a single metadata server, to retrieve user file B in response to a file open request.
Even though the aforementioned embodiments are discussed in connection with a file switch in an aggregated file system, it will be apparent to one skilled in the art that the present invention is equally applicable to any metadata-based data storage architecture that requires a software implementation.
The foregoing description, for purposes of explanation, has been described with reference to specific embodiments. However, the illustrative discussions above are not intended to be exhaustive or to limit the invention to the precise forms disclosed. Many modifications and variations are possible in view of the above teachings. The embodiments were chosen and described in order to best explain the principles of the invention and its practical applications, to thereby enable others skilled in the art to best utilize the invention and various embodiments with various modifications as are suited to the particular use contemplated.

## Claims

1. A method of processing a user file by a file switch in an aggregated file system having at least one storage sever and at least one metadata server including at least one user file, comprising:
retrieving, by the file switch, metadata and user data associated with the user file from a metadata server;
processing, by the file switch, the user data and the metadata associated with the user file in accordance with a request from a client;
storing, by the file switch, the processed metadata associated with the user file in the metadata server;
storing, by the file switch, the processed user data associated with the user file along with the stored processed metadata at a location within the metadata server designated by a predefined rule when a size of the processed user data is smaller than a predefined threshold;
storing, by the file switch, the processed user data at a location within a storage server separate from the metadata server designated by the predefined rule when the size of the processed user data is greater than or equal to the predefined threshold; and
updating, by the file switch, the metadata in the metadata server to reference the user data at the designated location.

2. The method of claim 1, wherein the retrieving includes retrieving, by the file switch, the metadata and user data in response to a file open request associated with the user file.

3. The method of claim 1, further comprising, prior to said storing and updating, notifying, by the file switch, the client of a completion of processing the user data in response to the client request.

4. The method of claim 1, wherein the metadata includes a size of the user data.

5. The method of claim 4, wherein updating the metadata includes updating, by the file switch, the size of the user data in accordance with the processed user data.

6. The method of claim 1, wherein the predefined threshold associated with the user file is different from a predefined threshold associated with a different user file.

7. The method of claim 1, wherein the user data of the user file remains in the separate storage server irrespective of whether the size of the user data is smaller than the predefined threshold or not.

8. The method of claim 1 further comprising retrieving, by the file switch, the processed user data and the metadata in a single transaction in response to a file open request from the client when the processed user data and the metadata are both stored in the metadata server.

9. A file switch for use in a computer network having one or more metadata servers including at least one user file, one or more storage servers, and one or more client computers, the file switch comprising:
at least one interface for exchanging information with the one or more metadata servers, the one or more storage servers and the one or more client computers;
one or more processors; and
a memory coupled to the one or more processors, the one or more processors configured to execute programmed instructions stored in the memory, the programmed instructions comprising:
retrieving metadata and user data associated with a user file from a metadata server;
processing the user data and the metadata associated with the user file in accordance with a request from a client computer;
storing the processed metadata associated with the user file in the metadata server;
storing the processed user data associated with the user file along with the stored processed metadata at a location within the metadata server designated by a predefined rule when a size of the processed user data is smaller than a predefined threshold;
storing the processed user data at a location within a storage server separate from the metadata server designated by the predefined rule when the size of the processed user data is greater than or equal to the predefined threshold; and
updating the metadata in the metadata server to reference the user data at the designated location.

10. The file switch of claim 9, wherein the retrieving includes retrieving the metadata and user data in response to a file open request associated with the user file.

11. The file switch of claim 9, further comprising, prior to said storing and updating, notifying the client computer of a completion of processing the user file in response to the request.

12. The file switch of claim 9, wherein the metadata includes a size of the user data.

13. The file switch of claim 9, wherein the predefined threshold of the user file is different from a predefined threshold of a different user file.

14. The file switch of claim 9, wherein the user data of the user file remains in the separate storage server irrespective of whether the size of the user data is smaller than the predefined threshold or not.

15. The file switch of claim 9 further comprising retrieving the processed user data and the metadata in a single transaction in response to a file open request from the client computer when the processed user data and the metadata are both stored in the metadata server.

16. A non-transitory computer readable medium having stored thereon instructions for processing a user file by a file switch in an aggregated file system having at least one storage sever and at least one metadata server including at least one user file, comprising machine executable code which when executed by at least one processor, causes the processor to perform steps comprising:
retrieving metadata and user data associated with the user file from a metadata server;
processing the user data and the metadata associated with the user file in accordance with a request from a client;
storing the processed metadata associated with the user file in the metadata server;
storing the processed user data associated with the user file along with the stored processed metadata at a location within the metadata server designated by a predefined rule when a size of the processed user data is smaller than a predefined threshold;
storing the processed user data at a location within a storage server separate from the metadata server designated by the predefined rule when the size of the processed user data is greater than or equal to the predefined threshold; and
updating the metadata in the metadata server to reference the user data at the designated location.

17. The medium as set forth in claim 16 wherein the retrieving includes retrieving, by the file switch, the metadata and user data in response to a file open request associated with the user file.

18. The medium as set forth in claim 16 further comprising, prior to said storing and updating, notifying, by the file switch, the client of a completion of processing the user data in response to the client request.

19. The medium as set forth in claim 16 wherein the metadata includes a size of the user data.

20. The medium as set forth in claim 19 wherein updating the metadata includes updating, by the file switch, the size of the user data in accordance with the processed user data.

21. The medium as set forth in claim 16 wherein the predefined threshold associated with the user file is different from a predefined threshold associated with a different user file.

22. The medium as set forth in claim 16 wherein the user data of the user file remains in the separate storage server irrespective of whether the size of the user data is smaller than the predefined threshold or not.