Scavenging directories for free space
AssigneeEMC IP Holding Company LLC
InventorsJean-Pierre Bono, Michael D. Schouten, Philippe Armangau
Life of this patent
Estimating the term…
Abstract
A technique for managing storage of directories in a file system performs a testing operation on a file-system block of a directory file. The testing operation determines whether the file-system block contains any directory element that identifies a currently-present content object in the directory. In response to the testing operation determining that the file-system block contains no directory element that identifies any currently-present content object, the file system performs a hole-punching operation on the file-system block, removing the block from the directory file and freeing the block for other use.
Claims17
A method of managing storage of directories in a file system, the method comprising:
- implementing a directory as a file in the file system, the file having metadata that stores an ordered list of block pointers, at least some of the block pointers pointing to file-system blocks that store directory elements that identify content objects in the directory, the content objects stored elsewhere in the file system;
- after removing some of the content objects from the directory, performing a testing operation to determine whether a file-system block pointed to by a block pointer of the file contains any directory element that identifies a currently-present content object in the directory;
- and
- in response to the testing operation determining that the pointed-to file-system block does not contain any directory element that identifies a currently-present content object in the directory, performing a hole-punching operation by (i) updating the block pointer so that it no longer points to the file-system block and (ii) freeing the file-system block so that it is no longer used by the file,
- wherein at least some of the directory elements store directory entries, each directory entry providing information about a respective content object in the directory, and wherein the method further comprises:
- receiving a request to remove a content object from the directory;
- and
- in response to receiving the request,
- (i) identifying a directory entry that provides information about the content object to be removed, that directory entry stored in a particular directory element of the directory, the particular directory element stored in a particular file-system block pointed to by the list of block pointers, the particular file-system block including multiple directory elements;
- (ii) deleting or markinq as invalid the directory entry;
- (iii) performing the testing operation on the particular file-system block;
- and
- (iv) in response to the testing operation indicating that the particular file-system block does not contain any directory element that identifies a currently-present content object in the directory, performing the hole-punching operation on the particular file-system block,
- wherein the directory entry for the content object to be removed has a record length, and wherein deleting or marking as invalid the directory entry includes:
- setting an attribute in the directory entry to a value that indicates that the directory entry is invalid;
- and
- updating a record length of another directory entry that precedes the directory entry in the same directory element, such that the record length of the other directory entry is set to a sum of the record lengths of both directory entries.
A data storage system, comprising control circuitry that includes a set of processing units coupled to memory, the control circuitry constructed and arranged to:
- implement a directory as a file in the file system, the file having metadata that stores an ordered list of block pointers, at least some of the block pointers pointing to file-system blocks that store directory elements that identify content objects in the directory;
- after removal of some of the content objects from the directory, perform a testing operation to determine whether a file-system block pointed to by a block pointer of the file contains any directory element that identifies a currently-present content object in the directory;
- and
- in response to the testing operation determining that the pointed-to file-system block does not contain any directory element that identifies a currently-present content object in the directory, perform a hole-punching operation by (i) updating the block pointer so that it no longer points to the file-system block and (ii) freeing the file-system block so that it is no longer used by the file,
- wherein at least some of the directory elements store directory entries, each directory entry providing information about a respective content object in the directory, and wherein the control circuitry is further constructed and arranged to:
- receive a request to remove a content object from the directory;
- and
- in response to receipt of the request,
- (i) identify a directory entry that provides information about the content object to be removed, that directory entry stored in a particular directory element of the directory, the particular directory element stored in a particular file-system block pointed to by the list of block pointers, the particular file-system block including multiple directory elements;
- (ii) delete or mark as invalid the directory entry;
- (iii) perform the testing operation on the particular file-system block;
- and
- (iv) in response to the testing operation indicating that the particular file-system block does not contain any directory element that identifies a currently-present content object in the directory, perform the hole-punching operation on the particular file-system block,
- wherein the directory entry for the content object to be removed has a record length, and wherein the control circuitry constructed and arranged to delete or mark as invalid the directory entry is further constructed and arranged to:
- set an attribute in the directory entry to a value that indicates that the directory entry is invalid;
- and
- update a record length of another directory entry that precedes the directory entry in the same directory element, such that the record length of the other directory entry is set to a sum of the record lengths of both directory entries.
A computer program product including a set of non-transitory, computer-readable media having instructions which, when executed by control circuitry of a data storage system, cause the control circuitry to perform a method for managing storage of directories in a file system, the method comprising:
- implementing a directory as a file in the file system, the file having metadata that stores an ordered list of block pointers, at least some of the block pointers pointing to file-system blocks that store directory elements that identify content objects in the directory;
- after removing some of the content objects from the directory, performing a testing operation to determine whether a file-system block pointed to by a block pointer of the file contains any directory element that identifies a currently-present content object in the directory;
- and
- in response to the testing operation determining that the pointed-to file-system block does not contain any directory element that identifies a currently-present content object in the directory, performing a hole-punching operation by (i) updating the block pointer so that it no longer points to the file-system block and (ii) freeing the file-system block so that it is no longer used by the file,
- wherein at least some of the directory elements store directory entries, each directory entry providing information about a respective content object in the directory, and wherein the method further comprises:
- receiving a request to remove a content object from the directory;
- and
- in response to receiving the request,
- (i) identifying a directory entry that provides information about the content object to be removed, that directory entry stored in a particular directory element of the directory, the particular directory element stored in a particular file-system block pointed to by the list of block pointers, the particular file-system block including multiple directory elements;
- (ii) deleting or marking as invalid the directory entry;
- (iii) performing the testing operation on the particular file-system block;
- and
- (iv) in response to the testing operation indicating that the particular file-system block does not contain any directory element that identifies a currently-present content object in the directory, performing the hole-punching operation on the particular file-system block,
- wherein the directory entry for the content object to be removed has a record length, and wherein deleting or markinq as invalid the directory entry includes:
- setting an attribute in the directory entry to a value that indicates that the directory entry is invalid;
- and
- updating a record length of another directory entry that precedes the directory entry in the same directory element, such that the record length of the other directory entry is set to a sum of the record lengths of both directory entries.
Dependencies are inferred from the claim text.