]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
9p: Copy local writes to the cache when writing to the server
authorDavid Howells <dhowells@redhat.com>
Wed, 18 Nov 2020 09:06:42 +0000 (09:06 +0000)
committerDavid Howells <dhowells@redhat.com>
Fri, 26 Nov 2021 21:23:49 +0000 (21:23 +0000)
commit3ce334c5333038dc55f20f50b85edabfba90e398
tree441d5a72523c16abec6dd1a5c9246d2d765dac6b
parentdfeffec3452ba7c9198efae9c14de8f018d2b3a5
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.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Eric Van Hensbergen <ericvh@gmail.com>
cc: Latchesar Ionkov <lucho@ionkov.net>
cc: Dominique Martinet <asmadeus@codewreck.org>
cc: v9fs-developer@lists.sourceforge.net
cc: linux-cachefs@redhat.com
fs/9p/vfs_addr.c
fs/9p/vfs_inode.c
fs/9p/vfs_super.c