History

iomap: Add a page_prepare callback

Move the page_done callback into a separate iomap_page_ops structure and add a page_prepare calback to be called before the next page is written to. In gfs2, we'll want to start a transaction in page_prepare and end it in page_done. Other filesystems that implement data journaling will require the same kind of mechanism.

Andreas Gruenbacher committed 7 years ago

Commit df0db3e1 parent 7a77dad3 files · +53 −20Browse files

Showing the changes to include/linux (1 of 3 files). Show all

Unified · Split

include/linux/iomap.h+17−5
@@ -53,6 +53,8 @@ struct vm_fault; · 52 unmodified lines
53 */53 */
54#define IOMAP_NULL_ADDR -1ULL /* addr is not valid */54#define IOMAP_NULL_ADDR -1ULL /* addr is not valid */
55 55
56struct iomap_page_ops;
57
56struct iomap {58struct iomap {
57 u64 addr; /* disk offset of mapping, bytes */59 u64 addr; /* disk offset of mapping, bytes */
58 loff_t offset; /* file offset of mapping, bytes */60 loff_t offset; /* file offset of mapping, bytes */
@@ -63,12 +65,22 @@ struct iomap { · 4 unmodified lines
63 struct dax_device *dax_dev; /* dax_dev for dax operations */65 struct dax_device *dax_dev; /* dax_dev for dax operations */
64 void *inline_data;66 void *inline_data;
65 void *private; /* filesystem private */67 void *private; /* filesystem private */
68 const struct iomap_page_ops *page_ops;
69};
66 70
67 /*71/*
68 * Called when finished processing a page in the mapping returned in72 * When a filesystem sets page_ops in an iomap mapping it returns, page_prepare
69 * this iomap. At least for now this is only supported in the buffered73 * and page_done will be called for each page written to. This only applies to
70 * write path.74 * buffered writes as unbuffered writes will not typically have pages
71 */75 * associated with them.
76 *
77 * When page_prepare succeeds, page_done will always be called to do any
78 * cleanup work necessary. In that page_done call, @page will be NULL if the
79 * associated page could not be obtained.
80 */
81struct iomap_page_ops {
82 int (*page_prepare)(struct inode *inode, loff_t pos, unsigned len,
83 struct iomap *iomap);
72 void (*page_done)(struct inode *inode, loff_t pos, unsigned copied,84 void (*page_done)(struct inode *inode, loff_t pos, unsigned copied,
73 struct page *page, struct iomap *iomap);85 struct page *page, struct iomap *iomap);
74};86};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t