ocfs2: Convert ocfs2_write_zero_page to use a folio
Removes a conversion of folio to page, and then two hidden conversions of page back to folio. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
1da86618bd
commit
7f90d7f1bc
@ -755,7 +755,7 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
|
|||||||
u64 abs_to, struct buffer_head *di_bh)
|
u64 abs_to, struct buffer_head *di_bh)
|
||||||
{
|
{
|
||||||
struct address_space *mapping = inode->i_mapping;
|
struct address_space *mapping = inode->i_mapping;
|
||||||
struct page *page;
|
struct folio *folio;
|
||||||
unsigned long index = abs_from >> PAGE_SHIFT;
|
unsigned long index = abs_from >> PAGE_SHIFT;
|
||||||
handle_t *handle;
|
handle_t *handle;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -774,9 +774,10 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
page = find_or_create_page(mapping, index, GFP_NOFS);
|
folio = __filemap_get_folio(mapping, index,
|
||||||
if (!page) {
|
FGP_LOCK | FGP_ACCESSED | FGP_CREAT, GFP_NOFS);
|
||||||
ret = -ENOMEM;
|
if (IS_ERR(folio)) {
|
||||||
|
ret = PTR_ERR(folio);
|
||||||
mlog_errno(ret);
|
mlog_errno(ret);
|
||||||
goto out_commit_trans;
|
goto out_commit_trans;
|
||||||
}
|
}
|
||||||
@ -803,7 +804,7 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
|
|||||||
* __block_write_begin and block_commit_write to zero the
|
* __block_write_begin and block_commit_write to zero the
|
||||||
* whole block.
|
* whole block.
|
||||||
*/
|
*/
|
||||||
ret = __block_write_begin(page, block_start + 1, 0,
|
ret = __block_write_begin(&folio->page, block_start + 1, 0,
|
||||||
ocfs2_get_block);
|
ocfs2_get_block);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
mlog_errno(ret);
|
mlog_errno(ret);
|
||||||
@ -812,7 +813,7 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
|
|||||||
|
|
||||||
|
|
||||||
/* must not update i_size! */
|
/* must not update i_size! */
|
||||||
block_commit_write(page, block_start + 1, block_start + 1);
|
block_commit_write(&folio->page, block_start + 1, block_start + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -833,8 +834,8 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
|
|||||||
}
|
}
|
||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
unlock_page(page);
|
folio_unlock(folio);
|
||||||
put_page(page);
|
folio_put(folio);
|
||||||
out_commit_trans:
|
out_commit_trans:
|
||||||
if (handle)
|
if (handle)
|
||||||
ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
|
ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
|
||||||
|
Loading…
Reference in New Issue
Block a user