iomap: Convert iomap_write_end_inline to take a folio

This conversion is only safe because iomap only supports writes to inline
data which starts at the beginning of the file.
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent bc6123a8
...@@ -683,16 +683,16 @@ static size_t __iomap_write_end(struct inode *inode, loff_t pos, size_t len, ...@@ -683,16 +683,16 @@ static size_t __iomap_write_end(struct inode *inode, loff_t pos, size_t len,
} }
static size_t iomap_write_end_inline(const struct iomap_iter *iter, static size_t iomap_write_end_inline(const struct iomap_iter *iter,
struct page *page, loff_t pos, size_t copied) struct folio *folio, loff_t pos, size_t copied)
{ {
const struct iomap *iomap = &iter->iomap; const struct iomap *iomap = &iter->iomap;
void *addr; void *addr;
WARN_ON_ONCE(!PageUptodate(page)); WARN_ON_ONCE(!folio_test_uptodate(folio));
BUG_ON(!iomap_inline_data_valid(iomap)); BUG_ON(!iomap_inline_data_valid(iomap));
flush_dcache_page(page); flush_dcache_folio(folio);
addr = kmap_local_page(page) + pos; addr = kmap_local_folio(folio, pos);
memcpy(iomap_inline_data(iomap, pos), addr, copied); memcpy(iomap_inline_data(iomap, pos), addr, copied);
kunmap_local(addr); kunmap_local(addr);
...@@ -710,7 +710,7 @@ static size_t iomap_write_end(struct iomap_iter *iter, loff_t pos, size_t len, ...@@ -710,7 +710,7 @@ static size_t iomap_write_end(struct iomap_iter *iter, loff_t pos, size_t len,
size_t ret; size_t ret;
if (srcmap->type == IOMAP_INLINE) { if (srcmap->type == IOMAP_INLINE) {
ret = iomap_write_end_inline(iter, &folio->page, pos, copied); ret = iomap_write_end_inline(iter, folio, pos, copied);
} else if (srcmap->flags & IOMAP_F_BUFFER_HEAD) { } else if (srcmap->flags & IOMAP_F_BUFFER_HEAD) {
ret = block_write_end(NULL, iter->inode->i_mapping, pos, len, ret = block_write_end(NULL, iter->inode->i_mapping, pos, len,
copied, &folio->page, NULL); copied, &folio->page, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment