提交 2fa4eeb8 编写于 作者: M Matthew Wilcox (Oracle)

filemap: Convert filemap_range_uptodate to folios

The only caller was already passing a head page, so this simply avoids
a call to compound_head().
Signed-off-by: NMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NWilliam Kucharski <william.kucharski@oracle.com>
上级 a5d4ad09
...@@ -2395,29 +2395,29 @@ static int filemap_read_folio(struct file *file, struct address_space *mapping, ...@@ -2395,29 +2395,29 @@ static int filemap_read_folio(struct file *file, struct address_space *mapping,
} }
static bool filemap_range_uptodate(struct address_space *mapping, static bool filemap_range_uptodate(struct address_space *mapping,
loff_t pos, struct iov_iter *iter, struct page *page) loff_t pos, struct iov_iter *iter, struct folio *folio)
{ {
int count; int count;
if (PageUptodate(page)) if (folio_test_uptodate(folio))
return true; return true;
/* pipes can't handle partially uptodate pages */ /* pipes can't handle partially uptodate pages */
if (iov_iter_is_pipe(iter)) if (iov_iter_is_pipe(iter))
return false; return false;
if (!mapping->a_ops->is_partially_uptodate) if (!mapping->a_ops->is_partially_uptodate)
return false; return false;
if (mapping->host->i_blkbits >= (PAGE_SHIFT + thp_order(page))) if (mapping->host->i_blkbits >= folio_shift(folio))
return false; return false;
count = iter->count; count = iter->count;
if (page_offset(page) > pos) { if (folio_pos(folio) > pos) {
count -= page_offset(page) - pos; count -= folio_pos(folio) - pos;
pos = 0; pos = 0;
} else { } else {
pos -= page_offset(page); pos -= folio_pos(folio);
} }
return mapping->a_ops->is_partially_uptodate(page, pos, count); return mapping->a_ops->is_partially_uptodate(&folio->page, pos, count);
} }
static int filemap_update_page(struct kiocb *iocb, static int filemap_update_page(struct kiocb *iocb,
...@@ -2457,7 +2457,7 @@ static int filemap_update_page(struct kiocb *iocb, ...@@ -2457,7 +2457,7 @@ static int filemap_update_page(struct kiocb *iocb,
goto unlock; goto unlock;
error = 0; error = 0;
if (filemap_range_uptodate(mapping, iocb->ki_pos, iter, &folio->page)) if (filemap_range_uptodate(mapping, iocb->ki_pos, iter, folio))
goto unlock; goto unlock;
error = -EAGAIN; error = -EAGAIN;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册