Low-overhead atomic writes for persistent memory
Techniques are provided for atomic writes for persistent memory. In response to receiving a write operation, a new per-page structure with a new page block number is allocated. New data of the write operation is persisted to a new page of the persistent memory having the new page block number, and the new per-page structure is persisted to the persistent memory. If the write operation targets a hole after the new data and the new per-page structure have been persisted, then a new per-page structure identifier of the new per-page structure is inserted into a parent indirect page of a page comprising the new data. If the write operation targets old data after the new data and the new per-page structure have been persisted, then an old per-page structure of the old data is updated with the new page block number.
1 . A method comprising:
hosting an indirection layer between references to pages within persistent memory and page block numbers of physical page locations storing data of the pages;
populating the indirection layer with per-page structures storing the page block numbers;
associating a per-page structure of the per-page structures with a per-page structure identifier stored within a parent indirect page of a file tree of a file for accessing the per-page structure;
in response to receiving a write operation directed to the file, using the per-page structure identifier within the file tree to access the per-page structure for directing the write operation to a plurality of pages within the persistent memory referenced by a plurality of page block numbers of the per-page structure; and
for each page of the plurality of pages, creating an entry within a log to track a volume storing the file targeted by the write operation, the file, and a file block number of the page of the plurality of pages.
2 . The method of claim 1 , comprising:
performing an atomic operation to store a new per-page structure identifier and a new generation count into the parent indirect page that is a parent of a new page corresponding to new data written to a new page block number.
3 . The method of claim 1 , comprising:
performing an atomic operation to store a new checksum of new data and a new page block number into at least one of a new per-page structure allocated to process the write operation or an old per-page structure of old data being replaced by the new data.
4 . The method of claim 1 , comprising:
receiving an operation to access first data tracked by a first per-page structure; and
traversing the file tree to a first parent indirect page to identify a first per-page structure identifier of the first per-page structure comprising a first page block number of the first data.
5 . The method of claim 1 , comprising:
receiving an operation to access new data tracked by a first per-page structure; and
traversing the file tree to a first parent indirect page to identify an old per-page structure identifier of an old per-page structure comprising a new page block number of the new data.
6 . The method of claim 1 , comprising:
managing a file system of the persistent memory using a persistent memory storage tier at a higher level within a storage operating system storage stack than a level of a storage file system tier that manages a storage file system of storage.
7 . The method of claim 6 , comprising:
providing per-page structure identifiers, of the per-page structures maintained for the page block numbers of the pages within which data is stored within the persistent memory, to the storage file system tier for accessing the per-page structures to identify the page block numbers.
8 . The method of claim 1 , comprising:
determining that a protocol supports a size greater than a page size of pages within the persistent memory;
identifying a number of pages within the persistent memory to use to accommodate the size; and
for each page of the number of pages, allocating a new per-page structure and a new page block number for the page.
9 . The method of claim 1 , comprising:
in response to determining that a protocol supports a size greater than a page size of pages within the persistent memory, logging the entry into the log.
10 . The method of claim 1 , comprising:
logging a plurality of entries within the log to track a set of pages within the persistent memory being modified by the write operation, wherein the set of pages is based upon a size supported by a protocol associated with the write operation.
11 . A non-transitory machine readable medium comprising instructions for performing a method, which when executed by a machine, causes the machine to:
host an indirection layer between references to pages within persistent memory and page block numbers of physical page locations storing data of the pages;
populate the indirection layer with per-page structures storing the page block numbers;
associate the per-page structures with per-page structure identifiers used by parent indirect pages of a file tree of a file to access the per-page structures; and
utilize the per-page structures of the indirection layer to identify the page block numbers for accessing the data of the pages;
determining that a protocol supports a size greater than a page size of pages within the persistent memory;
identifying a number of pages within the persistent memory to use to accommodate the size; and
for each page of the number of pages, allocating a per-page structure and a page block number for the page.
12 . The non-transitory machine readable medium of claim 11 , wherein the instructions cause the machine to:
perform an atomic operation to store a new per-page structure identifier and a new generation count into a parent indirect page that is a parent of a page corresponding to new data written to a new page block number.
13 . The non-transitory machine readable medium of claim 11 , wherein the instructions cause the machine to:
perform an atomic operation to store a new checksum of new data and a new page block number into at least one of a new per-page structure allocated to process a write operation or an old per-page structure of old data being replaced by the new data.
14 . The non-transitory machine readable medium of claim 11 , wherein the instructions cause the machine to:
receive an operation to access first data tracked by a first per-page structure; and
traverse the file tree to a parent indirect page to identify a first per-page structure identifier of the first per-page structure comprising a first page block number of the first data.
15 . The non-transitory machine readable medium of claim 11 , wherein the instructions cause the machine to:
receive an operation to access new data tracked by a first per-page structure; and
traverse the file tree to a parent indirect page to identify an old per-page structure identifier of an old per-page structure comprising a new page block number of the new data.
16 . A computing device comprising:
a memory comprising machine executable code for performing a method; and
a processor coupled to the memory, the processor configured to execute the machine executable code to cause the processor to:
host an indirection layer between references to pages within persistent memory and page block numbers of physical page locations storing data of the pages;
populate the indirection layer with per-page structures storing the page block numbers;
associate the per-page structures with per-page structure identifiers used by parent indirect pages of a file tree of a file to access the per-page structures; and
utilize the per-page structures of the indirection layer to identify the page block numbers for accessing the data of the pages;
determine that a protocol supports a size greater than a page size of pages within the persistent memory; and
for each page, log an entry within a log to track a volume targeted by a write operation, a first file targeted by the write operation, and a file block number of the page within the persistent memory.
17 . The computing device of claim 16 , wherein the machine executable code causes the processor to:
manage a file system of the persistent memory using a persistent memory storage tier at a higher level within a storage operating system storage stack than a level of a storage file system tier that manages a storage file system of storage.
18 . The computing device of claim 16 , wherein the machine executable code causes the processor to:
identify a number of pages within the persistent memory to use to accommodate the size; and
for each page of the number of pages, allocate a new per-page structure and a new page block number for the page.
19 . The computing device of claim 16 , wherein the machine executable code causes the processor to:
perform an operation to store a new per-page structure identifier and a new generation count into a parent indirect page that is a parent of a page corresponding to new data written to a new page block number.
20 . The computing device of claim 16 , wherein the machine executable code causes the processor to:
log a plurality of entries within the log to track a set of pages within the persistent memory being modified by the write operation, wherein the set of pages is based upon the size supported by the protocol associated with the write operation.
21 . A method comprising:
hosting an indirection layer between references to pages within persistent memory and page block numbers of physical page locations storing data of the pages;
populating the indirection layer with per-page structures storing the page block numbers;
associating the per-page structures with per-page structure identifiers used by parent indirect pages of a file tree of a file to access the per-page structures;
utilizing the per-page structures of the indirection layer to identify the page block numbers for accessing the data of the pages; and
logging a plurality of entries within a log to track a set of pages within the persistent memory being modified by a write operation, wherein the set of pages is based upon a size supported by a protocol associated with the write operation, and wherein an entry specifies a volume targeted by the write operation, a first file targeted by the write operation, and a file block number of a page of the set of pages.
22 . The method of claim 21 , comprising:
receiving an operation to access new data tracked by a first per-page structure; and
traversing the file tree to a parent indirect page to identify an old per-page structure identifier of an old per-page structure comprising a new page block number of the new data.
23 . The method of claim 21 , comprising:
managing a file system of the persistent memory using a persistent memory storage tier at a higher level within a storage operating system storage stack than a level of a storage file system tier that manages a storage file system of storage.