File clone creation for multipart files
Techniques are provided for creating file clones of multipart files. Creating clones of files is an integral part of providing backup, restore, and other storage services. However, conventional file cloning techniques are unable to create clones of multipart files that are composed of multiple parts stored across different volumes and/or nodes in a constant time. The disclosed techniques are capable of cloning multipart files by creating a clone parent file into which catalog entries from a source multiple file are moved. A destination multipart file is initially created as an empty clone of the source multipart file. Block sharing of the catalog entries from the clone parent file to the source and destination multipart files is performed, and cloning of the source multipart file is declared complete in a constant time such as within a few seconds or less.
1 . A method executed by a file clone module implemented by a computer, the method comprising:
receiving a file clone command to create a file clone of a source multipart file that includes a plurality of parts distributed across volumes hosted by different nodes of a cluster;
creating a clone parent file;
moving catalog entries of the source multipart file to the clone parent file, wherein the catalog entries point to the plurality of parts of the source multipart file, and wherein the catalog entries are removed from the source multipart file;
creating a destination multipart file as the file clone for the source multipart file;
performing block sharing of the catalog entries of the clone parent file back to the source multipart file and the catalog entries of the clone parent file to the destination multipart file;
recording, within a clone metafile, a first multipart file clone relationship of the source multipart file to the clone parent file and a second multipart file clone relationship of the destination multipart file to the clone parent file to indicate that clone operations are pending to clone the plurality of parts from the source multipart file to the destination multipart file; and
acknowledging the file clone command as complete.
2 . The method of claim 1 , comprising:
maintaining an indicator within a user header of the source multipart file as a clone generation value set to indicate whether a child inode of a part of the plurality of parts has been cloned or is pending to be cloned.
3 . The method of claim 1 , comprising:
maintaining an indicator within a user header of the destination multipart file as a clone generation value set to indicate whether a child inode of a part of the plurality of parts has been cloned or is pending to be cloned.
4 . The method of claim 1 , comprising:
assigning a clone generation value to a child inode of a part of the plurality of parts of the source multipart file; and
in response to allocating a new child inode as a clone of the child inode of the part for the destination multipart file, assigning the clone generation value to the new child inode to indicate that the part has been cloned.
5 . The method of claim 4 , comprising:
in response to detecting a clone generation value mismatch between the child inode and the new child inode, determining that the part has not yet been cloned.
6 . The method of claim 1 , wherein the creating the clone parent file comprises:
creating the clone parent file within a private inode space separate from a public inode space within which child inodes of the source multipart file and the destination multipart file are stored.
7 . The method of claim 1 , comprising:
executing a clone split operation on the destination multipart file to create child inode clones from the clone parent file;
traversing the catalog entries of the clone parent file to issue child inode clone create requests for child inodes that do not have a corresponding child inode clone; and
updating the catalog entries with child inode clones created based upon the clone create requests.
8 . The method of claim 7 , comprising:
executing a split operation upon the child inode clones; and
performing a block sharing operation for the child inode clones.
9 . A computing device, comprising:
a memory comprising machine executable code; and
a processor coupled to the memory, the processor configured to execute the machine executable code to cause the machine to:
receive a file clone command to create a file clone of a source multipart file that includes a plurality of parts distributed across volumes hosted by different nodes of a cluster;
create a clone parent file;
move catalog entries of the source multipart file to the clone parent file, wherein the catalog entries point to the plurality of parts of the source multipart file, and wherein the catalog entries are removed from the source multipart file;
create a destination multipart file as the file clone for the source multipart file;
perform block sharing of the catalog entries of the clone parent file back to the source multipart file and the catalog entries of the clone parent file to the destination multipart file;
record, within a clone metafile, a first multipart file clone relationship of the source multipart file to the clone parent file and a second multipart file clone relationship of the destination multipart file to the clone parent file to indicate that clone operations are pending to clone the plurality of parts from the source multipart file to the destination multipart file; and
acknowledge the file clone command as complete.
10 . The computing device of claim 9 , wherein the machine executable code causes the machine to:
receive an operation targeting the destination multipart file;
create a child clone inode on-demand in response to receiving the operation; and
execute the operation upon the child clone inode.
11 . The computing device of claim 9 , wherein the machine executable code causes the machine to:
receive an operation targeting the destination multipart file;
evaluate a header of the destination multipart file to identify a stored clone generation value for a given file block number range targeted by the operation;
determine whether the stored clone generation value and a clone generation value of a child inode match;
in response to identifying a match, determining that the child inode has been cloned as a child inode clone that is locally available for access by the operation; and
in response to the child inode being cloned as the child inode clone, execute the operation upon the child inode clone.
12 . The computing device of claim 11 , wherein the machine executable code causes the machine to:
in response to the child inode not being cloned, pause the operation and on-demand issue a child cloning request to clone the child inode as the child inode clone; and
restart the operation to target the child inode clone.
13 . The computing device of claim 12 , wherein the machine executable code causes the machine to:
execute the child cloning request to retrieve a child clone file handle;
stitch the child clone file handle into the destination multipart file; and
restart the operation to target the child inode clone.
14 . The computing device of claim 9 , wherein the machine executable code causes the machine to:
receive an operation targeting the source multipart file;
create a child clone inode on-demand in response to receiving the operation, wherein a child clone file handle is stitched into the destination multipart file; and
execute the operation upon the child clone inode.
15 . The computing device of claim 9 , wherein the machine executable code causes the machine to:
create remaining child inode clones as a background process by traversing through child inodes of the clone parent file.
16 . A non-transitory machine readable medium comprising instructions for performing a method, which when executed by a machine, causes the machine to:
receive a file clone command to create a file clone of a source multipart file that includes a plurality of parts distributed across volumes hosted by different nodes of a cluster;
create a clone parent file;
move catalog entries of the source multipart file to the clone parent file, wherein the catalog entries point to the plurality of parts of the source multipart file, and wherein the catalog entries are removed from the source multipart file;
create a destination multipart file as the file clone for the source multipart file;
perform block sharing of the catalog entries of the clone parent file back to the source multipart file and the catalog entries of the clone parent file to the destination multipart file;
record, within a clone metafile, a first multipart file clone relationship of the source multipart file to the clone parent file and a second multipart file clone relationship of the destination multipart file to the clone parent file to indicate that clone operations are pending to clone the plurality of parts from the source multipart file to the destination multipart file; and
acknowledge the file clone command as complete.
17 . The non-transitory machine readable medium of claim 16 , wherein the instructions cause the machine to:
receive an operation targeting the destination multipart file during operation of the file clone command;
evaluate a header of the destination multipart file to identify a stored clone generation value for a given file block number range targeted by the operation;
determine whether the stored clone generation value and a clone generation value of a child inode match;
in response to identifying a match, determining that the child inode has been cloned as a child inode clone that is locally available for access by the operation; and
in response to the child inode being cloned as the child inode clone, execute the operation upon the child inode clone.
18 . The non-transitory machine readable medium of claim 16 , wherein the instructions cause the machine to:
receive an operation targeting the destination multipart file during operation of the file clone command;
in response to determine that a child inode has not been cloned, pause the operation and on-demand issue a child cloning request to clone the child inode as the child inode clone; and
restart the operation to target the child inode clone.
19 . The non-transitory machine readable medium of claim 16 , wherein the instructions cause the machine to:
maintain an indicator within a user header of the source multipart file as a clone generation value set to indicate whether a child inode of a part of the plurality of parts has been cloned or is pending to be cloned.
20 . The non-transitory machine readable medium of claim 16 , wherein the instructions cause the machine to:
receive an operation targeting the destination multipart file;
create a child clone inode on-demand in response to receiving the operation; and
execute the operation upon the child clone inode.