diff mbox

[20/39] xfs_io: provide long-format help for falloc

Message ID 147743674377.11035.8133878879225366578.stgit@birch.djwong.org (mailing list archive)
State Accepted
Headers show

Commit Message

Darrick J. Wong Oct. 25, 2016, 11:05 p.m. UTC
Provide long-format help for falloc so that xfstests can use
_require_xfs_io_command to check for falloc command line args.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 io/prealloc.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)



--
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

Christoph Hellwig Oct. 26, 2016, 10:34 a.m. UTC | #1
On Tue, Oct 25, 2016 at 04:05:43PM -0700, Darrick J. Wong wrote:
> Provide long-format help for falloc so that xfstests can use
> _require_xfs_io_command to check for falloc command line args.

As it turns out checking those args isn't actually suitable.

But documentation is always good to have, so:

Reviewed-by: Christoph Hellwig <hch@lst.de>
--
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
Darrick J. Wong Oct. 26, 2016, 4:37 p.m. UTC | #2
On Wed, Oct 26, 2016 at 03:34:05AM -0700, Christoph Hellwig wrote:
> On Tue, Oct 25, 2016 at 04:05:43PM -0700, Darrick J. Wong wrote:
> > Provide long-format help for falloc so that xfstests can use
> > _require_xfs_io_command to check for falloc command line args.
> 
> As it turns out checking those args isn't actually suitable.

Yeah, ultimately I simply made an 'funshare' command and xfstests
checks whether it works the same way it does for fzero/fpunch/etc.
That makes the commit message a little out of date; will change it.

--D

> But documentation is always good to have, so:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
--
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/prealloc.c b/io/prealloc.c
index 713ea7b..7f5c200 100644
--- a/io/prealloc.c
+++ b/io/prealloc.c
@@ -164,6 +164,26 @@  zero_f(
 
 
 #if defined (HAVE_FALLOCATE)
+static void
+falloc_help(void)
+{
+	printf(_(
+"\n"
+" modifies space associated with part of a file via fallocate"
+"\n"
+" Example:\n"
+" 'falloc 0 1m' - fills all holes within the first megabyte\n"
+"\n"
+" falloc uses the fallocate system call to alter space allocations in the\n"
+" open file.  The following operations are supported:\n"
+" All the file offsets are in units of bytes.\n"
+" -c -- collapses the given range.\n"
+" -i -- inserts a hole into the given range of the file.\n"
+" -k -- do not change file size.\n"
+" -p -- unmap the given range from the file.\n"
+"\n"));
+}
+
 static int
 fallocate_f(
 	int		argc,
@@ -349,6 +369,7 @@  prealloc_init(void)
 	falloc_cmd.args = _("[-c] [-k] [-p] off len");
 	falloc_cmd.oneline =
 	_("allocates space associated with part of a file via fallocate");
+	falloc_cmd.help = falloc_help;
 	add_command(&falloc_cmd);
 
 	fpunch_cmd.name = "fpunch";