OpenCloudOS-Kernel/fs/9p
David Howells 93c846143d 9p: Copy local writes to the cache when writing to the server
When writing to the server from v9fs_vfs_writepage(), copy the data to the
cache object too.

To make this possible, the cookie must have its active users count
incremented when the page is dirtied and kept incremented until we manage
to clean up all the pages.  This allows the writeback to take place after
the last file struct is released.

This is done by taking a use on the cookie in v9fs_set_page_dirty() if we
haven't already done so (controlled by the I_PINNING_FSCACHE_WB flag) and
dropping the pin in v9fs_write_inode() if __writeback_single_inode() clears
all the outstanding dirty pages (conveyed by the unpinned_fscache_wb flag
in the writeback_control struct).

Inode eviction must also clear the flag after truncating away all the
outstanding pages.

In the future this will be handled more gracefully by netfslib.

Changes
=======
ver #3:
 - Canonicalise the coherency data to make it endianness-independent.

ver #2:
 - Fix an unused-var warning due to CONFIG_9P_FSCACHE=n[1].

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Jeff Layton <jlayton@kernel.org>
Tested-by: Dominique Martinet <asmadeus@codewreck.org>
cc: Eric Van Hensbergen <ericvh@gmail.com>
cc: Latchesar Ionkov <lucho@ionkov.net>
cc: v9fs-developer@lists.sourceforge.net
cc: linux-cachefs@redhat.com
Link: https://lore.kernel.org/r/163819667027.215744.13815687931204222995.stgit@warthog.procyon.org.uk/ # v1
Link: https://lore.kernel.org/r/163906978015.143852.10646669694345706328.stgit@warthog.procyon.org.uk/ # v2
Link: https://lore.kernel.org/r/163967180760.1823006.5831751873616248910.stgit@warthog.procyon.org.uk/ # v3
Link: https://lore.kernel.org/r/164021574522.640689.13849966660182529125.stgit@warthog.procyon.org.uk/ # v4
2022-01-10 11:53:25 +00:00
..
Kconfig 9p: Use fscache indexing rewrite and reenable caching 2022-01-10 11:53:06 +00:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
acl.c 9p: fix a bunch of checkpatch warnings 2021-11-04 21:04:25 +09:00
acl.h 9p: fix a bunch of checkpatch warnings 2021-11-04 21:04:25 +09:00
cache.c 9p: Use fscache indexing rewrite and reenable caching 2022-01-10 11:53:06 +00:00
cache.h 9p: Use fscache indexing rewrite and reenable caching 2022-01-10 11:53:06 +00:00
fid.c fs/9p: fix indentation and Add missing a blank line after declaration 2021-11-03 17:45:03 +09:00
fid.h 9p: apply review requests for fid refcounting 2020-11-19 17:21:34 +01:00
v9fs.c 9p: Use fscache indexing rewrite and reenable caching 2022-01-10 11:53:06 +00:00
v9fs.h 9p: Use fscache indexing rewrite and reenable caching 2022-01-10 11:53:06 +00:00
v9fs_vfs.h 9p: fix a bunch of checkpatch warnings 2021-11-04 21:04:25 +09:00
vfs_addr.c 9p: Copy local writes to the cache when writing to the server 2022-01-10 11:53:25 +00:00
vfs_dentry.c 9p: fix a bunch of checkpatch warnings 2021-11-04 21:04:25 +09:00
vfs_dir.c 9p: Use fscache indexing rewrite and reenable caching 2022-01-10 11:53:06 +00:00
vfs_file.c 9p: Use fscache indexing rewrite and reenable caching 2022-01-10 11:53:06 +00:00
vfs_inode.c 9p: Copy local writes to the cache when writing to the server 2022-01-10 11:53:25 +00:00
vfs_inode_dotl.c 9p: Use fscache indexing rewrite and reenable caching 2022-01-10 11:53:06 +00:00
vfs_super.c 9p: Copy local writes to the cache when writing to the server 2022-01-10 11:53:25 +00:00
xattr.c 9p: fix file headers 2021-11-03 17:45:04 +09:00
xattr.h 9p: fix a bunch of checkpatch warnings 2021-11-04 21:04:25 +09:00