summaryrefslogtreecommitdiff
path: root/include/linux/fscache.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2021-10-20 16:06:34 +0300
committerDavid Howells <dhowells@redhat.com>2022-01-07 16:40:28 +0300
commit1f67e6d0b18853c641d861a671f46a4964a88510 (patch)
tree2680466380519b5a123dcfc7a96354a6beaff794 /include/linux/fscache.h
parent08276bdae68b022a7726edf7416b6748e3df5395 (diff)
downloadlinux-1f67e6d0b18853c641d861a671f46a4964a88510.tar.xz
fscache: Provide a function to note the release of a page
Provide a function to be called from a network filesystem's releasepage method to indicate that a page has been released that might have been a reflection of data upon the server - and now that data must be reloaded from the server or the cache. This is used to end an optimisation for empty files, in particular files that have just been created locally, whereby we know there cannot yet be any data that we would need to read from the server or the cache. Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/163819617128.215744.4725572296135656508.stgit@warthog.procyon.org.uk/ # v1 Link: https://lore.kernel.org/r/163906920354.143852.7511819614661372008.stgit@warthog.procyon.org.uk/ # v2 Link: https://lore.kernel.org/r/163967128061.1823006.611781655060034988.stgit@warthog.procyon.org.uk/ # v3 Link: https://lore.kernel.org/r/164021525963.640689.9264556596205140044.stgit@warthog.procyon.org.uk/ # v4
Diffstat (limited to 'include/linux/fscache.h')
-rw-r--r--include/linux/fscache.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index 18e725671594..28ce258c1f87 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -607,4 +607,20 @@ static inline void fscache_clear_inode_writeback(struct fscache_cookie *cookie,
}
}
+/**
+ * fscache_note_page_release - Note that a netfs page got released
+ * @cookie: The cookie corresponding to the file
+ *
+ * Note that a page that has been copied to the cache has been released. This
+ * means that future reads will need to look in the cache to see if it's there.
+ */
+static inline
+void fscache_note_page_release(struct fscache_cookie *cookie)
+{
+ if (cookie &&
+ test_bit(FSCACHE_COOKIE_HAVE_DATA, &cookie->flags) &&
+ test_bit(FSCACHE_COOKIE_NO_DATA_TO_READ, &cookie->flags))
+ clear_bit(FSCACHE_COOKIE_NO_DATA_TO_READ, &cookie->flags);
+}
+
#endif /* _LINUX_FSCACHE_H */