summaryrefslogtreecommitdiff
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2005-11-09 08:39:29 +0300
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 18:56:37 +0300
commit31399d9e56abeec4d819f07eefc97f30b5d5ed75 (patch)
tree841dee4a780a213519ca7bfbb5ba1ed1bf025c2c /drivers/md/md.c
parent9c79197761b4c181a143dc6a6044f4e47d44bdcc (diff)
downloadlinux-31399d9e56abeec4d819f07eefc97f30b5d5ed75.tar.xz
[PATCH] md: minor MD fixes
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> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index fe0137a5b002..013f2f27589c 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -698,6 +698,7 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev)
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, mdk_rdev_t *rdev)
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, mdk_rdev_t *rdev)
&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)