]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ceph: Convert ceph_check_page_before_write() to use a folio
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 17 Feb 2025 18:51:14 +0000 (18:51 +0000)
committerChristian Brauner <brauner@kernel.org>
Fri, 28 Feb 2025 10:21:30 +0000 (11:21 +0100)
Remove the conversion back to a struct page and just use the folio
passed in.

Signed-off-by: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Link: https://lore.kernel.org/r/20250217185119.430193-7-willy@infradead.org
Tested-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/ceph/addr.c

index d5c43492e92cef5d0b06bfcc40e6a6d6e96ee349..8cc8a32d34adbcbf335f66d30f0e4255c17ce55f 100644 (file)
@@ -1132,18 +1132,17 @@ int ceph_check_page_before_write(struct address_space *mapping,
        struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_client *cl = fsc->client;
        struct ceph_snap_context *pgsnapc;
-       struct page *page = &folio->page;
 
-       /* only dirty pages, or our accounting breaks */
-       if (unlikely(!PageDirty(page)) || unlikely(page->mapping != mapping)) {
-               doutc(cl, "!dirty or !mapping %p\n", page);
+       /* only dirty folios, or our accounting breaks */
+       if (unlikely(!folio_test_dirty(folio) || folio->mapping != mapping)) {
+               doutc(cl, "!dirty or !mapping %p\n", folio);
                return -ENODATA;
        }
 
        /* only if matching snap context */
-       pgsnapc = page_snap_context(page);
+       pgsnapc = page_snap_context(&folio->page);
        if (pgsnapc != ceph_wbc->snapc) {
-               doutc(cl, "page snapc %p %lld != oldest %p %lld\n",
+               doutc(cl, "folio snapc %p %lld != oldest %p %lld\n",
                      pgsnapc, pgsnapc->seq,
                      ceph_wbc->snapc, ceph_wbc->snapc->seq);
 
@@ -1154,7 +1153,7 @@ int ceph_check_page_before_write(struct address_space *mapping,
                return -ENODATA;
        }
 
-       if (page_offset(page) >= ceph_wbc->i_size) {
+       if (folio_pos(folio) >= ceph_wbc->i_size) {
                doutc(cl, "folio at %lu beyond eof %llu\n",
                      folio->index, ceph_wbc->i_size);
 
@@ -1167,8 +1166,8 @@ int ceph_check_page_before_write(struct address_space *mapping,
        }
 
        if (ceph_wbc->strip_unit_end &&
-           (page->index > ceph_wbc->strip_unit_end)) {
-               doutc(cl, "end of strip unit %p\n", page);
+           (folio->index > ceph_wbc->strip_unit_end)) {
+               doutc(cl, "end of strip unit %p\n", folio);
                return -E2BIG;
        }