c38f4e96 | 17-Jun-2021 |
David Howells <dhowells@redhat.com> |
netfs: Provide func to copy data to pagecache for buffered write
Provide a netfs write helper, netfs_perform_write() to buffer data to be written in the pagecache and mark the modified folios dirty.
netfs: Provide func to copy data to pagecache for buffered write
Provide a netfs write helper, netfs_perform_write() to buffer data to be written in the pagecache and mark the modified folios dirty.
It will perform "streaming writes" for folios that aren't currently resident, if possible, storing data in partially modified folios that are marked dirty, but not uptodate. It will also tag pages as belonging to fs-specific write groups if so directed by the filesystem.
This is derived from generic_perform_write(), but doesn't use ->write_begin() and ->write_end(), having that logic rolled in instead.
Signed-off-by: David Howells <dhowells@redhat.com> cc: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
show more ...
|
0e0f2dfe | 29-Jun-2021 |
David Howells <dhowells@redhat.com> |
netfs: Dispatch write requests to process a writeback slice
Dispatch one or more write reqeusts to process a writeback slice, where a slice is tailored more to logical block divisions within the fil
netfs: Dispatch write requests to process a writeback slice
Dispatch one or more write reqeusts to process a writeback slice, where a slice is tailored more to logical block divisions within the file (such as crypto blocks, an object layout or cache granules) than the protocol RPC maximum capacity.
The dispatch doesn't happen until throttling allows, at which point the entire writeback slice is processed and queued. A slice may be written to multiple destinations (one or more servers and the local cache) and the writes to each destination might be split up along different lines.
The writeback slice holds the required folios pinned. An iov_iter is provided in netfs_write_request that describes the buffer to be used. This may be part of the pagecache, may have auxiliary padding pages attached or may be a bounce buffer resulting from crypto or compression. Consequently, the filesystem must not twiddle the folio markings directly.
The following API is available to the filesystem:
(1) The ->create_write_requests() method is called to ask the filesystem to create the requests it needs. This is passed the writeback slice to be processed.
(2) The filesystem should then call netfs_create_write_request() to create the requests it needs.
(3) Once a request is initialised, netfs_queue_write_request() can be called to dispatch it asynchronously, if not completed immediately.
(4) netfs_write_request_completed() should be called to note the completion of a request.
(5) netfs_get_write_request() and netfs_put_write_request() are provided to refcount a request. These take constants from the netfs_wreq_trace enum for logging into ftrace.
(6) The ->free_write_request is method is called to ask the filesystem to clean up a request.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
show more ...
|
9ebff83e | 29-Sep-2023 |
David Howells <dhowells@redhat.com> |
netfs: Prep to use folio->private for write grouping and streaming write
Prepare to use folio->private to hold information write grouping and streaming write. These are implemented in the same comm
netfs: Prep to use folio->private for write grouping and streaming write
Prepare to use folio->private to hold information write grouping and streaming write. These are implemented in the same commit as they both make use of folio->private and will be both checked at the same time in several places.
"Write grouping" involves ordering the writeback of groups of writes, such as is needed for ceph snaps. A group is represented by a filesystem-supplied object which must contain a netfs_group struct. This contains just a refcount and a pointer to a destructor.
"Streaming write" is the storage of data in folios that are marked dirty, but not uptodate, to avoid unnecessary reads of data. This is represented by a netfs_folio struct. This contains the offset and length of the modified region plus the otherwise displaced write grouping pointer.
The way folio->private is multiplexed is:
(1) If private is NULL then neither is in operation on a dirty folio.
(2) If private is set, with bit 0 clear, then this points to a group.
(3) If private is set, with bit 0 set, then this points to a netfs_folio struct (with bit 0 AND'ed out).
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
show more ...
|
4fcccc38 | 04-Oct-2023 |
David Howells <dhowells@redhat.com> |
netfs: Make the refcounting of netfs_begin_read() easier to use
Make the refcounting of netfs_begin_read() easier to use by not eating the caller's ref on the netfs_io_request it's given. This make
netfs: Make the refcounting of netfs_begin_read() easier to use
Make the refcounting of netfs_begin_read() easier to use by not eating the caller's ref on the netfs_io_request it's given. This makes it easier to use when we need to look in the request struct after.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
show more ...
|
6ba22d8d | 29-Sep-2023 |
David Howells <dhowells@redhat.com> |
netfs: Make netfs_put_request() handle a NULL pointer
Make netfs_put_request() just return if given a NULL request pointer.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layt
netfs: Make netfs_put_request() handle a NULL pointer
Make netfs_put_request() just return if given a NULL request pointer.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
show more ...
|
16af134c | 09-Feb-2022 |
David Howells <dhowells@redhat.com> |
netfs: Extend the netfs_io_*request structs to handle writes
Modify the netfs_io_request struct to act as a point around which writes can be coordinated. It represents and pins a range of pages tha
netfs: Extend the netfs_io_*request structs to handle writes
Modify the netfs_io_request struct to act as a point around which writes can be coordinated. It represents and pins a range of pages that need writing and a list of regions of dirty data in that range of pages.
If RMW is required, the original data can be downloaded into the bounce buffer, decrypted if necessary, the modifications made, then the modified data can be reencrypted/recompressed and sent back to the server.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
show more ...
|
768ddb1e | 27-May-2022 |
David Howells <dhowells@redhat.com> |
netfs: Limit subrequest by size or number of segments
Limit a subrequest to a maximum size and/or a maximum number of contiguous physical regions. This permits, for instance, an subreq's iterator t
netfs: Limit subrequest by size or number of segments
Limit a subrequest to a maximum size and/or a maximum number of contiguous physical regions. This permits, for instance, an subreq's iterator to be limited to the number of DMA'able segments that a large RDMA request can handle.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
show more ...
|
cae932d3 | 22-Sep-2023 |
David Howells <dhowells@redhat.com> |
netfs: Add func to calculate pagecount/size-limited span of an iterator
Add a function to work out how much of an ITER_BVEC or ITER_XARRAY iterator we can use in a pagecount-limited and size-limited
netfs: Add func to calculate pagecount/size-limited span of an iterator
Add a function to work out how much of an ITER_BVEC or ITER_XARRAY iterator we can use in a pagecount-limited and size-limited span. This will be used, for example, to limit the number of segments in a subrequest to the maximum number of elements that an RDMA transfer can handle.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
show more ...
|
7d828a06 | 22-Sep-2023 |
David Howells <dhowells@redhat.com> |
netfs: Provide tools to create a buffer in an xarray
Provide tools to create a buffer in an xarray, with a function to add new folios with a mark. This will be used to create bounce buffer and can
netfs: Provide tools to create a buffer in an xarray
Provide tools to create a buffer in an xarray, with a function to add new folios with a mark. This will be used to create bounce buffer and can be used more easily to create a list of folios the span of which would require more than a page's worth of bio_vec structs.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
show more ...
|
21d706d5 | 09-Jul-2021 |
David Howells <dhowells@redhat.com> |
netfs: Add support for DIO buffering
Add a bvec array pointer and an iterator to netfs_io_request for either holding a copy of a DIO iterator or a list of all the bits of buffer pointed to by a DIO
netfs: Add support for DIO buffering
Add a bvec array pointer and an iterator to netfs_io_request for either holding a copy of a DIO iterator or a list of all the bits of buffer pointed to by a DIO iterator.
There are two problems: Firstly, if an iovec-class iov_iter is passed to ->read_iter() or ->write_iter(), this cannot be passed directly to kernel_sendmsg() or kernel_recvmsg() as that may cause locking recursion if a fault is generated, so we need to keep track of the pages involved separately.
Secondly, if the I/O is asynchronous, we must copy the iov_iter describing the buffer before returning to the caller as it may be immediately deallocated.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
show more ...
|
92b6cc5d | 26-Sep-2023 |
David Howells <dhowells@redhat.com> |
netfs: Add iov_iters to (sub)requests to describe various buffers
Add three iov_iter structs:
(1) Add an iov_iter (->iter) to the I/O request to describe the unencrypted-side buffer.
(2) Ad
netfs: Add iov_iters to (sub)requests to describe various buffers
Add three iov_iter structs:
(1) Add an iov_iter (->iter) to the I/O request to describe the unencrypted-side buffer.
(2) Add an iov_iter (->io_iter) to the I/O request to describe the encrypted-side I/O buffer. This may be a different size to the buffer in (1).
(3) Add an iov_iter (->io_iter) to the I/O subrequest to describe the part of the I/O buffer for that subrequest.
This will allow future patches to point to a bounce buffer instead for purposes of handling oversize writes, decryption (where we want to save the encrypted data to the cache) and decompression.
These iov_iters persist for the lifetime of the (sub)request, and so can be accessed multiple times without worrying about them being deallocated upon return to the caller.
The network filesystem must appropriately advance the iterator before terminating the request.
Signed-off-by: David Howells <dhowells@redhat.com> cc: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
show more ...
|
46ed60dc | 11-Oct-2023 |
David Howells <dhowells@redhat.com> |
netfs: Implement unbuffered/DIO vs buffered I/O locking
Borrow NFS's direct-vs-buffered I/O locking into netfslib. Similar code is also used in ceph.
Modify it to have the correct checker annotati
netfs: Implement unbuffered/DIO vs buffered I/O locking
Borrow NFS's direct-vs-buffered I/O locking into netfslib. Similar code is also used in ceph.
Modify it to have the correct checker annotations for i_rwsem lock acquisition/release and to return -ERESTARTSYS if waits are interrupted.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
show more ...
|
5f5ce7ba | 25-Feb-2022 |
David Howells <dhowells@redhat.com> |
netfs: Add a ->free_subrequest() op
Add a ->free_subrequest() op so that the netfs can clean up data attached to a subrequest.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff L
netfs: Add a ->free_subrequest() op
Add a ->free_subrequest() op so that the netfs can clean up data attached to a subrequest.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
show more ...
|
cc3cb0a1 | 09-Mar-2022 |
David Howells <dhowells@redhat.com> |
netfs: Allow the netfs to make the io (sub)request alloc larger
Allow the network filesystem to specify extra space to be allocated on the end of the io (sub)request. This allows cifs, for example,
netfs: Allow the netfs to make the io (sub)request alloc larger
Allow the network filesystem to specify extra space to be allocated on the end of the io (sub)request. This allows cifs, for example, to use this space rather than allocating its own cifs_readdata struct.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
show more ...
|
87b57a04 | 04-Mar-2022 |
David Howells <dhowells@redhat.com> |
netfs: Add a procfile to list in-progress requests
Add a procfile, /proc/fs/netfs/requests, to list in-progress netfslib I/O requests.
Signed-off-by: David Howells <dhowells@redhat.com> cc: Jeff La
netfs: Add a procfile to list in-progress requests
Add a procfile, /proc/fs/netfs/requests, to list in-progress netfslib I/O requests.
Signed-off-by: David Howells <dhowells@redhat.com> cc: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org
show more ...
|
7eb5b3e3 | 21-Nov-2023 |
David Howells <dhowells@redhat.com> |
netfs, fscache: Move /proc/fs/fscache to /proc/fs/netfs and put in a symlink
Rename /proc/fs/fscache to "netfs" and make a symlink from fscache to that.
Signed-off-by: David Howells <dhowells@redha
netfs, fscache: Move /proc/fs/fscache to /proc/fs/netfs and put in a symlink
Rename /proc/fs/fscache to "netfs" and make a symlink from fscache to that.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: Christian Brauner <christian@brauner.io> cc: linux-fsdevel@vger.kernel.org cc: linux-cachefs@redhat.com
show more ...
|
4498a8ec | 20-Nov-2023 |
David Howells <dhowells@redhat.com> |
netfs, fscache: Remove ->begin_cache_operation
Remove ->begin_cache_operation() in favour of just calling fscache directly.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layt
netfs, fscache: Remove ->begin_cache_operation
Remove ->begin_cache_operation() in favour of just calling fscache directly.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: Christian Brauner <christian@brauner.io> cc: linux-fsdevel@vger.kernel.org cc: linux-cachefs@redhat.com
show more ...
|
915cd30c | 20-Nov-2023 |
David Howells <dhowells@redhat.com> |
netfs, fscache: Combine fscache with netfs
Now that the fscache code is moved to be colocated with the netfslib code so that they combined into one module, do the combining.
Signed-off-by: David Ho
netfs, fscache: Combine fscache with netfs
Now that the fscache code is moved to be colocated with the netfslib code so that they combined into one module, do the combining.
Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: Christian Brauner <christian@brauner.io> cc: linux-fsdevel@vger.kernel.org cc: linux-cachefs@redhat.com cc: linux-nfs@vger.kernel.org, cc: linux-erofs@lists.ozlabs.org
show more ...
|
f5f82cd1 | 06-Jun-2023 |
David Howells <dhowells@redhat.com> |
Move netfs_extract_iter_to_sg() to lib/scatterlist.c
Move netfs_extract_iter_to_sg() to lib/scatterlist.c as it's going to be used by more than just network filesystems (AF_ALG, for example).
Signe
Move netfs_extract_iter_to_sg() to lib/scatterlist.c
Move netfs_extract_iter_to_sg() to lib/scatterlist.c as it's going to be used by more than just network filesystems (AF_ALG, for example).
Signed-off-by: David Howells <dhowells@redhat.com> cc: Jeff Layton <jlayton@kernel.org> cc: Steve French <sfrench@samba.org> cc: Shyam Prasad N <nspmangalore@gmail.com> cc: Rohith Surabattula <rohiths.msft@gmail.com> cc: Jens Axboe <axboe@kernel.dk> cc: Herbert Xu <herbert@gondor.apana.org.au> cc: "David S. Miller" <davem@davemloft.net> cc: Eric Dumazet <edumazet@google.com> cc: Jakub Kicinski <kuba@kernel.org> cc: Paolo Abeni <pabeni@redhat.com> cc: Matthew Wilcox <willy@infradead.org> cc: linux-crypto@vger.kernel.org cc: linux-cachefs@redhat.com cc: linux-cifs@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: netdev@vger.kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
|
936dc763 | 06-Jun-2023 |
David Howells <dhowells@redhat.com> |
Wrap lines at 80
Wrap a line at 80 to stop checkpatch complaining.
Signed-off-by: David Howells <dhowells@redhat.com> cc: Jeff Layton <jlayton@kernel.org> cc: Steve French <sfrench@samba.org> cc: S
Wrap lines at 80
Wrap a line at 80 to stop checkpatch complaining.
Signed-off-by: David Howells <dhowells@redhat.com> cc: Jeff Layton <jlayton@kernel.org> cc: Steve French <sfrench@samba.org> cc: Shyam Prasad N <nspmangalore@gmail.com> cc: Rohith Surabattula <rohiths.msft@gmail.com> cc: Jens Axboe <axboe@kernel.dk> cc: Herbert Xu <herbert@gondor.apana.org.au> cc: "David S. Miller" <davem@davemloft.net> cc: Eric Dumazet <edumazet@google.com> cc: Jakub Kicinski <kuba@kernel.org> cc: Paolo Abeni <pabeni@redhat.com> cc: Matthew Wilcox <willy@infradead.org> cc: Simon Horman <simon.horman@corigine.com> cc: linux-crypto@vger.kernel.org cc: linux-cachefs@redhat.com cc: linux-cifs@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: netdev@vger.kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
|
3b9e9f72 | 06-Jun-2023 |
David Howells <dhowells@redhat.com> |
Fix a couple of spelling mistakes
Fix a couple of spelling mistakes in a comment.
Suggested-by: Simon Horman <simon.horman@corigine.com> Link: https://lore.kernel.org/r/ZHH2mSRqeL4Gs1ft@corigine.co
Fix a couple of spelling mistakes
Fix a couple of spelling mistakes in a comment.
Suggested-by: Simon Horman <simon.horman@corigine.com> Link: https://lore.kernel.org/r/ZHH2mSRqeL4Gs1ft@corigine.com/ Link: https://lore.kernel.org/r/ZHH1nqZWOGzxlidT@corigine.com/ Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> cc: Jeff Layton <jlayton@kernel.org> cc: Steve French <sfrench@samba.org> cc: Shyam Prasad N <nspmangalore@gmail.com> cc: Rohith Surabattula <rohiths.msft@gmail.com> cc: Jens Axboe <axboe@kernel.dk> cc: Herbert Xu <herbert@gondor.apana.org.au> cc: "David S. Miller" <davem@davemloft.net> cc: Eric Dumazet <edumazet@google.com> cc: Jakub Kicinski <kuba@kernel.org> cc: Paolo Abeni <pabeni@redhat.com> cc: Matthew Wilcox <willy@infradead.org> cc: linux-crypto@vger.kernel.org cc: linux-cachefs@redhat.com cc: linux-cifs@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: netdev@vger.kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
show more ...
|