[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#25930: optimize mv for multiple bind mounts
From: |
Sven Joachim |
Subject: |
bug#25930: optimize mv for multiple bind mounts |
Date: |
Thu, 02 Mar 2017 11:05:57 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
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