Thread (39 messages) 39 messages, 2 authors, 2018-10-17
STALE2840d REVIEWED: 12 (12M)
Revisions (5)
  1. v1 [diff vs current]
  2. v2 [diff vs current]
  3. v5 current
  4. v6 [diff vs current]
  5. v6 [diff vs current]

[PATCH 07/26] vfs: skip zero-length dedupe requests

From: Darrick J. Wong <hidden>
Date: 2018-10-16 03:10:44
Also in: linux-btrfs, linux-cifs, linux-fsdevel, linux-nfs, linux-unionfs, linux-xfs, ocfs2-devel
Subsystem: filesystems (vfs and infrastructure), the rest · Maintainers: Alexander Viro, Christian Brauner, Linus Torvalds

From: Darrick J. Wong <redacted>

Don't bother calling the filesystem for a zero-length dedupe request;
we can return zero and exit.

Signed-off-by: Darrick J. Wong <redacted>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
---
 fs/read_write.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/read_write.c b/fs/read_write.c
index 0f0a6efdd502..f5395d8da741 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -2009,6 +2009,11 @@ int vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,
 	if (!dst_file->f_op->dedupe_file_range)
 		goto out_drop_write;
 
+	if (len == 0) {
+		ret = 0;
+		goto out_drop_write;
+	}
+
 	ret = dst_file->f_op->dedupe_file_range(src_file, src_pos,
 						dst_file, dst_pos, len);
 out_drop_write:
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help