linux/fs/fuse
Richard W.M. Jones 6b1bdb56b1 fuse: allow fallocate(FALLOC_FL_ZERO_RANGE)
The current fuse module filters out fallocate(FALLOC_FL_ZERO_RANGE)
returning -EOPNOTSUPP.  libnbd's nbdfuse would like to translate
FALLOC_FL_ZERO_RANGE requests into the NBD command
NBD_CMD_WRITE_ZEROES which allows NBD servers that support it to do
zeroing efficiently.

This commit treats this flag exactly like FALLOC_FL_PUNCH_HOLE.

A way to test this, requiring fuse >= 3, nbdkit >= 1.8 and the latest
nbdfuse from https://gitlab.com/nbdkit/libnbd/-/tree/master/fuse is to
create a file containing some data and "mirror" it to a fuse file:

  $ dd if=/dev/urandom of=disk.img bs=1M count=1
  $ nbdkit file disk.img
  $ touch mirror.img
  $ nbdfuse mirror.img nbd://localhost &

(mirror.img -> nbdfuse -> NBD over loopback -> nbdkit -> disk.img)

You can then run commands such as:

  $ fallocate -z -o 1024 -l 1024 mirror.img

and check that the content of the original file ("disk.img") stays
synchronized.  To show NBD commands, export LIBNBD_DEBUG=1 before
running nbdfuse.  To clean up:

  $ fusermount3 -u mirror.img
  $ killall nbdkit

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2021-06-22 09:15:36 +02:00
..
acl.c fuse: add a flag FUSE_SETXATTR_ACL_KILL_SGID to kill SGID 2021-04-14 10:40:57 +02:00
control.c fuse: split fuse_mount off of fuse_conn 2020-09-18 15:17:41 +02:00
cuse.c cuse: simplify refcount 2021-04-14 10:40:58 +02:00
dax.c fuse: split fuse_mount off of fuse_conn 2020-09-18 15:17:41 +02:00
dev.c fuse: reject internal errno 2021-06-22 09:15:35 +02:00
dir.c fuse: Switch to fc_mount() for submounts 2021-06-22 09:15:35 +02:00
file.c fuse: allow fallocate(FALLOC_FL_ZERO_RANGE) 2021-06-22 09:15:36 +02:00
fuse_i.h fuse: Make fuse_fill_super_submount() static 2021-06-22 09:15:35 +02:00
inode.c fuse: Make fuse_fill_super_submount() static 2021-06-22 09:15:35 +02:00
ioctl.c fuse: convert to fileattr 2021-04-12 15:04:30 +02:00
Kconfig virtiofs: implement dax read/write operations 2020-09-10 11:39:23 +02:00
Makefile fuse: move ioctl to separate source file 2021-04-12 15:04:30 +02:00
readdir.c new helper: inode_wrong_type() 2021-03-08 10:19:35 -05:00
virtio_fs.c fuse: add dedicated filesystem context ops for submounts 2021-06-22 09:15:35 +02:00
xattr.c fuse: extend FUSE_SETXATTR request 2021-04-14 10:40:57 +02:00