IP Library › Granted Patent US 10,025,806
Granted Patent B2
US 10,025,806 · App. 14/837,166 · Granted Jul 17, 2018

Fast file clone using copy-on-write B-tree

Inventors: Yunshan Lu (San Jose, CA); Wenguang Wang (Santa Clara, CA)
Assignee: VMware, Inc.
G06F17/30327G06F3/06G06F17/30091
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,025,806
App. No.
14/837,166
Granted
Jul 17, 2018
Kind
B2
Abstract

A file system uses a B-tree data structure to organize file data. The file system may maintain an index node (mode) representing a file and having entries that map to extents of the file. When the file system detects an index node, through updates, has exceeded a threshold number of extents, the file system converts the file to a copy-on-write (COW) B-tree data structure containing the entries representing the extents of the file. To clone the file, the file system uses copies of the index node and the root node of the COW B-tree data structure.

Claims (48)

1. A method, comprising:

updating a first index node representing a file, the first index node comprising a plurality of entries representing extents of the file, wherein each entry of the plurality of entries comprises metadata that at least in part maps at least one logical address to at least one physical address of at least one data block of an extent of the file, wherein updating the first index node comprises at least one of adding, updating, or removing an entry at the first index node;

determining whether a number of the plurality of entries included in the updated first index node exceeds a threshold corresponding to a number of extents; and

responsive to determining that the number of the plurality of entries included in the updated first index node exceeds the threshold:

generating a copy-on-write (COW) B-tree data structure containing the plurality of entries representing the extents of the file; and

modifying the first index node to replace the plurality of entries representing the extents of the file with a new entry that points to the COW B-tree data structure.

2. The method of claim 1 , further comprising:

performing a file clone operation on the file comprising:

generating a copy of a root node of the COW B-tree data structure, the root node and the copy of the root node each comprising the plurality of entries representing extents of the file, wherein the root node and copy of the root node initially both point directly or indirectly to same one or more physical addresses; and

generating a second index node representing a file clone, wherein the second index node points to the copy of the root node.

3. The method of claim 2 , wherein the file clone operation further comprises:

updating reference counts of nodes of the COW B-tree data structure that are pointed to by the copy of the root node, wherein reference counts of child nodes of the nodes of the COW B-tree data structure that are pointed to by the copy of the root node are not updated.

4. The method of claim 1 , further comprising:

responsive to determining that the number of the plurality of entries included in the first index node no longer exceeds the threshold, modifying the first index node to contain the plurality of entries.

5. The method of claim 1 , wherein modifying the first index node to replace the plurality of entries representing the extents of the file with the new entry that points to the COW B-tree data structure further comprises:

inserting a key-value entry into the first index node, wherein a key of the entry comprises a type representing a COW B-tree data structure and a value of the entry comprises an address of the COW B-tree data structure.

6. A non-transitory computer-readable storage medium comprising instructions that, when executed in a computing device, perform the steps of:

updating a first index node representing a file, the first index node comprising a plurality of entries representing extents of the file, wherein each entry of the plurality of entries comprises metadata that at least in part maps at least one logical address to at least one physical address of at least one data block of an extent of the file, wherein updating the first index node comprises at least one of adding, updating, or removing an entry at the first index node;

determining whether a number of the plurality of entries included in the updated first index node exceeds a threshold corresponding to a number of extents; and

responsive to determining that the number of the plurality of entries included in the updated first index node exceeds the threshold:

generating a copy-on-write (COW) B-tree data structure containing the plurality of entries representing the extents of the file; and

modifying the first index node to replace the plurality of entries representing the extents of the file with a new entry that points to the COW B-tree data structure.

7. The non-transitory computer-readable storage medium of claim 6 , wherein the instructions perform a file clone operation on the file comprising:

generating a copy of a root node of the COW B-tree data structure, the root node and the copy of the root node each comprising the plurality of entries representing extents of the file, wherein the root node and copy of the root node initially both point directly or indirectly to same one or more physical addresses; and

generating a second index node representing a file clone, wherein the second index node points to the copy of the root node.

8. The non-transitory computer-readable storage medium of claim 7 , wherein the file clone operation further comprises:

updating reference counts of nodes of the COW B-tree data structure that are pointed to by the copy of the root node, wherein reference counts of child nodes of the nodes of the COW B-tree data structure that are pointed to by the copy of the root node are not updated.

9. The non-transitory computer-readable storage medium of claim 6 , wherein the steps further comprise:

responsive to determining that the number of the plurality of entries included in the first index node no longer exceeds the threshold, modifying the first index node to contain the plurality of entries.

10. The non-transitory computer-readable storage medium of claim 6 , wherein the step of modifying the first index node to replace the plurality of entries representing the extents of the file with the new entry that points to the COW B-tree data structure further comprises:

inserting a key-value entry into the first index node, wherein a key of the entry comprises a type representing a COW B-tree data structure and a value of the entry comprises an address of the COW B-tree data structure.

11. A computer system for allocating storage space, the computer system comprising:

a storage device comprising a file system;

a processor (CPU) configured to perform the steps of:

updating a first index node representing a file, the first index node comprising a plurality of entries representing extents of the file, wherein each entry of the plurality of entries comprises metadata that at least in part maps at least one logical address to at least one physical address of at least one data block of an extent of the file, wherein updating the first index node comprises at least one of adding, updating, or removing an entry at the first index node;

determining whether a number of the plurality of entries included in the updated first index node exceeds a threshold corresponding to a number of extents; and

responsive to determining that the number of the plurality of entries included in the updated first index node exceeds the threshold:

generating a copy-on-write (COW) B-tree data structure containing the plurality of entries representing the extents of the file; and

modifying the first index node to replace the plurality of entries representing the extents of the file with a new entry that points to the COW B-tree data structure.

12. The computer system of claim 11 , wherein the processor is further configured to perform a file clone operation on the file comprising:

generating a copy of a root node of the COW B-tree data structure, the root node and the copy of the root node each comprising the plurality of entries representing extents of the file, wherein the root node and copy of the root node initially both point directly or indirectly to same one or more physical addresses; and

generating a second index node representing a file clone, wherein the second index node points to the copy of the root node.

13. The computer system of claim 12 , wherein the file clone operation further comprises:

updating reference counts of nodes of the COW B-tree data structure that are pointed to by the copy of the root node, wherein reference counts of child nodes of the nodes of the COW B-tree data structure that are pointed to by the copy of the root node are not updated.

14. The computer system of claim 11 , wherein the processor is further configured to perform the steps of:

responsive to determining that the number of the plurality of entries included in the first index node no longer exceeds the threshold, modifying the first index node to contain the plurality of entries.

15. The computer system of claim 11 , wherein modifying the first index node to replace the plurality of entries representing the extents of the file with the new entry that points to the COW B-tree data structure further comprises:

inserting a key-value entry into the first index node, wherein a key of the entry comprises a type representing a COW B-tree data structure and a value of the entry comprises an address of the COW B-tree data structure.

Assignments (2)
CHANGE OF NAME Recorded Apr 15, 2024
From: VMWARE, INC.
To: VMWARE LLC
Reel/Frame 067102/0395 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Aug 27, 2015
From: LU, YUNSHAN; WANG, WENGUANG
To: VMWARE, INC.
Reel/Frame 036439/0157 →
Continuity (1)
Related Publication 20170060898A1 · Mar 2, 2017