GNU bug report logs - #25930
optimize mv for multiple bind mounts

Previous Next

Package: coreutils;

Reported by: Ruediger Meier <sweet_f_a <at> gmx.de>

Date: Thu, 2 Mar 2017 09:52:01 UTC

Severity: normal

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 25930 <at> debbugs.gnu.org (full text, mbox):

From: Sven Joachim <svenjoac <at> gmx.de>
To: Ruediger Meier <sweet_f_a <at> gmx.de>
Cc: 25930 <at> debbugs.gnu.org
Subject: Re: bug#25930: optimize mv for multiple bind mounts
Date: Thu, 02 Mar 2017 11:05:57 +0100
Am 02.03.2017 um 10:51 schrieb Ruediger Meier:

> I have two bind mounts of the same filesystem
>
> $ grep "/tmp"  /etc/fstab
> /dev/vg0/tmpdirs /mnt/tmpdirs ext4
> acl,user_xattr,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0
> 1 2
> /mnt/tmpdirs/tmp     /tmp                 none       bind                  0 0
> /mnt/tmpdirs/var/tmp /var/tmp             none       bind                  0 0
>
>
> Using mv to move files between the bind mounts makes a slow copy:
>
> $ time mv /var/tmp/BIGFILE  /tmp/
>
> real    0m0.622s
> user    0m0.001s
> sys     0m0.621s
>
>
> In theory mv could know somehow that's the same filesystem
> and do it like this:
>
> $ time mv /mnt/tmpdirs/tmp/BIGFILE /mnt/tmpdirs/var/tmp/
>
> real    0m0.004s
> user    0m0.001s
> sys     0m0.003s
>
>
> Would it be possible to optimize mv regarding bind mounts?

Apparently not, according to the rename(2) manpage:

,----
|   EXDEV  oldpath and newpath are not on the same mounted filesystem.
|          (Linux  permits  a  filesystem  to  be  mounted at multiple
|          points, but rename() does not work across  different  mount
|          points, even if the same filesystem is mounted on both.)
`----

Cheers,
       Sven





This bug report was last modified 6 years and 210 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.