File system block reservation manager
First Claim
1. A computerized method of managing a file system for a file server, comprising:
- receiving a file operation that signals a reservation operation for reserving an additional number of blocks for storing a file of the file system, the file having a file size;
computing a first number of blocks needed to accommodate the file size;
subtracting from the first number of blocks a second number of blocks already allocated for the file and a third number of delayed allocated blocks for the file to obtain a fourth number of unallocated blocks needed to accommodate the file size; and
using the fourth number of blocks to perform a reservation of unallocated blocks for the file for later allocation, wherein said using the fourth number of blocks to perform a reservation of unallocated blocks for the file for later allocation comprises;
checking that a number of available blocks in the file system is greater than the fourth number of blocks, wherein an error is returned in a case that the number of available blocks is less than the fourth number of blocks,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;
wherein the file system uses a write anywhere file system layout characterized in that data to be written are written to new blocks instead of being written to blocks previously allocated for said data.
0 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.
-
Citations
34 Claims
-
1. A computerized method of managing a file system for a file server, comprising:
-
receiving a file operation that signals a reservation operation for reserving an additional number of blocks for storing a file of the file system, the file having a file size; computing a first number of blocks needed to accommodate the file size; subtracting from the first number of blocks a second number of blocks already allocated for the file and a third number of delayed allocated blocks for the file to obtain a fourth number of unallocated blocks needed to accommodate the file size; and using the fourth number of blocks to perform a reservation of unallocated blocks for the file for later allocation, wherein said using the fourth number of blocks to perform a reservation of unallocated blocks for the file for later allocation comprises; checking that a number of available blocks in the file system is greater than the fourth number of blocks, wherein an error is returned in a case that the number of available blocks is less than the fourth number of blocks, 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; wherein the file system uses a write anywhere file system layout characterized in that data to be written are written to new blocks instead of being written to blocks previously allocated for said data. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
-
-
11. A file server comprising:
-
a memory storing a computer program, a processor capable of executing the program, and a storage device capable of storing files of a file system under control of the processor, wherein the computer program comprises; instructions to cause the processor to receive a file operation that signals a reservation operation for a file of the file system, the file having a file size; instructions to cause the processor to compute a first number of blocks needed to accommodate the file size; instructions to cause the processor to subtract from the first number of blocks a second number of blocks already allocated for the file and a third number of delayed allocated blocks for the file to obtain a fourth number of unallocated blocks to be reserved to accommodate the file size; and instructions to cause the processor to use the fourth number of blocks to perform a reservation of unallocated blocks for the file for later allocation, wherein the instructions to cause the processor to use the fourth number of blocks to perform a reservation of unallocated blocks for the file for later allocation program comprise instructions to cause the processor to check whether a number of available blocks in the file system is greater than the fourth number of blocks, and return an error in a case that the number of available blocks is less than the fourth number of blocks wherein the processor determines the number of available blocks in the file system 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; wherein the file system uses a write anywhere file system layout characterized in that data to be written are written to new blocks instead of being written to blocks previously allocated for said data. - View Dependent Claims (12, 13, 14, 15, 16, 17, 18)
-
-
19. A method comprising:
-
receiving at a storage server a request for a space reservation for a data set managed by the storage server; and in response to the request, computing a number of blocks needed to be reserved for the data set, reserving for later allocation a number of unallocated blocks equal to the computed number of blocks, such that a subsequent write operation associated with the reservation can complete the write request without prevention of completion of the write operation due to insufficient memory; and performing a write operation to write data to the data set by determining whether a space reservation has been performed for the data set, and in response to determining that a space reservation has been performed for the data set, allocating one or more blocks for said data without determining whether enough blocks are available for completing the write operation, and in response to determining that a space reservation has not been performed for the data set, determining whether enough blocks are available for completing the write operation prior to allocating any blocks for said data; wherein the storage server employs a methodology in which data to be written are written to new blocks instead of being written to blocks previously allocated for said data. - View Dependent Claims (20, 21, 22, 23, 24)
-
-
25. A storage server comprising:
-
a processor; a network interface through which to communicate with a remote client; a file system; and a storage device storing code which, when executed by the processor, causes the storage server to execute a process that includes receiving a signal corresponding to a request for a space reservation operation for a file in the file system; computing a first number of blocks needed to be reserved to accommodate the file; reserving for later allocation a fourth number of unallocated blocks in the file system such that the fourth number is calculated by subtracting from the first number of blocks a second number of blocks already allocated for the file and a third number of delayed allocated blocks for the file; and performing a write operation to write data to the file by determining whether a block reservation has been performed for the file, in response to determining that a block reservation has been performed for the file, allocating one or more blocks for said data in the file system without determining whether enough blocks are available in the file system for completing the write operation; and in response to determining that a block reservation has not been performed for the file, determining whether enough blocks are available in the file system for completing the write operation prior to allocating any blocks for said data in the file system; wherein the file system employs a methodology in which data to be written are written to new blocks instead of being written to blocks previously allocated for said data. - View Dependent Claims (26, 27, 28, 29, 30)
-
-
31. A computerized method of managing a file, comprising:
-
receiving a write request for a file; determining a desired number of blocks in which to store the file; determining a number of previously reserved blocks by adding allocated and nonallocated blocks previously associated with the file; determining an additional number of blocks by subtracting the number of previously reserved blocks from the desired number of blocks in which to store the file; reserving the additional number of blocks; and writing the file after successfully reserving the additional number of blocks by determining whether a space reservation has been performed for the data set, and in response to determining that a space reservation has been performed for the data set, allocating one or more blocks for said data without determining whether enough blocks are available for completing the write operation; in response to determining that a block reservation has not been performed for the file, determining whether enough blocks are available in the file system for completing the write operation prior to allocating any blocks for said data in the file system; wherein the file system employs a methodology in which data to be written are written to new blocks instead of being written to blocks previously allocated for said data. - View Dependent Claims (32, 33, 34)
-
Specification