mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-07 19:49:33 -04:00
ocfs2: convert ocfs2_page_mkwrite() to use a folio
Pass the folio into __ocfs2_page_mkwrite() and use it throughout. Does not attempt to support large folios. Link: https://lkml.kernel.org/r/20241205171653.3179945-3-willy@infradead.org 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> Cc: Mark Tinguely <mark.tinguely@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
2b4c2094da
commit
3d9e356f02
@@ -44,13 +44,13 @@ static vm_fault_t ocfs2_fault(struct vm_fault *vmf)
|
||||
}
|
||||
|
||||
static vm_fault_t __ocfs2_page_mkwrite(struct file *file,
|
||||
struct buffer_head *di_bh, struct page *page)
|
||||
struct buffer_head *di_bh, struct folio *folio)
|
||||
{
|
||||
int err;
|
||||
vm_fault_t ret = VM_FAULT_NOPAGE;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct address_space *mapping = inode->i_mapping;
|
||||
loff_t pos = page_offset(page);
|
||||
loff_t pos = folio_pos(folio);
|
||||
unsigned int len = PAGE_SIZE;
|
||||
pgoff_t last_index;
|
||||
struct folio *locked_folio = NULL;
|
||||
@@ -72,9 +72,9 @@ static vm_fault_t __ocfs2_page_mkwrite(struct file *file,
|
||||
*
|
||||
* Let VM retry with these cases.
|
||||
*/
|
||||
if ((page->mapping != inode->i_mapping) ||
|
||||
(!PageUptodate(page)) ||
|
||||
(page_offset(page) >= size))
|
||||
if ((folio->mapping != inode->i_mapping) ||
|
||||
!folio_test_uptodate(folio) ||
|
||||
(pos >= size))
|
||||
goto out;
|
||||
|
||||
/*
|
||||
@@ -87,11 +87,11 @@ static vm_fault_t __ocfs2_page_mkwrite(struct file *file,
|
||||
* worry about ocfs2_write_begin() skipping some buffer reads
|
||||
* because the "write" would invalidate their data.
|
||||
*/
|
||||
if (page->index == last_index)
|
||||
if (folio->index == last_index)
|
||||
len = ((size - 1) & ~PAGE_MASK) + 1;
|
||||
|
||||
err = ocfs2_write_begin_nolock(mapping, pos, len, OCFS2_WRITE_MMAP,
|
||||
&locked_folio, &fsdata, di_bh, page);
|
||||
&locked_folio, &fsdata, di_bh, &folio->page);
|
||||
if (err) {
|
||||
if (err != -ENOSPC)
|
||||
mlog_errno(err);
|
||||
@@ -112,7 +112,7 @@ static vm_fault_t __ocfs2_page_mkwrite(struct file *file,
|
||||
|
||||
static vm_fault_t ocfs2_page_mkwrite(struct vm_fault *vmf)
|
||||
{
|
||||
struct page *page = vmf->page;
|
||||
struct folio *folio = page_folio(vmf->page);
|
||||
struct inode *inode = file_inode(vmf->vma->vm_file);
|
||||
struct buffer_head *di_bh = NULL;
|
||||
sigset_t oldset;
|
||||
@@ -141,7 +141,7 @@ static vm_fault_t ocfs2_page_mkwrite(struct vm_fault *vmf)
|
||||
*/
|
||||
down_write(&OCFS2_I(inode)->ip_alloc_sem);
|
||||
|
||||
ret = __ocfs2_page_mkwrite(vmf->vma->vm_file, di_bh, page);
|
||||
ret = __ocfs2_page_mkwrite(vmf->vma->vm_file, di_bh, folio);
|
||||
|
||||
up_write(&OCFS2_I(inode)->ip_alloc_sem);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user