]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
ceph: rework PageFsCache handling
authorJeff Layton <jlayton@kernel.org>
Thu, 21 Jan 2021 21:27:14 +0000 (16:27 -0500)
committerJeff Layton <jlayton@kernel.org>
Thu, 28 Jan 2021 12:36:14 +0000 (07:36 -0500)
With the new fscache API, the PageFsCache bit now indicates that the
page is being written to the cache and shouldn't be modified or released
until it's finished.

Change releasepage and invalidatepage to wait on that bit before
returning.

Also define FSCACHE_USE_NEW_IO_API so that we opt into the new fscache
API.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
fs/ceph/addr.c
fs/ceph/super.h

index 2b17bb36e5482426f723f9880b6410a45dc3864d..fbfa49db06fd765970ca990b9f23074a287341b4 100644 (file)
@@ -146,6 +146,8 @@ static void ceph_invalidatepage(struct page *page, unsigned int offset,
        struct ceph_inode_info *ci;
        struct ceph_snap_context *snapc = page_snap_context(page);
 
+       wait_on_page_fscache(page);
+
        inode = page->mapping->host;
        ci = ceph_inode(inode);
 
@@ -168,11 +170,16 @@ static void ceph_invalidatepage(struct page *page, unsigned int offset,
        ClearPagePrivate(page);
 }
 
-static int ceph_releasepage(struct page *page, gfp_t g)
+static int ceph_releasepage(struct page *page, gfp_t gfp_flags)
 {
        dout("%p releasepage %p idx %lu (%sdirty)\n", page->mapping->host,
             page, page->index, PageDirty(page) ? "" : "not ");
 
+       if (PageFsCache(page)) {
+               if (!(gfp_flags & __GFP_DIRECT_RECLAIM) || !(gfp_flags & __GFP_FS))
+                       return 0;
+               wait_on_page_fscache(page);
+       }
        return !PagePrivate(page);
 }
 
index b62d8fee3b86dac64bb42abcf7f8f110b71e1331..96bd3487d7887c66124a5dad7a47fe0ff17f1540 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/ceph/libceph.h>
 
 #ifdef CONFIG_CEPH_FSCACHE
+#define FSCACHE_USE_NEW_IO_API
 #include <linux/fscache.h>
 #endif