1. 01 May, 2024 25 commits
    • David Howells's avatar
      cifs: Add mempools for cifs_io_request and cifs_io_subrequest structs · edea94a6
      David Howells authored
      Add mempools for the allocation of cifs_io_request and cifs_io_subrequest
      structs for netfslib to use so that it can guarantee eventual allocation in
      writeback.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Steve French <sfrench@samba.org>
      cc: Shyam Prasad N <nspmangalore@gmail.com>
      cc: Rohith Surabattula <rohiths.msft@gmail.com>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: linux-cifs@vger.kernel.org
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      cc: linux-mm@kvack.org
      edea94a6
    • David Howells's avatar
      cifs: Set zero_point in the copy_file_range() and remap_file_range() · 3758c485
      David Howells authored
      Set zero_point in the copy_file_range() and remap_file_range()
      implementations so that we don't skip reading data modified on a
      server-side copy.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Steve French <sfrench@samba.org>
      cc: Shyam Prasad N <nspmangalore@gmail.com>
      cc: Rohith Surabattula <rohiths.msft@gmail.com>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: linux-cifs@vger.kernel.org
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      cc: linux-mm@kvack.org
      3758c485
    • David Howells's avatar
      cifs: Move cifs_loose_read_iter() and cifs_file_write_iter() to file.c · 1a5b4edd
      David Howells authored
      Move cifs_loose_read_iter() and cifs_file_write_iter() to file.c so that
      they are colocated with similar functions rather than being split with
      cifsfs.c.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Steve French <sfrench@samba.org>
      cc: Shyam Prasad N <nspmangalore@gmail.com>
      cc: Rohith Surabattula <rohiths.msft@gmail.com>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: linux-cifs@vger.kernel.org
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      cc: linux-mm@kvack.org
      1a5b4edd
    • David Howells's avatar
      cifs: Replace the writedata replay bool with a netfs sreq flag · dc5939de
      David Howells authored
      Replace the 'replay' bool in cifs_writedata (now cifs_io_subrequest) with a
      flag in the netfs_io_subrequest flags.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Steve French <sfrench@samba.org>
      cc: Shyam Prasad N <nspmangalore@gmail.com>
      cc: Rohith Surabattula <rohiths.msft@gmail.com>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: linux-cifs@vger.kernel.org
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      cc: linux-mm@kvack.org
      dc5939de
    • David Howells's avatar
      cifs: Make wait_mtu_credits take size_t args · 56257334
      David Howells authored
      Make the wait_mtu_credits functions use size_t for the size and num
      arguments rather than unsigned int as netfslib uses size_t/ssize_t for
      arguments and return values to allow for extra capacity.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Steve French <sfrench@samba.org>
      cc: Shyam Prasad N <nspmangalore@gmail.com>
      cc: Rohith Surabattula <rohiths.msft@gmail.com>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: linux-cifs@vger.kernel.org
      cc: linux-cachefs@redhat.com
      cc: netfs@lists.linux.dev
      cc: linux-mm@kvack.org
      56257334
    • David Howells's avatar
      cifs: Use more fields from netfs_io_subrequest · ab58fbde
      David Howells authored
      Use more fields from netfs_io_subrequest instead of those incorporated into
      cifs_io_subrequest from cifs_readdata and cifs_writedata.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Steve French <sfrench@samba.org>
      cc: Shyam Prasad N <nspmangalore@gmail.com>
      cc: Rohith Surabattula <rohiths.msft@gmail.com>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: linux-cifs@vger.kernel.org
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      cc: linux-mm@kvack.org
      ab58fbde
    • David Howells's avatar
      cifs: Replace cifs_writedata with a wrapper around netfs_io_subrequest · a975a2f2
      David Howells authored
      Replace the cifs_writedata struct with the same wrapper around
      netfs_io_subrequest that was used to replace cifs_readdata.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Steve French <sfrench@samba.org>
      cc: Shyam Prasad N <nspmangalore@gmail.com>
      cc: Rohith Surabattula <rohiths.msft@gmail.com>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: linux-cifs@vger.kernel.org
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      cc: linux-mm@kvack.org
      a975a2f2
    • David Howells's avatar
      cifs: Replace cifs_readdata with a wrapper around netfs_io_subrequest · 753b67eb
      David Howells authored
      Netfslib has a facility whereby the allocation for netfs_io_subrequest can
      be increased to so that filesystem-specific data can be tagged on the end.
      
      Prepare to use this by making a struct, cifs_io_subrequest, that wraps
      netfs_io_subrequest, and absorb struct cifs_readdata into it.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Steve French <sfrench@samba.org>
      cc: Shyam Prasad N <nspmangalore@gmail.com>
      cc: Rohith Surabattula <rohiths.msft@gmail.com>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: linux-cifs@vger.kernel.org
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      cc: linux-mm@kvack.org
      753b67eb
    • David Howells's avatar
      cifs: Use alternative invalidation to using launder_folio · 0f7c0f3f
      David Howells authored
      Use writepages-based flushing invalidation instead of
      invalidate_inode_pages2() and ->launder_folio().  This will allow
      ->launder_folio() to be removed eventually.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Steve French <sfrench@samba.org>
      cc: Shyam Prasad N <nspmangalore@gmail.com>
      cc: Rohith Surabattula <rohiths.msft@gmail.com>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: linux-cifs@vger.kernel.org
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      0f7c0f3f
    • David Howells's avatar
      netfs, afs: Use writeback retry to deal with alternate keys · 1ecb146f
      David Howells authored
      Use a hook in the new writeback code's retry algorithm to rotate the keys
      once all the outstanding subreqs have failed rather than doing it
      separately on each subreq.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      1ecb146f
    • David Howells's avatar
      netfs: Miscellaneous tidy ups · d41ca44c
      David Howells authored
      Do a couple of miscellaneous tidy ups:
      
       (1) Add a qualifier into a file banner comment.
      
       (2) Put the writeback folio traces back into alphabetical order.
      
       (3) Remove some unused folio traces.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      d41ca44c
    • David Howells's avatar
      netfs: Remove the old writeback code · c2458685
      David Howells authored
      Remove the old writeback code.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: Eric Van Hensbergen <ericvh@kernel.org>
      cc: Latchesar Ionkov <lucho@ionkov.net>
      cc: Dominique Martinet <asmadeus@codewreck.org>
      cc: Christian Schoenebeck <linux_oss@crudebyte.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: v9fs@lists.linux.dev
      cc: linux-afs@lists.infradead.org
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      c2458685
    • David Howells's avatar
      netfs: Cut over to using new writeback code · 2df86547
      David Howells authored
      Cut over to using the new writeback code.  The old code is #ifdef'd out or
      otherwise removed from compilation to avoid conflicts and will be removed
      in a future patch.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      cc: Eric Van Hensbergen <ericvh@kernel.org>
      cc: Latchesar Ionkov <lucho@ionkov.net>
      cc: Dominique Martinet <asmadeus@codewreck.org>
      cc: Christian Schoenebeck <linux_oss@crudebyte.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: v9fs@lists.linux.dev
      cc: linux-afs@lists.infradead.org
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      2df86547
    • David Howells's avatar
      netfs, cachefiles: Implement helpers for new write code · 64e64e6c
      David Howells authored
      Implement the helpers for the new write code in cachefiles.  There's now an
      optional ->prepare_write() that allows the filesystem to set the parameters
      for the next write, such as maximum size and maximum segment count, and an
      ->issue_write() that is called to initiate an (asynchronous) write
      operation.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      cc: netfs@lists.linux.dev
      cc: linux-erofs@lists.ozlabs.org
      cc: linux-fsdevel@vger.kernel.org
      64e64e6c
    • David Howells's avatar
      netfs, 9p: Implement helpers for new write code · 5fb70e72
      David Howells authored
      Implement the helpers for the new write code in 9p.  There's now an
      optional ->prepare_write() that allows the filesystem to set the parameters
      for the next write, such as maximum size and maximum segment count, and an
      ->issue_write() that is called to initiate an (asynchronous) write
      operation.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      cc: Eric Van Hensbergen <ericvh@kernel.org>
      cc: Latchesar Ionkov <lucho@ionkov.net>
      cc: Dominique Martinet <asmadeus@codewreck.org>
      cc: Christian Schoenebeck <linux_oss@crudebyte.com>
      cc: v9fs@lists.linux.dev
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      5fb70e72
    • David Howells's avatar
      netfs, afs: Implement helpers for new write code · ed22e1db
      David Howells authored
      Implement the helpers for the new write code in afs.  There's now an
      optional ->prepare_write() that allows the filesystem to set the parameters
      for the next write, such as maximum size and maximum segment count, and an
      ->issue_write() that is called to initiate an (asynchronous) write
      operation.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      ed22e1db
    • David Howells's avatar
      netfs: Add some write-side stats and clean up some stat names · 4824e591
      David Howells authored
      Add some write-side stats to count buffered writes, buffered writethrough,
      and writepages calls.
      
      Whilst we're at it, clean up the naming on some of the existing stats
      counters and organise the output into two sets.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      4824e591
    • David Howells's avatar
      netfs: New writeback implementation · 288ace2f
      David Howells authored
      The current netfslib writeback implementation creates writeback requests of
      contiguous folio data and then separately tiles subrequests over the space
      twice, once for the server and once for the cache.  This creates a few
      issues:
      
       (1) Every time there's a discontiguity or a change between writing to only
           one destination or writing to both, it must create a new request.
           This makes it harder to do vectored writes.
      
       (2) The folios don't have the writeback mark removed until the end of the
           request - and a request could be hundreds of megabytes.
      
       (3) In future, I want to support a larger cache granularity, which will
           require aggregation of some folios that contain unmodified data (which
           only need to go to the cache) and some which contain modifications
           (which need to be uploaded and stored to the cache) - but, currently,
           these are treated as discontiguous.
      
      There's also a move to get everyone to use writeback_iter() to extract
      writable folios from the pagecache.  That said, currently writeback_iter()
      has some issues that make it less than ideal:
      
       (1) there's no way to cancel the iteration, even if you find a "temporary"
           error that means the current folio and all subsequent folios are going
           to fail;
      
       (2) there's no way to filter the folios being written back - something
           that will impact Ceph with it's ordered snap system;
      
       (3) and if you get a folio you can't immediately deal with (say you need
           to flush the preceding writes), you are left with a folio hanging in
           the locked state for the duration, when really we should unlock it and
           relock it later.
      
      In this new implementation, I use writeback_iter() to pump folios,
      progressively creating two parallel, but separate streams and cleaning up
      the finished folios as the subrequests complete.  Either or both streams
      can contain gaps, and the subrequests in each stream can be of variable
      size, don't need to align with each other and don't need to align with the
      folios.
      
      Indeed, subrequests can cross folio boundaries, may cover several folios or
      a folio may be spanned by multiple folios, e.g.:
      
               +---+---+-----+-----+---+----------+
      Folios:  |   |   |     |     |   |          |
               +---+---+-----+-----+---+----------+
      
                 +------+------+     +----+----+
      Upload:    |      |      |.....|    |    |
                 +------+------+     +----+----+
      
               +------+------+------+------+------+
      Cache:   |      |      |      |      |      |
               +------+------+------+------+------+
      
      The progressive subrequest construction permits the algorithm to be
      preparing both the next upload to the server and the next write to the
      cache whilst the previous ones are already in progress.  Throttling can be
      applied to control the rate of production of subrequests - and, in any
      case, we probably want to write them to the server in ascending order,
      particularly if the file will be extended.
      
      Content crypto can also be prepared at the same time as the subrequests and
      run asynchronously, with the prepped requests being stalled until the
      crypto catches up with them.  This might also be useful for transport
      crypto, but that happens at a lower layer, so probably would be harder to
      pull off.
      
      The algorithm is split into three parts:
      
       (1) The issuer.  This walks through the data, packaging it up, encrypting
           it and creating subrequests.  The part of this that generates
           subrequests only deals with file positions and spans and so is usable
           for DIO/unbuffered writes as well as buffered writes.
      
       (2) The collector. This asynchronously collects completed subrequests,
           unlocks folios, frees crypto buffers and performs any retries.  This
           runs in a work queue so that the issuer can return to the caller for
           writeback (so that the VM can have its kswapd thread back) or async
           writes.
      
       (3) The retryer.  This pauses the issuer, waits for all outstanding
           subrequests to complete and then goes through the failed subrequests
           to reissue them.  This may involve reprepping them (with cifs, the
           credits must be renegotiated, and a subrequest may need splitting),
           and doing RMW for content crypto if there's a conflicting change on
           the server.
      
      [!] Note that some of the functions are prefixed with "new_" to avoid
      clashes with existing functions.  These will be renamed in a later patch
      that cuts over to the new algorithm.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      cc: Eric Van Hensbergen <ericvh@kernel.org>
      cc: Latchesar Ionkov <lucho@ionkov.net>
      cc: Dominique Martinet <asmadeus@codewreck.org>
      cc: Christian Schoenebeck <linux_oss@crudebyte.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: v9fs@lists.linux.dev
      cc: linux-afs@lists.infradead.org
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      288ace2f
    • David Howells's avatar
      netfs: Switch to using unsigned long long rather than loff_t · 7ba167c4
      David Howells authored
      Switch to using unsigned long long rather than loff_t in netfslib to avoid
      problems with the sign flipping in the maths when we're dealing with the
      byte at position 0x7fffffffffffffff.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      cc: Ilya Dryomov <idryomov@gmail.com>
      cc: Xiubo Li <xiubli@redhat.com>
      cc: netfs@lists.linux.dev
      cc: ceph-devel@vger.kernel.org
      cc: linux-fsdevel@vger.kernel.org
      7ba167c4
    • David Howells's avatar
      mm: Export writeback_iter() · 5a550a0c
      David Howells authored
      Export writeback_iter() so that it can be used by netfslib as a module.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      cc: Christoph Hellwig <hch@lst.de>
      cc: linux-mm@kvack.org
      5a550a0c
    • David Howells's avatar
      netfs: Use mempools for allocating requests and subrequests · d9f85a04
      David Howells authored
      Use mempools for allocating requests and subrequests in an effort to make
      sure that allocation always succeeds so that when performing writeback we
      can always make progress.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      cc: linux-mm@kvack.org
      d9f85a04
    • David Howells's avatar
      netfs: Remove ->launder_folio() support · b4ff7b17
      David Howells authored
      Remove support for ->launder_folio() from netfslib and expect filesystems
      to use filemap_invalidate_inode() instead.  netfs_launder_folio() can then
      be got rid of.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      cc: Eric Van Hensbergen <ericvh@kernel.org>
      cc: Latchesar Ionkov <lucho@ionkov.net>
      cc: Dominique Martinet <asmadeus@codewreck.org>
      cc: Christian Schoenebeck <linux_oss@crudebyte.com>
      cc: David Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: Steve French <sfrench@samba.org>
      cc: Matthew Wilcox <willy@infradead.org>
      cc: linux-mm@kvack.org
      cc: linux-fsdevel@vger.kernel.org
      cc: netfs@lists.linux.dev
      cc: v9fs@lists.linux.dev
      cc: linux-afs@lists.infradead.org
      cc: ceph-devel@vger.kernel.org
      cc: linux-cifs@vger.kernel.org
      cc: devel@lists.orangefs.org
      b4ff7b17
    • David Howells's avatar
      afs: Use alternative invalidation to using launder_folio · d73065e6
      David Howells authored
      Use writepages-based flushing invalidation instead of
      invalidate_inode_pages2() and ->launder_folio().  This will allow
      ->launder_folio() to be removed eventually.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: linux-afs@lists.infradead.org
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      d73065e6
    • David Howells's avatar
      9p: Use alternative invalidation to using launder_folio · 40fb4828
      David Howells authored
      Use writepages-based flushing invalidation instead of
      invalidate_inode_pages2() and ->launder_folio().  This will allow
      ->launder_folio() to be removed eventually.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Eric Van Hensbergen <ericvh@kernel.org>
      cc: Latchesar Ionkov <lucho@ionkov.net>
      cc: Dominique Martinet <asmadeus@codewreck.org>
      cc: Christian Schoenebeck <linux_oss@crudebyte.com>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: v9fs@lists.linux.dev
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      40fb4828
    • David Howells's avatar
      mm: Provide a means of invalidation without using launder_folio · 74e797d7
      David Howells authored
      Implement a replacement for launder_folio.  The key feature of
      invalidate_inode_pages2() is that it locks each folio individually, unmaps
      it to prevent mmap'd accesses interfering and calls the ->launder_folio()
      address_space op to flush it.  This has problems: firstly, each folio is
      written individually as one or more small writes; secondly, adjacent folios
      cannot be added so easily into the laundry; thirdly, it's yet another op to
      implement.
      
      Instead, use the invalidate lock to cause anyone wanting to add a folio to
      the inode to wait, then unmap all the folios if we have mmaps, then,
      conditionally, use ->writepages() to flush any dirty data back and then
      discard all pages.
      
      The invalidate lock prevents ->read_iter(), ->write_iter() and faulting
      through mmap all from adding pages for the duration.
      
      This is then used from netfslib to handle the flusing in unbuffered and
      direct writes.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Matthew Wilcox <willy@infradead.org>
      cc: Miklos Szeredi <miklos@szeredi.hu>
      cc: Trond Myklebust <trond.myklebust@hammerspace.com>
      cc: Christoph Hellwig <hch@lst.de>
      cc: Andrew Morton <akpm@linux-foundation.org>
      cc: Alexander Viro <viro@zeniv.linux.org.uk>
      cc: Christian Brauner <brauner@kernel.org>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: linux-mm@kvack.org
      cc: linux-fsdevel@vger.kernel.org
      cc: netfs@lists.linux.dev
      cc: v9fs@lists.linux.dev
      cc: linux-afs@lists.infradead.org
      cc: ceph-devel@vger.kernel.org
      cc: linux-cifs@vger.kernel.org
      cc: linux-nfs@vger.kernel.org
      cc: devel@lists.orangefs.org
      74e797d7
  2. 29 Apr, 2024 6 commits
    • David Howells's avatar
      netfs: Use subreq_counter to allocate subreq debug_index values · 120b8781
      David Howells authored
      Use the subreq_counter in netfs_io_request to allocate subrequest
      debug_index values in read ops as well as write ops.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      120b8781
    • David Howells's avatar
      netfs: Make netfs_io_request::subreq_counter an atomic_t · 93bf1cc0
      David Howells authored
      Make the netfs_io_request::subreq_counter, used to generate values for
      netfs_io_subrequest::debug_index, into an atomic_t so that it can be called
      from the retry thread at the same time as the app thread issuing writes.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      93bf1cc0
    • David Howells's avatar
      netfs: Remove deprecated use of PG_private_2 as a second writeback flag · ae678317
      David Howells authored
      Remove the deprecated use of PG_private_2 in netfslib.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      cc: linux-cachefs@redhat.com
      cc: linux-fsdevel@vger.kernel.org
      cc: linux-mm@kvack.org
      ae678317
    • David Howells's avatar
      mm: Remove the PG_fscache alias for PG_private_2 · 2e9d7e4b
      David Howells authored
      Remove the PG_fscache alias for PG_private_2 and use the latter directly.
      Use of this flag for marking pages undergoing writing to the cache should
      be considered deprecated and the folios should be marked dirty instead and
      the write done in ->writepages().
      
      Note that PG_private_2 itself should be considered deprecated and up for
      future removal by the MM folks too.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      cc: Ilya Dryomov <idryomov@gmail.com>
      cc: Xiubo Li <xiubli@redhat.com>
      cc: Steve French <sfrench@samba.org>
      cc: Paulo Alcantara <pc@manguebit.com>
      cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>
      cc: Shyam Prasad N <sprasad@microsoft.com>
      cc: Tom Talpey <tom@talpey.com>
      cc: Bharath SM <bharathsm@microsoft.com>
      cc: Trond Myklebust <trond.myklebust@hammerspace.com>
      cc: Anna Schumaker <anna@kernel.org>
      cc: netfs@lists.linux.dev
      cc: ceph-devel@vger.kernel.org
      cc: linux-cifs@vger.kernel.org
      cc: linux-nfs@vger.kernel.org
      cc: linux-fsdevel@vger.kernel.org
      cc: linux-mm@kvack.org
      2e9d7e4b
    • David Howells's avatar
      netfs: Replace PG_fscache by setting folio->private and marking dirty · 2ff1e975
      David Howells authored
      When dirty data is being written to the cache, setting/waiting on/clearing
      the fscache flag is always done in tandem with setting/waiting on/clearing
      the writeback flag.  The netfslib buffered write routines wait on and set
      both flags and the write request cleanup clears both flags, so the fscache
      flag is almost superfluous.
      
      The reason it isn't superfluous is because the fscache flag is also used to
      indicate that data just read from the server is being written to the cache.
      The flag is used to prevent a race involving overlapping direct-I/O writes
      to the cache.
      
      Change this to indicate that a page is in need of being copied to the cache
      by placing a magic value in folio->private and marking the folios dirty.
      Then when the writeback code sees a folio marked in this way, it only
      writes it to the cache and not to the server.
      
      If a folio that has this magic value set is modified, the value is just
      replaced and the folio will then be uplodaded too.
      
      With this, PG_fscache is no longer required by the netfslib core, 9p and
      afs.
      
      Ceph and nfs, however, still need to use the old PG_fscache-based tracking.
      To deal with this, a flag, NETFS_ICTX_USE_PGPRIV2, now has to be set on the
      flags in the netfs_inode struct for those filesystems.  This reenables the
      use of PG_fscache in that inode.  9p and afs use the netfslib write helpers
      so get switched over; cifs, for the moment, does page-by-page manual access
      to the cache, so doesn't use PG_fscache and is unaffected.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      cc: Matthew Wilcox (Oracle) <willy@infradead.org>
      cc: Eric Van Hensbergen <ericvh@kernel.org>
      cc: Latchesar Ionkov <lucho@ionkov.net>
      cc: Dominique Martinet <asmadeus@codewreck.org>
      cc: Christian Schoenebeck <linux_oss@crudebyte.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: Ilya Dryomov <idryomov@gmail.com>
      cc: Xiubo Li <xiubli@redhat.com>
      cc: Steve French <sfrench@samba.org>
      cc: Paulo Alcantara <pc@manguebit.com>
      cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>
      cc: Shyam Prasad N <sprasad@microsoft.com>
      cc: Tom Talpey <tom@talpey.com>
      cc: Bharath SM <bharathsm@microsoft.com>
      cc: Trond Myklebust <trond.myklebust@hammerspace.com>
      cc: Anna Schumaker <anna@kernel.org>
      cc: netfs@lists.linux.dev
      cc: v9fs@lists.linux.dev
      cc: linux-afs@lists.infradead.org
      cc: ceph-devel@vger.kernel.org
      cc: linux-cifs@vger.kernel.org
      cc: linux-nfs@vger.kernel.org
      cc: linux-fsdevel@vger.kernel.org
      cc: linux-mm@kvack.org
      2ff1e975
    • David Howells's avatar
      netfs: Update i_blocks when write committed to pagecache · 5f24162f
      David Howells authored
      Update i_blocks when i_size is updated when we finish making a write to the
      pagecache to reflect the amount of space we think will be consumed.
      
      This maintains cifs commit dbfdff40 ("smb3:
      update allocation size more accurately on write completion") which would
      otherwise be removed by the cifs part of the netfs writeback rewrite.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeff 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: linux-cifs@vger.kernel.org
      cc: netfs@lists.linux.dev
      cc: linux-fsdevel@vger.kernel.org
      cc: linux-mm@kvack.org
      5f24162f
  3. 28 Apr, 2024 6 commits
  4. 27 Apr, 2024 3 commits
    • Linus Torvalds's avatar
      Merge tag 'rust-fixes-6.9' of https://github.com/Rust-for-Linux/linux · 2c815938
      Linus Torvalds authored
      Pull Rust fixes from Miguel Ojeda:
      
       - Soundness: make internal functions generated by the 'module!' macro
         inaccessible, do not implement 'Zeroable' for 'Infallible' and
         require 'Send' for the 'Module' trait.
      
       - Build: avoid errors with "empty" files and workaround 'rustdoc' ICE.
      
       - Kconfig: depend on '!CFI_CLANG' and avoid selecting 'CONSTRUCTORS'.
      
       - Code docs: remove non-existing key from 'module!' macro example.
      
       - Docs: trivial rendering fix in arch table.
      
      * tag 'rust-fixes-6.9' of https://github.com/Rust-for-Linux/linux:
        rust: remove `params` from `module` macro example
        kbuild: rust: force `alloc` extern to allow "empty" Rust files
        kbuild: rust: remove unneeded `@rustc_cfg` to avoid ICE
        rust: kernel: require `Send` for `Module` implementations
        rust: phy: implement `Send` for `Registration`
        rust: make mutually exclusive with CFI_CLANG
        rust: macros: fix soundness issue in `module!` macro
        rust: init: remove impl Zeroable for Infallible
        docs: rust: fix improper rendering in Arch Support page
        rust: don't select CONSTRUCTORS
      2c815938
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-6.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 57865f39
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
      
       - A fix for TASK_SIZE on rv64/NOMMU, to reflect the lack of user/kernel
         separation
      
       - A fix to avoid loading rv64/NOMMU kernel past the start of RAM
      
       - A fix for RISCV_HWPROBE_EXT_ZVFHMIN on ilp32 to avoid signed integer
         overflow in the bitmask
      
       - The sud_test kselftest has been fixed to properly swizzle the syscall
         number into the return register, which are not the same on RISC-V
      
       - A fix for a build warning in the perf tools on rv32
      
       - A fix for the CBO selftests, to avoid non-constants leaking into the
         inline asm
      
       - A pair of fixes for T-Head PBMT errata probing, which has been
         renamed MAE by the vendor
      
      * tag 'riscv-for-linus-6.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        RISC-V: selftests: cbo: Ensure asm operands match constraints, take 2
        perf riscv: Fix the warning due to the incompatible type
        riscv: T-Head: Test availability bit before enabling MAE errata
        riscv: thead: Rename T-Head PBMT to MAE
        selftests: sud_test: return correct emulated syscall value on RISC-V
        riscv: hwprobe: fix invalid sign extension for RISCV_HWPROBE_EXT_ZVFHMIN
        riscv: Fix loading 64-bit NOMMU kernels past the start of RAM
        riscv: Fix TASK_SIZE on 64-bit NOMMU
      57865f39
    • Linus Torvalds's avatar
      Merge tag '6.9-rc5-cifs-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6 · d43df69f
      Linus Torvalds authored
      Pull smb client fixes from Steve French:
       "Three smb3 client fixes, all also for stable:
      
         - two small locking fixes spotted by Coverity
      
         - FILE_ALL_INFO and network_open_info packing fix"
      
      * tag '6.9-rc5-cifs-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6:
        smb3: fix lock ordering potential deadlock in cifs_sync_mid_result
        smb3: missing lock when picking channel
        smb: client: Fix struct_group() usage in __packed structs
      d43df69f