Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lklfuse: add copy_file_range and lseek hooks #576

Merged
merged 2 commits into from
Feb 28, 2025

Conversation

ddiss
Copy link

@ddiss ddiss commented Feb 28, 2025

These hooks are helpful for copy optimization (reflinks) and sparse file navigation via SEEK_DATA/SEEK_HOLE.

The following changes since commit 8807976c92921521f57cae23a116aa333caa954c:

  Merge pull request #572 from miaomingc/miaomingc-patch-1 (2025-02-25 08:27:26 -0800)

are available in the Git repository at:

  https://github.com/ddiss/linux lklfuse_cfr_lseek

for you to fetch changes up to 727e89615818e146bf3380cc7127e19cf545b259:

  lklfuse: add lseek hook (2025-02-28 21:09:50 +1100)

----------------------------------------------------------------
David Disseldorp (2):
      lklfuse: add copy_file_range hook
      lklfuse: add lseek hook

 tools/lkl/lklfuse.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

The copy_file_range() syscall allows filesystems to optimize a copy
workload by using reflinks or server-side offload. It can be triggered
via e.g.
	xfs_io -f -c "copy_range copysrc" copydest

Without this hook, (kernel) fuse currently falls back to manual
read/write via splice_copy_file_range().

Signed-off-by: David Disseldorp <[email protected]>
This allows for SEEK_HOLE / SEEK_DATA, e.g.
/run/lklfuse-sda# xfs_io -f ./seekme
xfs_io> truncate 1M
xfs_io> statx -m all
  fd.path = "./seekme"
  fd.flags = non-sync,non-direct,read-write
  stat.ino = 136
  stat.type = regular file
  stat.size = 1048576
  stat.blocks = 0
  xfs_io> pwrite 100K 1k
  wrote 1024/1024 bytes at offset 102400
  1 KiB, 1 ops; 0.0002 sec (3.439 MiB/sec and 3521.1268 ops/sec)
  xfs_io> pwrite 512K 1k
  wrote 1024/1024 bytes at offset 524288
  1 KiB, 1 ops; 0.0002 sec (4.585 MiB/sec and 4694.8357 ops/sec)
  xfs_io> seek -d 0
  Whence  Result
  DATA    102400
  xfs_io> seek -h 102400
  Whence  Result
  HOLE    106496
  xfs_io> seek -d 106496
  Whence  Result
  DATA    524288

Signed-off-by: David Disseldorp <[email protected]>
@tavip
Copy link
Member

tavip commented Feb 28, 2025

Both checks failures are unrelated and we tracking them in #574 and #577

@tavip tavip merged commit cf50eae into lkl:master Feb 28, 2025
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants