]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ocfs2: support large folios in ocfs2_write_zero_page()
authorMark Tinguely <mark.tinguely@oracle.com>
Thu, 5 Dec 2024 17:16:51 +0000 (17:16 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 13 Jan 2025 04:21:14 +0000 (20:21 -0800)
Remove assumptions that a folio is PAGE_SIZE.

Link: https://lkml.kernel.org/r/20241205171653.3179945-24-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>
fs/ocfs2/file.c

index 957ced628eb1313fed0e4a96dced4590ac7f5675..e54f2c4b5a907782267603abf25f0a10cc79515a 100644 (file)
@@ -782,11 +782,11 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
                goto out_commit_trans;
        }
 
-       /* Get the offsets within the page that we want to zero */
-       zero_from = abs_from & (PAGE_SIZE - 1);
-       zero_to = abs_to & (PAGE_SIZE - 1);
+       /* Get the offsets within the folio that we want to zero */
+       zero_from = offset_in_folio(folio, abs_from);
+       zero_to = offset_in_folio(folio, abs_to);
        if (!zero_to)
-               zero_to = PAGE_SIZE;
+               zero_to = folio_size(folio);
 
        trace_ocfs2_write_zero_page(
                        (unsigned long long)OCFS2_I(inode)->ip_blkno,