diff options
author | NeilBrown <neilb@suse.de> | 2005-11-09 00:39:29 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-09 10:56:37 -0500 |
commit | 31399d9e56abeec4d819f07eefc97f30b5d5ed75 (patch) | |
tree | 841dee4a780a213519ca7bfbb5ba1ed1bf025c2c /drivers | |
parent | 9c79197761b4c181a143dc6a6044f4e47d44bdcc (diff) |
[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')
-rw-r--r-- | drivers/md/md.c | 14 |
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) | |||
698 | struct list_head *tmp; | 698 | struct list_head *tmp; |
699 | mdk_rdev_t *rdev2; | 699 | mdk_rdev_t *rdev2; |
700 | int next_spare = mddev->raid_disks; | 700 | int next_spare = mddev->raid_disks; |
701 | char nm[20]; | ||
701 | 702 | ||
702 | /* make rdev->sb match mddev data.. | 703 | /* make rdev->sb match mddev data.. |
703 | * | 704 | * |
@@ -768,7 +769,6 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev) | |||
768 | fixdesc |= (1 << desc_nr); | 769 | fixdesc |= (1 << desc_nr); |
769 | rdev2->desc_nr = desc_nr; | 770 | rdev2->desc_nr = desc_nr; |
770 | if (rdev2->raid_disk >= 0) { | 771 | if (rdev2->raid_disk >= 0) { |
771 | char nm[20]; | ||
772 | sprintf(nm, "rd%d", rdev2->raid_disk); | 772 | sprintf(nm, "rd%d", rdev2->raid_disk); |
773 | sysfs_remove_link(&mddev->kobj, nm); | 773 | sysfs_remove_link(&mddev->kobj, nm); |
774 | } | 774 | } |
@@ -814,7 +814,6 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev) | |||
814 | &rdev2->bdev->bd_disk->kobj, | 814 | &rdev2->bdev->bd_disk->kobj, |
815 | "block"); | 815 | "block"); |
816 | if (rdev2->raid_disk >= 0) { | 816 | if (rdev2->raid_disk >= 0) { |
817 | char nm[20]; | ||
818 | sprintf(nm, "rd%d", rdev2->raid_disk); | 817 | sprintf(nm, "rd%d", rdev2->raid_disk); |
819 | sysfs_create_link(&mddev->kobj, | 818 | sysfs_create_link(&mddev->kobj, |
820 | &rdev2->kobj, nm); | 819 | &rdev2->kobj, nm); |
@@ -1722,9 +1721,9 @@ static ssize_t | |||
1722 | md_show_scan(mddev_t *mddev, char *page) | 1721 | md_show_scan(mddev_t *mddev, char *page) |
1723 | { | 1722 | { |
1724 | char *type = "none"; | 1723 | char *type = "none"; |
1725 | if (mddev->recovery & | 1724 | if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || |
1726 | ((1<<MD_RECOVERY_RUNNING) || (1<<MD_RECOVERY_NEEDED))) { | 1725 | test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) { |
1727 | if (mddev->recovery & (1<<MD_RECOVERY_SYNC)) { | 1726 | if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { |
1728 | if (!test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) | 1727 | if (!test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) |
1729 | type = "resync"; | 1728 | type = "resync"; |
1730 | else if (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) | 1729 | else if (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) |
@@ -1741,8 +1740,9 @@ static ssize_t | |||
1741 | md_store_scan(mddev_t *mddev, const char *page, size_t len) | 1740 | md_store_scan(mddev_t *mddev, const char *page, size_t len) |
1742 | { | 1741 | { |
1743 | int canscan=0; | 1742 | int canscan=0; |
1744 | if (mddev->recovery & | 1743 | |
1745 | ((1<<MD_RECOVERY_RUNNING) || (1<<MD_RECOVERY_NEEDED))) | 1744 | if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || |
1745 | test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) | ||
1746 | return -EBUSY; | 1746 | return -EBUSY; |
1747 | down(&mddev->reconfig_sem); | 1747 | down(&mddev->reconfig_sem); |
1748 | if (mddev->pers && mddev->pers->sync_request) | 1748 | if (mddev->pers && mddev->pers->sync_request) |