Reserving file system blocks
First Claim
1. A method of managing a file system for a file server, comprising the steps of:
- receiving a file operation that signals a reservation operation for a file for which reservation has already been performed, said reservation operation specifying a new file size different from a current file size for the file;
comparing the current file size with the new file size;
in the case that the current file size exceeds the new file size, releasing any remaining block reservations for the file; and
in the case that the new file size exceeds the current file size, reserving for later allocation in the file system an additional number of unallocated blocks equal to 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.
2 Assignments
0 Petitions
Accused Products
Abstract
A system that manages a file system for a file server. 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. A number of unallocated blocks is 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.
69 Citations
30 Claims
-
1. A method of managing a file system for a file server, comprising the steps of:
-
receiving a file operation that signals a reservation operation for a file for which reservation has already been performed, said reservation operation specifying a new file size different from a current file size for the file;
comparing the current file size with the new file size;
in the case that the current file size exceeds the new file size, releasing any remaining block reservations for the file; and
in the case that the new file size exceeds the current file size, reserving for later allocation in the file system an additional number of unallocated blocks equal to 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. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
resetting a flag in an inode for the file that indicates blocks have been reserved for the file; and
decrementing a reserved block count in a file system information block by a number of blocks still reserved for the file, the reserved block count indicating how many unallocated blocks have been reserved for files in the file system.
-
-
6. A method as in claim 1, further comprising the step of checking that a number of available blocks in the file system is greater than the additional number of unallocated blocks, wherein an error is returned in a case that the number of available blocks is less than the additional number of blocks.
-
7. A method as in claim 6, wherein the number of available blocks in the file system is determined by subtracting a number of allocated blocks, a number of cached unallocated blocks, and a number of reserved blocks from a total number of blocks in the file system, and adding a number of reserved cached unallocated blocks.
-
8. A method as in claim 1, further comprising the step of checking that the additional number of blocks does not exceed a remainder of a quota for an owner of the file, wherein an error is returned in a case that the additional number of blocks exceeds the remainder of the quota.
-
9. A method as in claim 1, further comprising the step of releasing reservation of blocks as those blocks are written to storage.
-
10. A method as in claim 9, wherein the step of releasing reservation of blocks further comprises the step of decrementing a reserved block count in a file system information block by a number of released blocks, the reserved block count indicating how many blocks total have been reserved for files in the file server.
-
11. A file server that manages a file system, comprising:
-
mass storage that stores files for the file system;
a processor that executes instructions to manage the file system; and
a memory storing information including instructions, the instructions executable by the processor to manage the file system, the instructions comprising;
(a) receiving a file operation that signals a reservation operation for a file for which reservation has already been performed, said reservation operation specifying a new file size different from a current file size for the file;
(b) comparing the current file size with the new file size;
(c) in the case that the current file size exceeds the new file size, releasing any remaining block reservations for the file; and
(d) in the case that the new file size exceeds the current file size, reserving for later allocation in the file system an additional number of unallocated blocks equal to 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.- View Dependent Claims (12, 13, 14, 15, 16, 17, 18, 19, 20)
resetting a flag in an inode for the file that indicates blocks have been reserved for the file; and
decrementing a reserved block count in a file system information block by a number of blocks still reserved for the file, the reserved block count indicating how many unallocated blocks have been reserved for files in the file system.
-
-
16. A file server as in claim 11, wherein the instructions further comprise the step of checking that a number of available blocks in the file system is greater than the additional number of unallocated blocks, and wherein an error is returned in a case that the number of available blocks is less than the additional number of blocks.
-
17. A file server as in claim 16, wherein the number of available blocks in the file system is determined by subtracting a number of allocated blocks, a number of cached unallocated blocks, and a number of reserved blocks from a total number of blocks in the file system, and adding a number of reserved cached unallocated blocks.
-
18. A file server as in claim 11, wherein the instructions further comprise the step of checking that the additional number of blocks does not exceed a remainder of a quota for an owner of the file, and wherein an error is returned in a case that the additional number of blocks exceeds the remainder of the quota.
-
19. A file server as in claim 11, wherein the instructions further comprise the step of releasing reservation of blocks as those blocks are written to storage.
-
20. A file server as in claim 19, wherein the step of releasing reservation of blocks further comprises the step of decrementing a reserved block count in a file system information block by a number of released blocks, the reserved block count indicating how many blocks total have been reserved for files in the file server.
-
21. A memory storing information including instructions, the instructions executable by a processor to manage a file system, the instructions comprising the steps of:
-
receiving a file operation that signals a reservation operation for a file for which reservation has already been performed, said reservation operation specifying a new file size different from a current file size for the file;
comparing the current file size with the new file size;
in the case that the current file size exceeds the new file size, releasing any remaining block reservations for the file; and
in the case that the new file size exceeds the current file size, reserving for later allocation in the file system an additional number of unallocated blocks equal to 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. - View Dependent Claims (22, 23, 24, 25, 26, 27, 28, 29, 30)
resetting a flag in an inode for the file that indicates blocks have been reserved for the file; and
decrementing a reserved block count in a file system information block by a number of blocks still reserved for the file, the reserved block count indicating how many unallocated blocks have been reserved for files in the file system.
-
-
26. A memory as in claim 21, wherein the instructions farther comprise the step of checking that a number of available blocks in the file system is greater than the additional number of unallocated blocks, and wherein an error is returned in a case that the number of available blocks is less than the additional number of blocks.
-
27. A memory as in claim 26, wherein the number of available blocks in the file system is determined by subtracting a number of allocated blocks, a number of cached unallocated blocks, and a number of reserved blocks from a total number of blocks in the file system, and adding a number of reserved cached unallocated blocks.
-
28. A memory as in claim 21, wherein the instructions further comprise the step of checking that the additional number of blocks does not exceed a remainder of a quota for an owner of the file, and wherein an error is returned in a case that the additional number of blocks exceeds the remainder of the quota.
-
29. A memory as in claim 21, wherein the instructions further comprise the step of releasing reservation of blocks as those blocks are written to storage.
-
30. A memory as in claim 29, wherein the step of releasing reservation of blocks further comprises the step of decrementing a reserved block count in a file system information block by a number of released blocks, the reserved block count indicating how many blocks total have been reserved for files in the file server.
Specification