aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@cse.unsw.edu.au>2005-04-16 18:26:42 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:26:42 -0400
commita757e64cfa400391041ed7953f0290c34a820c93 (patch)
tree73214a96945eb017e33c0f732ad0f1e8d10c2e8e
parentd28446fe2d87ea344c14741c39962dcc7aee5c78 (diff)
[PATCH] md: remove a number of misleading calls to MD_BUG
The conditions that cause these calls to MD_BUG are not kernel bugs, just oddities in what userspace is asking for. Also convert analyze_sbs to return void, and the value it returned was always 0. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/md/md.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 44a16496554..97af857d8a8 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1387,7 +1387,7 @@ abort_free:
1387 */ 1387 */
1388 1388
1389 1389
1390static int analyze_sbs(mddev_t * mddev) 1390static void analyze_sbs(mddev_t * mddev)
1391{ 1391{
1392 int i; 1392 int i;
1393 struct list_head *tmp; 1393 struct list_head *tmp;
@@ -1441,7 +1441,6 @@ static int analyze_sbs(mddev_t * mddev)
1441 " -- starting background reconstruction\n", 1441 " -- starting background reconstruction\n",
1442 mdname(mddev)); 1442 mdname(mddev));
1443 1443
1444 return 0;
1445} 1444}
1446 1445
1447int mdp_major = 0; 1446int mdp_major = 0;
@@ -1508,10 +1507,9 @@ static int do_md_run(mddev_t * mddev)
1508 struct gendisk *disk; 1507 struct gendisk *disk;
1509 char b[BDEVNAME_SIZE]; 1508 char b[BDEVNAME_SIZE];
1510 1509
1511 if (list_empty(&mddev->disks)) { 1510 if (list_empty(&mddev->disks))
1512 MD_BUG(); 1511 /* cannot run an array with no devices.. */
1513 return -EINVAL; 1512 return -EINVAL;
1514 }
1515 1513
1516 if (mddev->pers) 1514 if (mddev->pers)
1517 return -EBUSY; 1515 return -EBUSY;
@@ -1519,10 +1517,8 @@ static int do_md_run(mddev_t * mddev)
1519 /* 1517 /*
1520 * Analyze all RAID superblock(s) 1518 * Analyze all RAID superblock(s)
1521 */ 1519 */
1522 if (!mddev->raid_disks && analyze_sbs(mddev)) { 1520 if (!mddev->raid_disks)
1523 MD_BUG(); 1521 analyze_sbs(mddev);
1524 return -EINVAL;
1525 }
1526 1522
1527 chunk_size = mddev->chunk_size; 1523 chunk_size = mddev->chunk_size;
1528 pnum = level_to_pers(mddev->level); 1524 pnum = level_to_pers(mddev->level);
@@ -1548,7 +1544,7 @@ static int do_md_run(mddev_t * mddev)
1548 * chunk-size has to be a power of 2 and multiples of PAGE_SIZE 1544 * chunk-size has to be a power of 2 and multiples of PAGE_SIZE
1549 */ 1545 */
1550 if ( (1 << ffz(~chunk_size)) != chunk_size) { 1546 if ( (1 << ffz(~chunk_size)) != chunk_size) {
1551 MD_BUG(); 1547 printk(KERN_ERR "chunk_size of %d not valid\n", chunk_size);
1552 return -EINVAL; 1548 return -EINVAL;
1553 } 1549 }
1554 if (chunk_size < PAGE_SIZE) { 1550 if (chunk_size < PAGE_SIZE) {
@@ -1573,11 +1569,6 @@ static int do_md_run(mddev_t * mddev)
1573 } 1569 }
1574 } 1570 }
1575 1571
1576 if (pnum >= MAX_PERSONALITY) {
1577 MD_BUG();
1578 return -EINVAL;
1579 }
1580
1581#ifdef CONFIG_KMOD 1572#ifdef CONFIG_KMOD
1582 if (!pers[pnum]) 1573 if (!pers[pnum])
1583 { 1574 {
@@ -1762,10 +1753,8 @@ static void autorun_array(mddev_t *mddev)
1762 struct list_head *tmp; 1753 struct list_head *tmp;
1763 int err; 1754 int err;
1764 1755
1765 if (list_empty(&mddev->disks)) { 1756 if (list_empty(&mddev->disks))
1766 MD_BUG();
1767 return; 1757 return;
1768 }
1769 1758
1770 printk(KERN_INFO "md: running: "); 1759 printk(KERN_INFO "md: running: ");
1771 1760
@@ -3128,7 +3117,6 @@ int register_md_personality(int pnum, mdk_personality_t *p)
3128 spin_lock(&pers_lock); 3117 spin_lock(&pers_lock);
3129 if (pers[pnum]) { 3118 if (pers[pnum]) {
3130 spin_unlock(&pers_lock); 3119 spin_unlock(&pers_lock);
3131 MD_BUG();
3132 return -EBUSY; 3120 return -EBUSY;
3133 } 3121 }
3134 3122
@@ -3140,10 +3128,8 @@ int register_md_personality(int pnum, mdk_personality_t *p)
3140 3128
3141int unregister_md_personality(int pnum) 3129int unregister_md_personality(int pnum)
3142{ 3130{
3143 if (pnum >= MAX_PERSONALITY) { 3131 if (pnum >= MAX_PERSONALITY)
3144 MD_BUG();
3145 return -EINVAL; 3132 return -EINVAL;
3146 }
3147 3133
3148 printk(KERN_INFO "md: %s personality unregistered\n", pers[pnum]->name); 3134 printk(KERN_INFO "md: %s personality unregistered\n", pers[pnum]->name);
3149 spin_lock(&pers_lock); 3135 spin_lock(&pers_lock);