Reserving file system blocks

Data processing: database and file management or data structures – Database design – Data structure types

Reexamination Certificate

Rate now

  [ 0.00 ] – not rated yet Voters 0   Comments 0

Details

C707S793000, C707S793000, C711S100000

Reexamination Certificate

active

06640233

ABSTRACT:

BACKGROUND OF THE INVENTION
1. Field of the Invention
This invention relates to management of a file system for a file server. In particular, the invention concerns reserving unallocated blocks of the file system based upon a file size for a file.
2. Description of the Related Art
Some conventional file servers (also called “filers”) manage space in a file system by allocating blocks to a file as data for that file is written to the file system. Thus, if the file system runs out of space, a file could end up partially written.
Other conventional file servers, in particular those running CIFS, can allocate blocks for an entire file upon creation of the file. These file servers write zero data to the file system for these blocks. However, this approach is expensive in terms of time required to write the zero data. Furthermore, this approach is actually counterproductive for file servers that use a write anywhere file system layout, also known as WAFL file servers.
In WAFL file servers, when a file is overwritten, new data is written to new blocks, and then the previously allocated blocks are released. Thus, new data is written to different blocks than the previously allocated blocks, resulting in use of extra space for the new blocks until the previously allocated blocks are released. If the file server is close to full, this duplication of blocks could use up the remaining blocks, preventing complete writing of the data.
SUMMARY OF THE INVENTION
Accordingly, what is needed is a way to ensure that enough blocks are reserved for a file so as to ensure that the entire file can be written to a file system, without actually allocating disk blocks to the file.
In one aspect, the invention addresses the foregoing need through a method of managing a file system for a file server. According to the method, a file operation is received that signals a reservation operation for a file having a file size. Preferably, the file system uses a write anywhere file system layout, the file operation that signals the reservation operation is a zero length write request, and the file operation that signals the reservation operation includes a parameter that specifies the file size. A number of blocks needed to be reserved to accommodate the file is computed. Preferably, computing the number of blocks needed to be reserved to accommodate the file includes determining a total number of direct and indirect blocks needed to accommodate the file size, and subtracting a total number of blocks already allocated for the file and a total number of cached unallocated blocks for the file from the total number of direct and indirect blocks needed to accommodate the file size. Unallocated blocks are reserved in the file system, with the number of reserved blocks equal to the number of blocks needed to be reserved to accommodate the file. Reserving the number of blocks preferably includes setting a flag in an inode for the file that indicates blocks have been reserved for the file, and incrementing a reserved block count in a file system information block by the number of blocks needed. The reserved block count indicates how many unallocated blocks have been reserved for files in the file system.
In a preferred embodiment, the method also includes the step of checking that a number of available blocks in the file system is greater than the number of blocks needed to be reserved to accommodate the file. An error is returned in a case that the number of available blocks is less than the number of blocks needed. The number of available blocks in the file system preferably is determined by subtracting a number of allocated blocks, a number of cached unallocated blocks (i.e., delayed allocated blocks), and a number of reserved blocks from a total number of blocks in the file system, and adding to this a number of reserved cached unallocated blocks.
Also in the preferred embodiment, the file server checks that the number of blocks needed to be reserved to accommodate the file does not exceed a remainder of a quota for an owner of the file. An error is returned in a case that the number of blocks needed exceeds the remainder of the quota.
When data is written to the file system, blocks are cached in a buffer cache. At a later point in time, the blocks are stored to storage for the file system. Prior to writing the blocks to disk, the blocks are actually allocated to the files. Reservation of those blocks is released as the blocks are written to storage. Releasing reservation of blocks is accomplished by decrementing the reserved block count in the file system information block by a number of released blocks.
By virtue of the foregoing operations, a file server reserves unallocated blocks for a file for which file reservation semantics are activated. These reserved blocks are not actually allocated by the reservation process. Rather, a count is maintained of how many blocks need to be kept available for the file system. This count is utilized when space availability for the file system is checked, thereby helping to ensure that enough blocks are available for files that have reserved file space.
In another aspect, the foregoing method handles receipt of a file operation that signals a reservation operation for a file for which reservation has already been performed, in which the reservation operation specifies a new file size different from a current file size for the file. When such a file operation is received, additional blocks may need to be reserved to accommodate the new file. According to the method, a current file size for the file and the new file size are compared. In a case that the current file size exceeds the new file size, remaining block reservations for the file are released. In a case that the new file size exceeds the current file size, an additional number of unallocated blocks are reserved in the file system. According to this embodiment of the invention, the additional number of unallocated blocks to be reserved equals a difference between a total number of direct and indirect blocks required by the new file size and a total number of direct and indirect blocks required by the current file size.
By virtue of the foregoing operation, changes in file size for a file can be appropriately reflected in the block reservations.
Each of the foregoing methods can be used in conjunction with the others in various combinations to perform reservation operations. The invention also can be embodied in apparatuses such as file servers and/or other hardware configured to perform the foregoing methods, computer readable code by itself or embodied in a computer program product to cause a computer to perform the foregoing methods, and a memory storing information including instructions executable by a processor to perform the foregoing methods.
This brief summary has been provided so that the nature of the invention may be understood quickly. A more complete understanding of the invention may be obtained by reference to the following description of the preferred embodiments thereof in connection with the attached drawings.


REFERENCES:
patent: 4593354 (1986-06-01), Ushiro
patent: 4937763 (1990-06-01), Mott
patent: 5067099 (1991-11-01), McCown et al.
patent: 5237682 (1993-08-01), Bendert et al.
patent: 5566331 (1996-10-01), Irwin et al.
patent: 5649152 (1997-07-01), Ohran et al.
patent: 5819292 (1998-10-01), Hitz et al.
patent: 5828876 (1998-10-01), Fish et al.
patent: 5907672 (1999-05-01), Matze et al.
patent: 5956745 (1999-09-01), Bradford et al.
patent: 5963962 (1999-10-01), Hitz et al.
patent: 6101585 (2000-08-01), Brown et al.
patent: 6138126 (2000-10-01), Hitz et al.
patent: 6311193 (2001-10-01), Sekido
patent: 6366988 (2002-04-01), Skiba et al.
patent: 6374268 (2002-04-01), Testardi
patent: 6418449 (2002-07-01), Chen et al.
patent: 6434681 (2002-08-01), Armangau
patent: 6473775 (2002-10-01), Kusters et al.
patent: 6480969 (2002-11-01), Hitz et al.
patent: 6484186 (2002-11-01), Rungta
patent: 0537098 (1993-04-01), None
David Hitz, “File System Design for an NFS File Server Applicance”, Technical Report 3002, Pre

LandOfFree

Say what you really think

Search LandOfFree.com for the USA inventors and patents. Rate them and share your experience with other people.

Rating

Reserving file system blocks does not yet have a rating. At this time, there are no reviews or comments for this patent.

If you have personal experience with Reserving file system blocks, we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Reserving file system blocks will most certainly appreciate the feedback.

Rate now

     

Profile ID: LFUS-PAI-O-3159653

  Search
All data on this website is collected from public sources. Our data reflects the most accurate information available at the time of publication.