Skip to content

Commit

Permalink
iomap: add a page_done callback
Browse files Browse the repository at this point in the history
This will be used by gfs2 to attach data to transactions for the journaled
data mode.  But the concept is generic enough that we might be able to
use it for other purposes like encryption/integrity post-processing in the
future.

Based on a patch from Andreas Gruenbacher.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
  • Loading branch information
Christoph Hellwig authored and Darrick J. Wong committed Jun 19, 2018
1 parent 19e0c58 commit 63899c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/iomap.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ iomap_write_end(struct inode *inode, loff_t pos, unsigned len,
copied, page, NULL);
}

if (iomap->page_done)
iomap->page_done(inode, pos, copied, page, iomap);

if (ret < len)
iomap_write_failed(inode, pos, len);
return ret;
Expand Down
9 changes: 9 additions & 0 deletions include/linux/iomap.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ struct fiemap_extent_info;
struct inode;
struct iov_iter;
struct kiocb;
struct page;
struct vm_area_struct;
struct vm_fault;

Expand Down Expand Up @@ -56,6 +57,14 @@ struct iomap {
struct block_device *bdev; /* block device for I/O */
struct dax_device *dax_dev; /* dax_dev for dax operations */
void *inline_data;

/*
* Called when finished processing a page in the mapping returned in
* this iomap. At least for now this is only supported in the buffered
* write path.
*/
void (*page_done)(struct inode *inode, loff_t pos, unsigned copied,
struct page *page, struct iomap *iomap);
};

/*
Expand Down

0 comments on commit 63899c6

Please sign in to comment.