From: David Disseldorp <ddiss@samba.org>
To: Jeremy Allison via samba-technical <samba-technical@lists.samba.org>
Cc: Jeremy Allison <jra@samba.org>,
Amir Goldstein <amir73il@gmail.com>,
Steve French <smfrench@gmail.com>,
CIFS <linux-cifs@vger.kernel.org>,
vl@samba.org, metze@samba.org
Subject: Re: reflink support and Samba running over XFS
Date: Wed, 9 Nov 2022 22:50:55 +0100 [thread overview]
Message-ID: <20221109225055.0729569b@echidna.suse.de> (raw)
In-Reply-To: <Y2v1zQbnPoqg+0aj@jeremy-acer>
Hi Jeremy,
On Wed, 9 Nov 2022 10:47:41 -0800, Jeremy Allison via samba-technical wrote:
...
> >So the code change needed is to move the logic in vfs_btrfs.c
> >into vfs_default.c, and change the call in vfs_btrfs.c:btrfs_offload_write_send()
> >to SMB_VFS_NEXT_OFFLOAD_WRITE_SEND() to call the old fallback code
> >inside vfs_default.c (vfswrap_offload_write_send()).
>
> Although looking at the current Linux kernel I find inside:
>
> ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in,
> struct file *file_out, loff_t pos_out,
> size_t len, unsigned int flags)
> {
>
> https://github.com/torvalds/linux/blob/0adc313c4f20639f7e235b8d6719d96a2024cf91/fs/read_write.c#L1506
>
> /*
> * Try cloning first, this is supported by more file systems, and
> * more efficient if both clone and copy are supported (e.g. NFS).
> */
> if (file_in->f_op->remap_file_range &&
> file_inode(file_in)->i_sb == file_inode(file_out)->i_sb) {
> loff_t cloned;
>
> cloned = file_in->f_op->remap_file_range(file_in, pos_in,
> file_out, pos_out,
> min_t(loff_t, MAX_RW_COUNT, len),
> REMAP_FILE_CAN_SHORTEN);
> if (cloned > 0) {
> ret = cloned;
>
> and looking at the code supporting int ioctl(int dest_fd, FICLONERANGE, struct file_clone_range *arg);
> we have:
>
> loff_t do_clone_file_range(struct file *file_in, loff_t pos_in,
> struct file *file_out, loff_t pos_out,
> loff_t len, unsigned int remap_flags)
> ...
> ret = file_in->f_op->remap_file_range(file_in, pos_in,
> file_out, pos_out, len, remap_flags);
>
> So it *looks* like the copy_file_range() syscall will internally
> call the equivalent of FICLONERANGE if the underlying file
> system supports it.
>
> So maybe the right fix is to remove the FICLONERANGE specific
> code from our vfs_btrfs.c and just always use copy_file_range().
copy_file_range() should be okay for FSCTL_SRV_COPYCHUNK, but I don't
think it's an option for FSCTL_DUP_EXTENTS_TO_FILE, as (IIRC) the latter
explicitly requires block cloning so can't fallback to regular copy.
Cheers, David
next prev parent reply other threads:[~2022-11-09 21:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 0:45 reflink support and Samba running over XFS Steve French
2022-11-08 0:53 ` Jeremy Allison
2022-11-08 6:47 ` Christoph Hellwig
2022-11-08 17:51 ` Jeremy Allison
2022-11-09 7:43 ` Christoph Hellwig
2022-11-09 9:32 ` Amir Goldstein
2022-11-09 18:38 ` Jeremy Allison
2022-11-09 18:47 ` Jeremy Allison
2022-11-09 19:24 ` Jeremy Allison
2022-11-09 22:30 ` David Disseldorp
2022-11-10 11:42 ` Christoph Hellwig
2022-11-10 15:05 ` David Disseldorp
2022-11-09 19:50 ` Amir Goldstein
2022-11-09 21:50 ` David Disseldorp [this message]
2022-11-10 11:41 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221109225055.0729569b@echidna.suse.de \
--to=ddiss@samba.org \
--cc=amir73il@gmail.com \
--cc=jra@samba.org \
--cc=linux-cifs@vger.kernel.org \
--cc=metze@samba.org \
--cc=samba-technical@lists.samba.org \
--cc=smfrench@gmail.com \
--cc=vl@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox