History

iomap: lift the xfs writeback code to iomap

Take the xfs writeback code and move it to fs/iomap. A new structure with three methods is added as the abstraction from the generic writeback code to the file system. These methods are used to map blocks, submit an ioend, and cancel a page that encountered an error before it was added to an ioend.

Christoph Hellwig committed 7 years ago

Commit 598ecfb1 parent 9e91c577 files · +669 −648Browse files

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

Unified · Split

include/linux/iomap.h+59−0
@@ -4,6 +4,7 @@ · 3 unmodified lines
4 4
5#include <linux/atomic.h>5#include <linux/atomic.h>
6#include <linux/bitmap.h>6#include <linux/bitmap.h>
7#include <linux/blk_types.h>
7#include <linux/mm.h>8#include <linux/mm.h>
8#include <linux/types.h>9#include <linux/types.h>
9#include <linux/mm_types.h>10#include <linux/mm_types.h>
@@ -12,6 +13,7 @@ · 2 unmodified lines
12struct address_space;13struct address_space;
13struct fiemap_extent_info;14struct fiemap_extent_info;
14struct inode;15struct inode;
16struct iomap_writepage_ctx;
15struct iov_iter;17struct iov_iter;
16struct kiocb;18struct kiocb;
17struct page;19struct page;
@@ -185,6 +187,63 @@ loff_t iomap_seek_data(struct inode *inode, loff_t offset, · 167 unmodified lines
185sector_t iomap_bmap(struct address_space *mapping, sector_t bno,187sector_t iomap_bmap(struct address_space *mapping, sector_t bno,
186 const struct iomap_ops *ops);188 const struct iomap_ops *ops);
187 189
190/*
191 * Structure for writeback I/O completions.
192 */
193struct iomap_ioend {
194 struct list_head io_list; /* next ioend in chain */
195 u16 io_type;
196 u16 io_flags; /* IOMAP_F_* */
197 struct inode *io_inode; /* file being written to */
198 size_t io_size; /* size of the extent */
199 loff_t io_offset; /* offset in the file */
200 void *io_private; /* file system private data */
201 struct bio *io_bio; /* bio being built */
202 struct bio io_inline_bio; /* MUST BE LAST! */
203};
204
205struct iomap_writeback_ops {
206 /*
207 * Required, maps the blocks so that writeback can be performed on
208 * the range starting at offset.
209 */
210 int (*map_blocks)(struct iomap_writepage_ctx *wpc, struct inode *inode,
211 loff_t offset);
212
213 /*
214 * Optional, allows the file systems to perform actions just before
215 * submitting the bio and/or override the bio end_io handler for complex
216 * operations like copy on write extent manipulation or unwritten extent
217 * conversions.
218 */
219 int (*prepare_ioend)(struct iomap_ioend *ioend, int status);
220
221 /*
222 * Optional, allows the file system to discard state on a page where
223 * we failed to submit any I/O.
224 */
225 void (*discard_page)(struct page *page);
226};
227
228struct iomap_writepage_ctx {
229 struct iomap iomap;
230 struct iomap_ioend *ioend;
231 const struct iomap_writeback_ops *ops;
232};
233
234void iomap_finish_ioends(struct iomap_ioend *ioend, int error);
235void iomap_ioend_try_merge(struct iomap_ioend *ioend,
236 struct list_head *more_ioends,
237 void (*merge_private)(struct iomap_ioend *ioend,
238 struct iomap_ioend *next));
239void iomap_sort_ioends(struct list_head *ioend_list);
240int iomap_writepage(struct page *page, struct writeback_control *wbc,
241 struct iomap_writepage_ctx *wpc,
242 const struct iomap_writeback_ops *ops);
243int iomap_writepages(struct address_space *mapping,
244 struct writeback_control *wbc, struct iomap_writepage_ctx *wpc,
245 const struct iomap_writeback_ops *ops);
246
188/*247/*
189 * Flags for direct I/O ->end_io:248 * Flags for direct I/O ->end_io:
190 */249 */

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