cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] mkfs.gfs2: Some minor cleanups
Date: Mon,  7 Nov 2011 14:05:29 +0000	[thread overview]
Message-ID: <1320674729-18313-1-git-send-email-anprice@redhat.com> (raw)

- The -K option isn't currently parsed, add it to the getopt option
  string.
- Variable 'input' is defined but not used, remove it.
- Add back reporting of the current device contents.
- Don't call the discard blocks ioctl on regular files.

Signed-off-by: Andrew Price <anprice@redhat.com>
---
 gfs2/mkfs/main_mkfs.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 6de1d12..eeff47b 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -109,7 +109,7 @@ static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
 	sdp->orig_fssize = 0;
 
 	while (cont) {
-		optchar = getopt(argc, argv, "-b:c:DhJ:j:Op:qr:t:u:VX");
+		optchar = getopt(argc, argv, "-b:c:DhJ:j:KOp:qr:t:u:VX");
 
 		switch (optchar) {
 		case 'b':
@@ -325,7 +325,6 @@ static void are_you_sure(void)
 static void verify_bsize(struct gfs2_sbd *sdp)
 {
 	unsigned int x;
-	char input[32];
 
 	/* Block sizes must be a power of two from 512 to 65536 */
 
@@ -561,8 +560,11 @@ void main_mkfs(int argc, char *argv[])
 		exit(EXIT_FAILURE);
 	}
 
-	if (!sdp->override)
+	if (!sdp->override) {
+		printf( _("This will destroy any data on %s.\n"), sdp->device_name);
+		check_dev_content(sdp->device_name);
 		are_you_sure();
+	}
 
 	if (!S_ISREG(st_buf.st_mode) && device_topology(sdp)) {
 		perror(_("Device topology error\n"));
@@ -621,7 +623,7 @@ void main_mkfs(int argc, char *argv[])
 		exit(EXIT_FAILURE);
 	}
 
-	if (discard)
+	if (!S_ISREG(st_buf.st_mode) && discard)
 		discard_blocks(sdp);
 
 	/* Compute the resource group layouts */
-- 
1.7.6.4



             reply	other threads:[~2011-11-07 14:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-07 14:05 Andrew Price [this message]
2011-11-07 14:11 ` [Cluster-devel] [PATCH] mkfs.gfs2: Some minor cleanups Steven Whitehouse

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=1320674729-18313-1-git-send-email-anprice@redhat.com \
    --to=anprice@redhat.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;
as well as URLs for NNTP newsgroup(s).