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
5353 */
5454 #define IOMAP_NULL_ADDR -1ULL /* addr is not valid */
5555
56+struct iomap_page_ops;
57+
5658 struct iomap {
5759 u64 addr; /* disk offset of mapping, bytes */
5860 loff_t offset; /* file offset of mapping, bytes */
@@ -63,12 +65,22 @@ struct iomap { · 4 unmodified lines
6365 struct dax_device *dax_dev; /* dax_dev for dax operations */
6466 void *inline_data;
6567 void *private; /* filesystem private */
68+ const struct iomap_page_ops *page_ops;
69+};
6670
67− /*
68− * Called when finished processing a page in the mapping returned in
69− * this iomap. At least for now this is only supported in the buffered
70− * write path.
71− */
71+/*
72+ * When a filesystem sets page_ops in an iomap mapping it returns, page_prepare
73+ * and page_done will be called for each page written to. This only applies to
74+ * buffered writes as unbuffered writes will not typically have pages
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+ */
81+struct iomap_page_ops {
82+ int (*page_prepare)(struct inode *inode, loff_t pos, unsigned len,
83+ struct iomap *iomap);
7284 void (*page_done)(struct inode *inode, loff_t pos, unsigned copied,
7385 struct page *page, struct iomap *iomap);
7486 };

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