linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jes.Sorensen@redhat.com
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, dledford@redhat.com
Subject: [PATCH 3/3] Kill(): Remove redundant check and dead code
Date: Mon, 31 Oct 2011 14:53:54 +0100	[thread overview]
Message-ID: <1320069234-13112-4-git-send-email-Jes.Sorensen@redhat.com> (raw)
In-Reply-To: <1320069234-13112-1-git-send-email-Jes.Sorensen@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

No need to check for (force && rv >=2) since we just set rv = 0 in
that case.

In addition remove dead code path that checks rv != 0 inside code that
is only run for rv == 0.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 Kill.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/Kill.c b/Kill.c
index b841a5b..01d884f 100644
--- a/Kill.c
+++ b/Kill.c
@@ -63,7 +63,7 @@ int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl)
 	rv = st->ss->load_super(st, fd, dev);
 	if (force && rv >= 2)
 		rv = 0; /* ignore bad data in superblock */
-	if (rv== 0 || (force && rv >= 2)) {
+	if (rv == 0) {
 		st->ss->free_super(st);
 		st->ss->init_super(st, NULL, 0, "", NULL, NULL);
 		if (st->ss->store_super(st, fd)) {
@@ -71,10 +71,6 @@ int Kill(char *dev, struct supertype *st, int force, int quiet, int noexcl)
 				fprintf(stderr, Name ": Could not zero superblock on %s\n",
 					dev);
 			rv = 1;
-		} else if (rv) {
-			if (!quiet)
-				fprintf(stderr, Name ": superblock zeroed anyway\n");
-			rv = 0;
 		}
 	}
 	close(fd);
-- 
1.7.6.4


      parent reply	other threads:[~2011-10-31 13:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-31 13:53 [PATCH 0/3] Remove dead code Jes.Sorensen
2011-10-31 13:53 ` [PATCH 1/3] conf_match(): " Jes.Sorensen
2011-11-01  2:33   ` NeilBrown
2011-11-01  6:22     ` Jes Sorensen
2011-10-31 13:53 ` [PATCH 2/3] conf_watch(): More dead code removal Jes.Sorensen
2011-10-31 13:53 ` Jes.Sorensen [this message]

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=1320069234-13112-4-git-send-email-Jes.Sorensen@redhat.com \
    --to=jes.sorensen@redhat.com \
    --cc=dledford@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /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).