public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH] [RFC] xfsprogs: add -p for hole punching to falloc command
Date: Fri, 12 Nov 2010 16:55:05 -0500	[thread overview]
Message-ID: <1289598905-18614-1-git-send-email-josef@redhat.com> (raw)

Obviously this is highly dependant upon my current implementation of hole
punching via fallocate going in, but this is the support code for falloc to deal
with hole punching.  This is necessary to run the xfstest I have to make sure
the punching stuff is working properly.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
---
 io/prealloc.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/io/prealloc.c b/io/prealloc.c
index c8b7df6..4b14da7 100644
--- a/io/prealloc.c
+++ b/io/prealloc.c
@@ -153,12 +153,23 @@ fallocate_f(
 	xfs_flock64_t	segment;
 	int		mode = 0;
 	int		c;
+	const char	*opts;
 
-	while ((c = getopt(argc, argv, "k")) != EOF) {
+#if defined (FALLOC_FL_PUNCH_HOLE)
+	opts = "kp";
+#else
+	opts = "k";
+#endif
+	while ((c = getopt(argc, argv, opts)) != EOF) {
 		switch (c) {
 		case 'k':
 			mode = FALLOC_FL_KEEP_SIZE;
 			break;
+#if defined (FALLOC_FL_PUNCH_HOLE)
+		case 'p':
+			mode = FALLOC_FL_PUNCH_HOLE;
+			break;
+#endif
 		default:
 			command_usage(&falloc_cmd);
 		}
@@ -236,7 +247,11 @@ prealloc_init(void)
 	falloc_cmd.argmin = 2;
 	falloc_cmd.argmax = -1;
 	falloc_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
+#if defined (FALLOC_FL_PUNCH_HOLE)
+	falloc_cmd.args = _("[-k] [-p] off len");
+#else
 	falloc_cmd.args = _("[-k] off len");
+#endif
 	falloc_cmd.oneline =
 		_("allocates space associated with part of a file via fallocate");
 
-- 
1.6.6.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

             reply	other threads:[~2010-11-12 22:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-12 21:55 Josef Bacik [this message]
2010-11-18  5:14 ` [PATCH] [RFC] xfsprogs: add -p for hole punching to falloc command Dave Chinner
2010-11-18  8:26   ` Josef Bacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1289598905-18614-1-git-send-email-josef@redhat.com \
    --to=josef@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox