diff mbox

[3/3] xfs_io: fix the minimum arguments to the reflink command

Message ID 148182551808.24784.14290922921211733530.stgit@birch.djwong.org
State Accepted
Headers show

Commit Message

Darrick J. Wong Dec. 15, 2016, 6:11 p.m. UTC
The reflink command can reflink the entirety of two files if the
offsets and lengths are not specified... but we forgot to permit
that case.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 io/reflink.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Darrick J. Wong Dec. 16, 2016, 12:51 a.m. UTC | #1
On Thu, Dec 15, 2016 at 12:38:34PM -0600, Eric Sandeen wrote:
> On 12/15/16 12:11 PM, Darrick J. Wong wrote:
> > The reflink command can reflink the entirety of two files if the
> > offsets and lengths are not specified... but we forgot to permit
> > that case.
> 
> Could you do me a favor and also make that clear in the help output?
> The manpage says:
> 
>        reflink  [ -C ] [ -q ] src_file [src_offset dst_offset length]
> 
> 
> but the short help doesn't indicate that it's optional:
> 
> reflink infile src_off dst_off len -- reflinks a number of bytes at a specified offset

Hah, ok, yes, that's unclear and I'll fix it in a 4/3 patch.

--D

> 
> and neither it nor the long help mentions the -C & -q switches:
> 
> xfs_io> help reflink
> reflink infile src_off dst_off len -- reflinks a number of bytes at a specified offset
> 
>  Links a range of bytes (in block size increments) from a file into a range
>  of bytes in the open file.  The two extent ranges need not contain identical
>  data.
> 
>  Example:
>  'reflink some_file 0 4096 32768' - links 32768 bytes from some_file at
>                                     offset 0 to into the open file at
>                                     position 4096
>  'reflink some_file' - links all bytes from some_file into the open file
>                        at position 0
> 
>  Reflink a range of blocks from a given input file to the open file.  Both
>  files share the same range of physical disk blocks; a write to the shared
>  range of either file should result in the write landing in a new block and
>  that range of the file being remapped (i.e. copy-on-write).  Both files
>  must reside on the same filesystem.
> 
> V2 or patch 4/3 is fine :)
> 
> Thanks,
> -Eric
> 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  io/reflink.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > 
> > diff --git a/io/reflink.c b/io/reflink.c
> > index a09e82d..d26cbdd 100644
> > --- a/io/reflink.c
> > +++ b/io/reflink.c
> > @@ -302,7 +302,7 @@ reflink_init(void)
> >  	reflink_cmd.name = "reflink";
> >  	reflink_cmd.altname = "rl";
> >  	reflink_cmd.cfunc = reflink_f;
> > -	reflink_cmd.argmin = 4;
> > +	reflink_cmd.argmin = 1;
> >  	reflink_cmd.argmax = -1;
> >  	reflink_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
> >  	reflink_cmd.args =
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/io/reflink.c b/io/reflink.c
index a09e82d..d26cbdd 100644
--- a/io/reflink.c
+++ b/io/reflink.c
@@ -302,7 +302,7 @@  reflink_init(void)
 	reflink_cmd.name = "reflink";
 	reflink_cmd.altname = "rl";
 	reflink_cmd.cfunc = reflink_f;
-	reflink_cmd.argmin = 4;
+	reflink_cmd.argmin = 1;
 	reflink_cmd.argmax = -1;
 	reflink_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
 	reflink_cmd.args =