linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-raid@vger.kernel.org
Subject: [PATCH md 003 of 8] Minor MD fixes
Date: Fri, 14 Oct 2005 12:26:06 +1000	[thread overview]
Message-ID: <1051014022606.11787@suse.de> (raw)
In-Reply-To: 20051014122335.11602.patches@notabene


1/ Use reduce stack usage, because 'gcc' apparently doesn't overlay 
   different variables  that are in separate scopes...

2/ Use test_bit instead of ( .. & 1<< ..) which in this case is buggy.

Thanks to Andrew Morton

Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./drivers/md/md.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff ./drivers/md/md.c~current~ ./drivers/md/md.c
--- ./drivers/md/md.c~current~	2005-10-14 12:15:42.000000000 +1000
+++ ./drivers/md/md.c	2005-10-14 12:16:10.000000000 +1000
@@ -698,6 +698,7 @@ static void super_90_sync(mddev_t *mddev
 	struct list_head *tmp;
 	mdk_rdev_t *rdev2;
 	int next_spare = mddev->raid_disks;
+	char nm[20];
 
 	/* make rdev->sb match mddev data..
 	 *
@@ -768,7 +769,6 @@ static void super_90_sync(mddev_t *mddev
 			fixdesc |= (1 << desc_nr);
 			rdev2->desc_nr = desc_nr;
 			if (rdev2->raid_disk >= 0) {
-				char nm[20];
 				sprintf(nm, "rd%d", rdev2->raid_disk);
 				sysfs_remove_link(&mddev->kobj, nm);
 			}
@@ -814,7 +814,6 @@ static void super_90_sync(mddev_t *mddev
 						  &rdev2->bdev->bd_disk->kobj,
 						  "block");
 				if (rdev2->raid_disk >= 0) {
-					char nm[20];
 					sprintf(nm, "rd%d", rdev2->raid_disk);
 					sysfs_create_link(&mddev->kobj,
 							  &rdev2->kobj, nm);
@@ -1722,9 +1721,9 @@ static ssize_t
 md_show_scan(mddev_t *mddev, char *page)
 {
 	char *type = "none";
-	if (mddev->recovery &
-	    ((1<<MD_RECOVERY_RUNNING) || (1<<MD_RECOVERY_NEEDED))) {
-		if (mddev->recovery & (1<<MD_RECOVERY_SYNC)) {
+	if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) ||
+	    test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) {
+		if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {
 			if (!test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery))
 				type = "resync";
 			else if (test_bit(MD_RECOVERY_CHECK, &mddev->recovery))
@@ -1741,8 +1740,9 @@ static ssize_t
 md_store_scan(mddev_t *mddev, const char *page, size_t len)
 {
 	int canscan=0;
-	if (mddev->recovery &
-	    ((1<<MD_RECOVERY_RUNNING) || (1<<MD_RECOVERY_NEEDED)))
+
+	if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) ||
+	    test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))
 		return -EBUSY;
 	down(&mddev->reconfig_sem);
 	if (mddev->pers && mddev->pers->sync_request)

  parent reply	other threads:[~2005-10-14  2:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-14  2:25 [PATCH md 000 of 8] Introduction NeilBrown
2005-10-14  2:25 ` [PATCH md 001 of 8] Provide proper rcu_dereference / rcu_assign_pointer annotations in md NeilBrown
2005-10-14  2:26 ` [PATCH md 002 of 8] Fix ref-counting problems with kobjects " NeilBrown
2005-10-14  2:26 ` NeilBrown [this message]
2005-10-14  2:26 ` [PATCH md 004 of 8] Change raid5 sysfs attribute to not create a new directory NeilBrown
2005-10-14  2:26 ` [PATCH md 005 of 8] Improvements to raid5 handling of read errors NeilBrown
2005-10-14  2:26 ` [PATCH md 006 of 8] Convert 'faulty' and 'in_sync' fields to bits in 'flags' field NeilBrown
2005-10-14  2:26 ` [PATCH md 007 of 8] Make md on-disk bitmaps not host-endian NeilBrown
2005-10-14  2:26 ` [PATCH md 008 of 8] Support BIO_RW_BARRIER for md/raid1 NeilBrown
2005-10-16 15:57 ` [PATCH md 000 of 8] Introduction Mr. James W. Laferriere
2005-10-17  2:38   ` Neil Brown
2005-10-18  1:02     ` Mr. James W. Laferriere

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=1051014022606.11787@suse.de \
    --to=neilb@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-raid@vger.kernel.org \
    /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).