linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH ] xfs: always succeed when deduping zero bytes
@ 2016-11-23  2:12 Darrick J. Wong
  2016-11-29 20:12 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2016-11-23  2:12 UTC (permalink / raw)
  To: david, darrick.wong; +Cc: linux-xfs

It turns out that btrfs and xfs had differing interpretations of what
to do when the dedupe length is zero.  Change xfs to follow btrfs'
semantics so that the userland interface is consistent.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/xfs_reflink.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)


diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index a279b4e..9989f3e 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -1345,8 +1345,14 @@ xfs_reflink_remap_range(
 		goto out_unlock;
 	}
 
-	if (len == 0)
+	/* Zero length dedupe exits immediately; reflink goes to EOF. */
+	if (len == 0) {
+		if (is_dedupe) {
+			ret = 0;
+			goto out_unlock;
+		}
 		len = isize - pos_in;
+	}
 
 	/* Ensure offsets don't wrap and the input is inside i_size */
 	if (pos_in + len < pos_in || pos_out + len < pos_out ||


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH ] xfs: always succeed when deduping zero bytes
  2016-11-23  2:12 [PATCH ] xfs: always succeed when deduping zero bytes Darrick J. Wong
@ 2016-11-29 20:12 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2016-11-29 20:12 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: david, linux-xfs

On Tue, Nov 22, 2016 at 06:12:07PM -0800, Darrick J. Wong wrote:
> It turns out that btrfs and xfs had differing interpretations of what
> to do when the dedupe length is zero.  Change xfs to follow btrfs'
> semantics so that the userland interface is consistent.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks fine,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-29 20:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-23  2:12 [PATCH ] xfs: always succeed when deduping zero bytes Darrick J. Wong
2016-11-29 20:12 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).