summaryrefslogtreecommitdiff
path: root/fs/ceph/addr.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2021-01-21 16:27:14 -0500
committerIlya Dryomov <idryomov@gmail.com>2021-04-27 23:52:21 +0200
commit7c46b31809337df12a538239e6caa41df7c7deec (patch)
tree6e3256c9eda9ee7b880137bd1e0e427575990e46 /fs/ceph/addr.c
parente7df4524cd9a6a006f9e12f3d908e5af69dfa145 (diff)
downloadlwn-7c46b31809337df12a538239e6caa41df7c7deec.tar.gz
lwn-7c46b31809337df12a538239e6caa41df7c7deec.zip
ceph: rework PageFsCache handling
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> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/addr.c')
-rw-r--r--fs/ceph/addr.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index e267aa60c8b6..3936ae3e8dcd 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -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)
{
dout("%p releasepage %p idx %lu (%sdirty)\n", page->mapping->host,
page, page->index, PageDirty(page) ? "" : "not ");
+ if (PageFsCache(page)) {
+ if (!(gfp & __GFP_DIRECT_RECLAIM) || !(gfp & __GFP_FS))
+ return 0;
+ wait_on_page_fscache(page);
+ }
return !PagePrivate(page);
}