[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 0/3] Use copy_file_range while performing copy

From: Goldwyn Rodrigues
Subject: [PATCH 0/3] Use copy_file_range while performing copy
Date: Tue, 31 Jul 2018 11:38:27 -0500

This patch set uses copy_file_range() instead of legacy read() and
write() calls to the filesystem to copy a file. The advantage is we save
on memory allocations and frequent system calls to the kernel.

As the man page suggests, this performs a copy_file_range() using
SEEK_HOLE and SEEK_DATA to find the holes. It copies the data using
copy_file_range() and writes zeros if sparse_mode is set to NEVER.
It falls back to legacy copy for sparse_mode ALWAYS because userspace is
the best judge for identifying and creating holes.

While I carved out legacy copy, I added fallocate(st_blocks) to the
calls which should make the writes a bit more faster because the
filesystem would not compute for allocating space every write() call.

"make check" passes all tests on btrfs.

Pádraig, this should address most of your concerns of using
copy_file_range() you brought up in the previous discussion [1]
I am fine with delaying this until the next major release, if there are
no further objections. A filesystem may still choose to
perform a reflink underneath, but I suppose there is not much we can do
with that since filesystems can even perform de-duping later with
utilities such as dedupe or even inline dedeuping.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]