tree 73214a96945eb017e33c0f732ad0f1e8d10c2e8e
parent d28446fe2d87ea344c14741c39962dcc7aee5c78
author NeilBrown <[EMAIL PROTECTED]> Sun, 17 Apr 2005 05:26:42 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Sun, 17 Apr 2005 05:26:42 -0700

[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 <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 md/md.c |   30 ++++++++----------------------
 1 files changed, 8 insertions(+), 22 deletions(-)

Index: drivers/md/md.c
===================================================================
--- b41bec77e5e5123f8f5349eb01ced9ee8fd9a924/drivers/md/md.c  (mode:100644 
sha1:44a164965546c3a57d60c2a9d90d9dce2c4962c7)
+++ 73214a96945eb017e33c0f732ad0f1e8d10c2e8e/drivers/md/md.c  (mode:100644 
sha1:97af857d8a8865a00fcdca6ea882699f852ed8b6)
@@ -1387,7 +1387,7 @@
  */
 
 
-static int analyze_sbs(mddev_t * mddev)
+static void analyze_sbs(mddev_t * mddev)
 {
        int i;
        struct list_head *tmp;
@@ -1441,7 +1441,6 @@
                       " -- starting background reconstruction\n",
                       mdname(mddev));
 
-       return 0;
 }
 
 int mdp_major = 0;
@@ -1508,10 +1507,9 @@
        struct gendisk *disk;
        char b[BDEVNAME_SIZE];
 
-       if (list_empty(&mddev->disks)) {
-               MD_BUG();
+       if (list_empty(&mddev->disks))
+               /* cannot run an array with no devices.. */
                return -EINVAL;
-       }
 
        if (mddev->pers)
                return -EBUSY;
@@ -1519,10 +1517,8 @@
        /*
         * Analyze all RAID superblock(s)
         */
-       if (!mddev->raid_disks && analyze_sbs(mddev)) {
-               MD_BUG();
-               return -EINVAL;
-       }
+       if (!mddev->raid_disks)
+               analyze_sbs(mddev);
 
        chunk_size = mddev->chunk_size;
        pnum = level_to_pers(mddev->level);
@@ -1548,7 +1544,7 @@
                 * chunk-size has to be a power of 2 and multiples of PAGE_SIZE
                 */
                if ( (1 << ffz(~chunk_size)) != chunk_size) {
-                       MD_BUG();
+                       printk(KERN_ERR "chunk_size of %d not valid\n", 
chunk_size);
                        return -EINVAL;
                }
                if (chunk_size < PAGE_SIZE) {
@@ -1573,11 +1569,6 @@
                }
        }
 
-       if (pnum >= MAX_PERSONALITY) {
-               MD_BUG();
-               return -EINVAL;
-       }
-
 #ifdef CONFIG_KMOD
        if (!pers[pnum])
        {
@@ -1762,10 +1753,8 @@
        struct list_head *tmp;
        int err;
 
-       if (list_empty(&mddev->disks)) {
-               MD_BUG();
+       if (list_empty(&mddev->disks))
                return;
-       }
 
        printk(KERN_INFO "md: running: ");
 
@@ -3128,7 +3117,6 @@
        spin_lock(&pers_lock);
        if (pers[pnum]) {
                spin_unlock(&pers_lock);
-               MD_BUG();
                return -EBUSY;
        }
 
@@ -3140,10 +3128,8 @@
 
 int unregister_md_personality(int pnum)
 {
-       if (pnum >= MAX_PERSONALITY) {
-               MD_BUG();
+       if (pnum >= MAX_PERSONALITY)
                return -EINVAL;
-       }
 
        printk(KERN_INFO "md: %s personality unregistered\n", pers[pnum]->name);
        spin_lock(&pers_lock);
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to