Re: [Linux-cachefs] [PATCH] cachefiles: Fix volume coherency attribute

2022-03-08 Thread Jeff Layton
On Tue, 2022-03-08 at 21:52 +, David Howells wrote: > A network filesystem may set coherency data on a volume cookie, and if > given, cachefiles will store this in an xattr on the directory in the cache > corresponding to the volume. > > The function that sets the xattr just stores the content

[Linux-cachefs] [PATCH v2 19/19] afs: Maintain netfs_i_context::remote_i_size

2022-03-08 Thread David Howells
Make afs use netfslib's tracking for the server's idea of what the current inode size is independently of inode->i_size. We really want to use this value when calculating the new vnode size when initiating a StoreData RPC op rather than the size stat() presents to the user (ie. inode->i_size) as t

[Linux-cachefs] [PATCH v2 18/19] netfs: Keep track of the actual remote file size

2022-03-08 Thread David Howells
Provide a place in which to keep track of the actual remote file size in the netfs context. This is needed because inode->i_size will be updated as we buffer writes in the pagecache, but the server file size won't get updated until we flush them back. Signed-off-by: David Howells cc: linux-cache

[Linux-cachefs] [PATCH v2 17/19] netfs: Split some core bits out into their own file

2022-03-08 Thread David Howells
Split some core bits out into their own file. More bits will be added to this file later. Signed-off-by: David Howells cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/164623006934.3564931.17932680017894039748.st...@warthog.procyon.org.uk/ # v1 --- fs/netfs/Makefile |1 +

[Linux-cachefs] [PATCH v2 16/19] netfs: Split fs/netfs/read_helper.c

2022-03-08 Thread David Howells
Split fs/netfs/read_helper.c into two pieces, one to deal with buffered writes and one to deal with the I/O mechanism. Changes === ver #2) - Add kdoc reference to new file. Signed-off-by: David Howells cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/164623005586.3564931.61495

[Linux-cachefs] [PATCH v2 15/19] netfs: Rename read_helper.c to io.c

2022-03-08 Thread David Howells
Rename the read_helper.c file to io.c before splitting out the buffered read functions and some other bits. Changes === ver #2) - Rename read_helper.c before splitting. Signed-off-by: David Howells --- Documentation/filesystems/netfs_library.rst |3 fs/netfs/Makefile

[Linux-cachefs] [PATCH v2 14/19] netfs: Prepare to split read_helper.c

2022-03-08 Thread David Howells
Rename netfs_rreq_unlock() to netfs_rreq_unlock_folios() to make it sound less like it's dropping a lock on an netfs_io_request struct. Remove the 'static' marker on netfs_rreq_unlock_folios() and declaring it in internal.h preparatory to splitting the file. Changes === ver #2) - Slide this

[Linux-cachefs] [PATCH v2 13/19] netfs: Add a function to consolidate beginning a read

2022-03-08 Thread David Howells
Add a function to do the steps needed to begin a read request, allowing this code to be removed from several other functions and consolidated. Changes === ver #2) - Move before the unstaticking patch so that some functions can be left static. - Set uninitialised return code in netfs_begin

[Linux-cachefs] [PATCH v2 12/19] netfs: Add a netfs inode context

2022-03-08 Thread David Howells
Add a netfs_i_context struct that should be included in the network filesystem's own inode struct wrapper, directly after the VFS's inode struct, e.g.: struct my_inode { struct { struct inodevfs_inode; struct netfs

[Linux-cachefs] [PATCH v2 11/19] netfs: Change ->init_request() to return an error code

2022-03-08 Thread David Howells
Change the request initialisation function to return an error code so that the network filesystem can return a failure (ENOMEM, for example). This will also allow ceph to abort a ->readahead() op if the server refuses to give it a cap allowing local caching from within the netfslib framework (erro

[Linux-cachefs] [PATCH v2 10/19] netfs: Refactor arguments for netfs_alloc_read_request

2022-03-08 Thread David Howells
From: Jeff Layton Pass start and len to the rreq allocator. This should ensure that the fields are set so that ->init_request() can use them. Also add a parameter to indicates the origin of the request. Ceph can use this to tell whether to get caps. Changes === ver #2) - Show the request

[Linux-cachefs] [PATCH v2 09/19] netfs: Adjust the netfs_failure tracepoint to indicate non-subreq lines

2022-03-08 Thread David Howells
Adjust the netfs_failure tracepoint to indicate a subrequest number of -1 when it's a full-request failure unrelated to any particular subrequest, such as a failure to encrypt its data buffer. Signed-off-by: David Howells cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/164623001948

[Linux-cachefs] [PATCH v2 08/19] netfs: Trace refcounting on the netfs_io_subrequest struct

2022-03-08 Thread David Howells
Add refcount tracing for the netfs_io_subrequest structure. Signed-off-by: David Howells cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/164622998584.3564931.5052255990645723639.st...@warthog.procyon.org.uk/ # v1 --- fs/netfs/internal.h |2 -- fs/netfs/objects.c

[Linux-cachefs] [PATCH v2 07/19] netfs: Trace refcounting on the netfs_io_request struct

2022-03-08 Thread David Howells
Add refcount tracing for the netfs_io_request structure. Signed-off-by: David Howells cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/164622997668.3564931.14456171619219324968.st...@warthog.procyon.org.uk/ # v1 --- fs/netfs/internal.h | 11 +-- fs/netfs/object

[Linux-cachefs] [PATCH v2 06/19] netfs: Adjust the netfs_rreq tracepoint slightly

2022-03-08 Thread David Howells
Adjust the netfs_rreq tracepoint to include the origin of the request and to increase the size of the "what trace" output strings by a character so that "ENCRYPT" and "DECRYPT" will fit without abbreviation. Signed-off-by: David Howells cc: linux-cachefs@redhat.com Link: https://lore.kernel.org

[Linux-cachefs] [PATCH v2 05/19] netfs: Split netfs_io_* object handling out

2022-03-08 Thread David Howells
Split netfs_io_* object handling out into a file that's going to contain object allocation, get and put routines. Signed-off-by: David Howells cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/164622995118.3564931.6089530629052064470.st...@warthog.procyon.org.uk/ # v1 --- fs/netfs

[Linux-cachefs] [PATCH v2 04/19] netfs: Finish off rename of netfs_read_request to netfs_io_request

2022-03-08 Thread David Howells
Adjust helper function names and comments after mass rename of struct netfs_read_*request to struct netfs_io_*request. Changes === ver #2) - Make the changes in the docs also. Signed-off-by: David Howells cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/164622992433.3564931.66

[Linux-cachefs] [PATCH v2 03/19] netfs: Rename netfs_read_*request to netfs_io_*request

2022-03-08 Thread David Howells
Rename netfs_read_*request to netfs_io_*request so that the same structures can be used for the write helpers too. perl -p -i -e 's/netfs_read_(request|subrequest)/netfs_io_$1/g' \ `git grep -l 'netfs_read_\(sub\|\)request'` perl -p -i -e 's/nr_rd_ops/nr_outstanding/g' \ `git grep -l nr_rd_o

[Linux-cachefs] [PATCH v2 02/19] netfs: Generate enums from trace symbol mapping lists

2022-03-08 Thread David Howells
netfs has a number of lists of symbols for use in tracing, listed in an enum and then listed again in a symbol->string mapping for use with __print_symbolic(). This is, however, redundant. Instead, use the symbol->string mapping list to also generate the enum where the enum is in the same file.

[Linux-cachefs] [PATCH v2 01/19] fscache: export fscache_end_operation()

2022-03-08 Thread David Howells
From: Jeffle Xu Export fscache_end_operation() to avoid code duplication. Besides, considering the paired fscache_begin_read_operation() is already exported, it shall make sense to also export fscache_end_operation(). Signed-off-by: Jeffle Xu Signed-off-by: David Howells cc: linux-cachefs@red

[Linux-cachefs] [PATCH v2 00/19] netfs: Prep for write helpers

2022-03-08 Thread David Howells
Having had a go at implementing write helpers and content encryption support in netfslib, it seems that the netfs_read_{,sub}request structs and the equivalent write request structs were almost the same and so should be merged, thereby requiring only one set of alloc/get/put functions and a commo

[Linux-cachefs] [PATCH] cachefiles: Fix volume coherency attribute

2022-03-08 Thread David Howells
A network filesystem may set coherency data on a volume cookie, and if given, cachefiles will store this in an xattr on the directory in the cache corresponding to the volume. The function that sets the xattr just stores the contents of the volume coherency buffer directly into the xattr, with not