On 25/09/15 21:48, Anna Schumaker wrote: > The NFS server will need some kind offallback for filesystems that don't > have any kind of copy acceleration, and it should be generally useful to > have an in-kernel copy to avoid lots of switches between kernel and user > space. > > I make this configurable by adding two new flags. Users who only want a > reflink can pass COPY_FR_REFLINK, and users who want a full data copy can > pass COPY_FR_COPY. The default (flags=0) means to first attempt a > reflink, but use the pagecache if that fails. > > I moved the rw_verify_area() calls into the fallback code since some > filesystems can handle reflinking a large range. > > Signed-off-by: Anna Schumaker <Anna.Schumaker@xxxxxxxxxx> Reviewed-by: Pádraig Brady <P@xxxxxxxxxxxxxx> LGTM. For my reference, for cp(1), mv(1), install(1), this will avoid user space copies in the normal case, client side copies in the network file system case, and provide a more generalized interface to reflink(). coreutils pseudo code is: unsigned int cfr_flags = COPY_FR_COPY; if (mode == mv) cfr_flags = 0; /* reflink falling back to normal */ else if (mode == cp) { if --reflink || --reflink==always cfr_flags = COPY_FR_REFLINK; else if --reflink==auto cfr_flags = 0; /* reflink falling back to normal */ } if vfs_copy_file_range(..., cfr_flags) == ENOTSUP normal_user_space_copy(); thanks, Pádraig. -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html