mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-30 17:00:08 -04:00
btrfs: convert extent_range_clear_dirty_for_io() to use a folio
Instead of getting a page and using that to clear dirty for io, use the folio helper and use the appropriate folio functions. Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
c86d3aac81
commit
5fe1912449
@@ -877,19 +877,19 @@ static inline void inode_should_defrag(struct btrfs_inode *inode,
|
||||
static int extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end)
|
||||
{
|
||||
unsigned long end_index = end >> PAGE_SHIFT;
|
||||
struct page *page;
|
||||
struct folio *folio;
|
||||
int ret = 0;
|
||||
|
||||
for (unsigned long index = start >> PAGE_SHIFT;
|
||||
index <= end_index; index++) {
|
||||
page = find_get_page(inode->i_mapping, index);
|
||||
if (unlikely(!page)) {
|
||||
folio = __filemap_get_folio(inode->i_mapping, index, 0, 0);
|
||||
if (IS_ERR(folio)) {
|
||||
if (!ret)
|
||||
ret = -ENOENT;
|
||||
ret = PTR_ERR(folio);
|
||||
continue;
|
||||
}
|
||||
clear_page_dirty_for_io(page);
|
||||
put_page(page);
|
||||
folio_clear_dirty_for_io(folio);
|
||||
folio_put(folio);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user