[PATCH v12 0/5] netfs, cachefiles: Changes for next, primarily occupancy tracking-related

David Howells posted 5 patches 2 weeks ago
fs/afs/file.c                     |   1 -
fs/cachefiles/interface.c         |  90 ++----
fs/cachefiles/internal.h          |  14 +-
fs/cachefiles/io.c                | 461 +++++++++++++++++++-----------
fs/cachefiles/namei.c             |  34 +--
fs/cachefiles/xattr.c             |  82 +++++-
fs/netfs/buffered_read.c          | 188 +++++++-----
fs/netfs/buffered_write.c         |   3 -
fs/netfs/internal.h               |   2 +
fs/netfs/objects.c                |   1 +
fs/netfs/read_retry.c             |   2 +
fs/netfs/read_single.c            |  40 +--
fs/netfs/write_collect.c          | 132 +++++++--
fs/netfs/write_issue.c            |  18 ++
fs/netfs/write_retry.c            |   3 +
include/linux/fscache.h           |  17 ++
include/linux/netfs.h             |  38 ++-
include/trace/events/cachefiles.h |  51 +++-
include/trace/events/netfs.h      |  11 +-
19 files changed, 785 insertions(+), 403 deletions(-)
[PATCH v12 0/5] netfs, cachefiles: Changes for next, primarily occupancy tracking-related
Posted by David Howells 2 weeks ago
Hi Christian,

Could you pull these patches please into your vfs-7.4.netfs branch?  This
is the second of four batches, in this case dealing with cachefiles, and is
based upon the aforementioned branch.  This was split from v11 of a larger
netfslib series[1].

Cachefiles is modified to better implement caching for the class of files
that are opened new/truncated, written once sequentially with no seeking
and then closed (ie. the most common class):

 (1) The object type in the cachefiles file xattr is now correctly set to
     CACHEFILES_CONTENT_{SINGLE,ALL,BACKFS_MAP} rather than just being 0,
     to indicate whether we have one of: a single monolithic blob, all the
     data up to cache i_size with no holes or a sparse file with the data
     mapped by the backing file system (as currently upstream).

 (2) For "ALL" type files, the cache's i_size is used to track how much
     data is saved in the cache and no longer bears any relation to the
     netfs i_size.  The actual object size is stored in the xattr.

 (3) For most typical files which are contiguous and written progressively,
     the object type is now set to "ALL".  For anything else, cachefiles
     uses SEEK_DATA/HOLE to find extent outlines at before (this is the
     current behaviour and needs to be fixed, but in a separate set of
     patches as it's not trivial).

 (4) Reads of "ALL" type files can then skip the SEEK_DATA/HOLE step to
     determine the occupancy; backing file i_size and the object size field
     stored in the state xattr suffice.

Other changes are also made:

 (1) cachefile_do_prepare_read() is merged into cachefiles_prepare_read()
     now that the ondemand mode stuff got removed.

 (2) Some extra traces are added for write failure and insufficient space.

 (3) The state xattr on a cachefile is pre-set to try to avoid having to
     deal with ENOSPC from setxattr when committing the object.

The patches can also be found here:

	https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=netfs-next-2

Thanks,
David

Changes
=======

ver #12)
- Split from v11 of "netfs: Keep track of folios in a segmented bio_vec[]
  chain"[1]

[1] https://lore.kernel.org/r/20260902173350.3468672-1-dhowells@redhat.com/

David Howells (5):
  cachefiles: Clean up cachefiles_do_prepare_read()
  netfs, cachefiles: Add a couple of traces for write failure
  cachefiles: Add a tracepoint to log insufficient space errors
  cachefiles: Don't rely on backing fs storage map for most use cases
  cachefiles: Preset the state xattr when creating a new file

 fs/afs/file.c                     |   1 -
 fs/cachefiles/interface.c         |  90 ++----
 fs/cachefiles/internal.h          |  14 +-
 fs/cachefiles/io.c                | 461 +++++++++++++++++++-----------
 fs/cachefiles/namei.c             |  34 +--
 fs/cachefiles/xattr.c             |  82 +++++-
 fs/netfs/buffered_read.c          | 188 +++++++-----
 fs/netfs/buffered_write.c         |   3 -
 fs/netfs/internal.h               |   2 +
 fs/netfs/objects.c                |   1 +
 fs/netfs/read_retry.c             |   2 +
 fs/netfs/read_single.c            |  40 +--
 fs/netfs/write_collect.c          | 132 +++++++--
 fs/netfs/write_issue.c            |  18 ++
 fs/netfs/write_retry.c            |   3 +
 include/linux/fscache.h           |  17 ++
 include/linux/netfs.h             |  38 ++-
 include/trace/events/cachefiles.h |  51 +++-
 include/trace/events/netfs.h      |  11 +-
 19 files changed, 785 insertions(+), 403 deletions(-)
Re: [PATCH v12 0/5] netfs, cachefiles: Changes for next, primarily occupancy tracking-related
Posted by Christian Brauner 15 minutes ago
On Thu, 10 Sep 2026 23:02:35 +0100, David Howells wrote:
> netfs, cachefiles: Changes for next, primarily occupancy tracking-related
> 
> Hi Christian,
> 
> Could you pull these patches please into your vfs-7.4.netfs branch?  This
> is the second of four batches, in this case dealing with cachefiles, and is
> based upon the aforementioned branch.  This was split from v11 of a larger
> netfslib series[1].
> 
> [...]

Applied to the vfs-7.4.netfs branch of the vfs/vfs.git tree.
Patches in the vfs-7.4.netfs branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-7.4.netfs

[1/5] cachefiles: Clean up cachefiles_do_prepare_read()
      https://git.kernel.org/vfs/vfs/c/c9e86618da69
[2/5] netfs, cachefiles: Add a couple of traces for write failure
      https://git.kernel.org/vfs/vfs/c/4f973d314d59
[3/5] cachefiles: Add a tracepoint to log insufficient space errors
      https://git.kernel.org/vfs/vfs/c/dd79f8c90ea8
[4/5] cachefiles: Don't rely on backing fs storage map for most use cases
      https://git.kernel.org/vfs/vfs/c/c8d890e089a1
[5/5] cachefiles: Preset the state xattr when creating a new file
      https://git.kernel.org/vfs/vfs/c/f96cbb18159f