mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-16 05:26:07 +00:00
ocfs2: use a folio in ocfs2_prepare_page_for_write()
Update to the new APIs. Removes a few page->folio conversions. Link: https://lkml.kernel.org/r/20241205171653.3179945-13-willy@infradead.org Signed-off-by: Mark Tinguely <mark.tinguely@oracle.com> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com> Cc: Changwei Ge <gechangwei@live.cn> Cc: Joel Becker <jlbec@evilplan.org> Cc: Jun Piao <piaojun@huawei.com> Cc: Junxiao Bi <junxiao.bi@oracle.com> Cc: Mark Fasheh <mark@fasheh.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
2c3f6ee4b0
commit
2bfec16fbd
@ -963,10 +963,10 @@ static int ocfs2_prepare_folio_for_write(struct inode *inode, u64 *p_blkno,
|
|||||||
/* treat the write as new if the a hole/lseek spanned across
|
/* treat the write as new if the a hole/lseek spanned across
|
||||||
* the page boundary.
|
* the page boundary.
|
||||||
*/
|
*/
|
||||||
new = new | ((i_size_read(inode) <= page_offset(page)) &&
|
new = new | ((i_size_read(inode) <= folio_pos(folio)) &&
|
||||||
(page_offset(page) <= user_pos));
|
(folio_pos(folio) <= user_pos));
|
||||||
|
|
||||||
if (page == &wc->w_target_folio->page) {
|
if (folio == wc->w_target_folio) {
|
||||||
map_from = user_pos & (PAGE_SIZE - 1);
|
map_from = user_pos & (PAGE_SIZE - 1);
|
||||||
map_to = map_from + user_len;
|
map_to = map_from + user_len;
|
||||||
|
|
||||||
@ -990,7 +990,7 @@ static int ocfs2_prepare_folio_for_write(struct inode *inode, u64 *p_blkno,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* If we haven't allocated the new page yet, we
|
* If we haven't allocated the new folio yet, we
|
||||||
* shouldn't be writing it out without copying user
|
* shouldn't be writing it out without copying user
|
||||||
* data. This is likely a math error from the caller.
|
* data. This is likely a math error from the caller.
|
||||||
*/
|
*/
|
||||||
@ -1008,20 +1008,20 @@ static int ocfs2_prepare_folio_for_write(struct inode *inode, u64 *p_blkno,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parts of newly allocated pages need to be zero'd.
|
* Parts of newly allocated folios need to be zero'd.
|
||||||
*
|
*
|
||||||
* Above, we have also rewritten 'to' and 'from' - as far as
|
* Above, we have also rewritten 'to' and 'from' - as far as
|
||||||
* the rest of the function is concerned, the entire cluster
|
* the rest of the function is concerned, the entire cluster
|
||||||
* range inside of a page needs to be written.
|
* range inside of a folio needs to be written.
|
||||||
*
|
*
|
||||||
* We can skip this if the page is up to date - it's already
|
* We can skip this if the folio is uptodate - it's already
|
||||||
* been zero'd from being read in as a hole.
|
* been zero'd from being read in as a hole.
|
||||||
*/
|
*/
|
||||||
if (new && !PageUptodate(page))
|
if (new && !folio_test_uptodate(folio))
|
||||||
ocfs2_clear_page_regions(page, OCFS2_SB(inode->i_sb),
|
ocfs2_clear_page_regions(page, OCFS2_SB(inode->i_sb),
|
||||||
cpos, user_data_from, user_data_to);
|
cpos, user_data_from, user_data_to);
|
||||||
|
|
||||||
flush_dcache_page(page);
|
flush_dcache_folio(folio);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user