Skip to content

fscache/cachefiles: some work for on-demand mode

Jingbo Xu lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2cachefiles: don't align the write IO in ondemand modefs/cachefiles/ondemand.c+2 -10 replies
2/2fscache: introduce fscache_begin_wait_operation() helperfs/fscache/io.c include/linux/fscache.h+31 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] fscache/cachefiles: some work for on-demand mode

Hi there's some work to make users of fscache on-demand mode support PAGE_SIZE larger than 4KB (e.g. 16/64KB in aarch64) [1]. I think they may be also useful for other users of fscache/cachefiles.

Strictly speacking, patch 1 is a bug fix though the issue doesn't cause serious harm when erofs doesn't support large PAGE_SIZE (other than 4KB).

__cachefiles_prepare_write() will align the requested file range to PAGE_SIZE boundary. This is reasonable for libnetfs as libnetfs will construct an iter with the aligned file range from the ground.

While for fscache on-demand mode, cachefiles_ondemand_fd_write_iter() is called by the user daemon, and thus it is unexpected to align the file range to PAGE_SIZE boundary, as the iov_iter/kiocb is given by the user daemon. If the given file range is not aligned with the block size of the backing filesystem, let's fail the write directly.

Patch 2 adds a new helper, by which users of fscache on-demand mode could wait for the wrangling of the cache object and then derive the object size (set in cachefiles_ondemand_copen()). fscache_begin_read_operation() is not feasible for this purpose as in this case @want_state is FSCACHE_WANT_PARAMS and it will not wait there for object wrangling when cookie is in FSCACHE_COOKIE_STATE_CREATING state. An example use case of this helper is illustrated in [2].

Any comment is welcomed.

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/

Jingbo Xu (2):
cachefiles: don't align the write IO in ondemand mode
fscache: introduce fscache_begin_wait_operation() helper

 fs/cachefiles/ondemand.c |  3 ++-
 fs/fscache/io.c          |  9 +++++++++
 include/linux/fscache.h  | 22 ++++++++++++++++++++++
 3 files changed, 33 insertions(+), 1 deletion(-)
Signature · 1 line
2.19.1.6.gb485710b