Linux-NFS Archive mirror
 help / color / mirror / Atom feed
From: Chuck Lever III <chuck.lever@oracle.com>
To: Robert Ayrapetyan <robert.ayrapetyan@gmail.com>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: NFS server side folder copy
Date: Tue, 23 Apr 2024 13:27:04 +0000	[thread overview]
Message-ID: <27859A3F-39CD-4BD5-ABC2-A0B12C5880F3@oracle.com> (raw)
In-Reply-To: <CAAboi9s9=h-ULoTJ4kcTi3S297RWou0JfBz5nTQP90pVpA37bA@mail.gmail.com>



> On Apr 21, 2024, at 1:37 PM, Robert Ayrapetyan <robert.ayrapetyan@gmail.com> wrote:
> 
> Hello!
> 
> Attempting to understand the implementation of server-side copying of
> folders mounted via NFS 4.2.
> Currently copying an entire folder (cp -r --reflink=always) produces:
> 
> newfstatat(AT_FDCWD, "/mnt/source_file", {st_mode=S_IFREG|0644,
> st_size=2466, ...}, AT_SYMLINK_NOFOLLOW) = 0
> newfstatat(3, "dest_file", {st_mode=S_IFREG|0644, st_size=2466, ...}, 0) = 0
> openat(AT_FDCWD, "/mnt/source_file", O_RDONLY|O_NOFOLLOW) = 4
> newfstatat(4, "", {st_mode=S_IFREG|0644, st_size=2466, ...}, AT_EMPTY_PATH) = 0
> openat(3, "dest_file", O_WRONLY|O_TRUNC) = 5
> ioctl(5, BTRFS_IOC_CLONE or FICLONE, 4) = 0
> close(5)                                = 0
> close(4)
> 
> sequence of operations for each file within the directory on the
> client side.  Notably, the actual file copy occurs on the server side
> and is instantaneous (BTRFS_IOC_CLONE).
> But for TTLs around 50 ms (such as within intra-regional connections
> like US West/East), copying a 700MB directory containing 500 files
> takes about 4 minutes (while "true" server-side folder copy is almost
> instant).
> 
> Exploring if there exists a Linux mechanism enabling the copying of an
> entire folder without individually accessing each file within the
> directory for server-side copy operation.

The Linux FS community has discussed this issue in the
past.

The usual approach is to teach the user space utilities
(tar, rsync, and the like) to kick off file copies in
parallel.


--
Chuck Lever



      parent reply	other threads:[~2024-04-23 13:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-21 17:37 NFS server side folder copy Robert Ayrapetyan
2024-04-23 11:00 ` Benjamin Coddington
2024-04-23 13:27 ` Chuck Lever III [this message]

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=27859A3F-39CD-4BD5-ABC2-A0B12C5880F3@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=robert.ayrapetyan@gmail.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).