METHOD AND APPARATUS TO PERFORM INCREMENTAL TRUNCATES IN A FILE SYSTEM
First Claim
1. A computer implemented method for truncating a file in a file system, the method comprising:
- receiving a request to truncate the file to a target size, the file having a primary inode;
creating a transient directory inode, wherein the transient directory inode holds a plurality of in-progress entries;
setting a target size in the primary inode;
writing a truncate entry to a journal, the truncate entry comprising a predetermined size;
truncating the file by up to the predetermined size;
determining that the file is above the target size;
responsive to a determination that the file is above the target size, repeating the truncating step and the determining step; and
responsive to a determination that the file is not above the target size, apply the in-progress entries from the transient directory inode.
2 Assignments
0 Petitions
Accused Products
Abstract
The present invention provides a computer implemented method for truncating a file in a file system. The file system receives a request to truncate a file to a target size, the file having a first inode. The file system creates a second inode to a transient directory, wherein the second inode holds a plurality of in-progress entries. The file system sets a target size in the first inode. The file system writes a truncate entry to a journal, the truncate entry comprising a predetermined size. The file system truncates the file by up to the predetermined size. The file system determines that the file is above the target size. Responsive to a determination that the file is above the target size, the file system repeats the truncating step and the determining step. Responsive to a determination that the file is not above the target size, the file system applies the in-progress entries from the transient directory.
27 Citations
20 Claims
-
1. A computer implemented method for truncating a file in a file system, the method comprising:
-
receiving a request to truncate the file to a target size, the file having a primary inode; creating a transient directory inode, wherein the transient directory inode holds a plurality of in-progress entries; setting a target size in the primary inode; writing a truncate entry to a journal, the truncate entry comprising a predetermined size; truncating the file by up to the predetermined size; determining that the file is above the target size; responsive to a determination that the file is above the target size, repeating the truncating step and the determining step; and responsive to a determination that the file is not above the target size, apply the in-progress entries from the transient directory inode. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
-
-
12. A computer implemented method for removing a file in a file system, the method comprising:
-
receiving a request to remove the file; creating an in-progress entry in the transient directory inode, the in-progress entry having a reference to a primary inode of the file; setting an operation flag to indicate file removal; writing a truncate entry to a journal, the truncate entry comprising an indication to truncate by a predetermined size; truncating the file by up to the predetermined size; determining that the file is above a target size; responsive to a determination that the file is above the target size, repeating the steps of writing, truncating and determining; and responsive to a determination that the file is not above the target size, removing the in-progress entry from the transient directory inode. - View Dependent Claims (13, 14, 15, 16)
-
-
17. A computer implemented method for bringing a file system to a consistent state, the method comprising:
-
determining that a transient directory inode exists in a block device, wherein the block device stores a plurality of files of the file system; responsive to a determination that the transient directory inode exists, reviewing at least one inode, wherein the at least one inode is referenced by an in-progress entry in the transient directory inode; determining that the at least one inode is valid; and resuming a pending file operation referenced by the at least one inode. - View Dependent Claims (18, 19, 20)
-
Specification