Commit 9d48739e authored by NeilBrown's avatar NeilBrown Committed by Shaohua Li

md: change all printk() to pr_err() or pr_warn() etc.

1/ using pr_debug() for a number of messages reduces the noise of
   md, but still allows them to be enabled when needed.
2/ try to be consistent in the usage of pr_err() and pr_warn(), and
   document the intention
3/ When strings have been split onto multiple lines, rejoin into
   a single string.
   The cost of having lines > 80 chars is less than the cost of not
   being able to easily search for a particular message.
Signed-off-by: default avatarNeilBrown <neilb@suse.com>
Signed-off-by: default avatarShaohua Li <shli@fb.com>
parent 7f0f0d87
...@@ -30,6 +30,18 @@ ...@@ -30,6 +30,18 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
(for example /usr/src/linux/COPYING); if not, write to the Free (for example /usr/src/linux/COPYING); if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Errors, Warnings, etc.
Please use:
pr_crit() for error conditions that risk data loss
pr_err() for error conditions that are unexpected, like an IO error
or internal inconsistency
pr_warn() for error conditions that could have been predicated, like
adding a device to an array when it has incompatible metadata
pr_info() for every interesting, very rare events, like an array starting
or stopping, or resync starting or stopping
pr_debug() for everything else.
*/ */
#include <linux/kthread.h> #include <linux/kthread.h>
...@@ -712,7 +724,7 @@ static void super_written(struct bio *bio) ...@@ -712,7 +724,7 @@ static void super_written(struct bio *bio)
struct mddev *mddev = rdev->mddev; struct mddev *mddev = rdev->mddev;
if (bio->bi_error) { if (bio->bi_error) {
printk("md: super_written gets error=%d\n", bio->bi_error); pr_err("md: super_written gets error=%d\n", bio->bi_error);
md_error(mddev, rdev); md_error(mddev, rdev);
} }
...@@ -792,8 +804,8 @@ static int read_disk_sb(struct md_rdev *rdev, int size) ...@@ -792,8 +804,8 @@ static int read_disk_sb(struct md_rdev *rdev, int size)
return 0; return 0;
fail: fail:
printk(KERN_WARNING "md: disabled device %s, could not read superblock.\n", pr_err("md: disabled device %s, could not read superblock.\n",
bdevname(rdev->bdev,b)); bdevname(rdev->bdev,b));
return -EINVAL; return -EINVAL;
} }
...@@ -815,7 +827,6 @@ static int sb_equal(mdp_super_t *sb1, mdp_super_t *sb2) ...@@ -815,7 +827,6 @@ static int sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
if (!tmp1 || !tmp2) { if (!tmp1 || !tmp2) {
ret = 0; ret = 0;
printk(KERN_INFO "md.c sb_equal(): failed to allocate memory!\n");
goto abort; goto abort;
} }
...@@ -929,7 +940,7 @@ int md_check_no_bitmap(struct mddev *mddev) ...@@ -929,7 +940,7 @@ int md_check_no_bitmap(struct mddev *mddev)
{ {
if (!mddev->bitmap_info.file && !mddev->bitmap_info.offset) if (!mddev->bitmap_info.file && !mddev->bitmap_info.offset)
return 0; return 0;
printk(KERN_ERR "%s: bitmaps are not supported for %s\n", pr_warn("%s: bitmaps are not supported for %s\n",
mdname(mddev), mddev->pers->name); mdname(mddev), mddev->pers->name);
return 1; return 1;
} }
...@@ -953,7 +964,8 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor ...@@ -953,7 +964,8 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor
rdev->sb_start = calc_dev_sboffset(rdev); rdev->sb_start = calc_dev_sboffset(rdev);
ret = read_disk_sb(rdev, MD_SB_BYTES); ret = read_disk_sb(rdev, MD_SB_BYTES);
if (ret) return ret; if (ret)
return ret;
ret = -EINVAL; ret = -EINVAL;
...@@ -961,17 +973,15 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor ...@@ -961,17 +973,15 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor
sb = page_address(rdev->sb_page); sb = page_address(rdev->sb_page);
if (sb->md_magic != MD_SB_MAGIC) { if (sb->md_magic != MD_SB_MAGIC) {
printk(KERN_ERR "md: invalid raid superblock magic on %s\n", pr_warn("md: invalid raid superblock magic on %s\n", b);
b);
goto abort; goto abort;
} }
if (sb->major_version != 0 || if (sb->major_version != 0 ||
sb->minor_version < 90 || sb->minor_version < 90 ||
sb->minor_version > 91) { sb->minor_version > 91) {
printk(KERN_WARNING "Bad version number %d.%d on %s\n", pr_warn("Bad version number %d.%d on %s\n",
sb->major_version, sb->minor_version, sb->major_version, sb->minor_version, b);
b);
goto abort; goto abort;
} }
...@@ -979,8 +989,7 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor ...@@ -979,8 +989,7 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor
goto abort; goto abort;
if (md_csum_fold(calc_sb_csum(sb)) != md_csum_fold(sb->sb_csum)) { if (md_csum_fold(calc_sb_csum(sb)) != md_csum_fold(sb->sb_csum)) {
printk(KERN_WARNING "md: invalid superblock checksum on %s\n", pr_warn("md: invalid superblock checksum on %s\n", b);
b);
goto abort; goto abort;
} }
...@@ -1001,14 +1010,13 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor ...@@ -1001,14 +1010,13 @@ static int super_90_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor
__u64 ev1, ev2; __u64 ev1, ev2;
mdp_super_t *refsb = page_address(refdev->sb_page); mdp_super_t *refsb = page_address(refdev->sb_page);
if (!uuid_equal(refsb, sb)) { if (!uuid_equal(refsb, sb)) {
printk(KERN_WARNING "md: %s has different UUID to %s\n", pr_warn("md: %s has different UUID to %s\n",
b, bdevname(refdev->bdev,b2)); b, bdevname(refdev->bdev,b2));
goto abort; goto abort;
} }
if (!sb_equal(refsb, sb)) { if (!sb_equal(refsb, sb)) {
printk(KERN_WARNING "md: %s has same UUID" pr_warn("md: %s has same UUID but different superblock to %s\n",
" but different superblock to %s\n", b, bdevname(refdev->bdev, b2));
b, bdevname(refdev->bdev, b2));
goto abort; goto abort;
} }
ev1 = md_event(sb); ev1 = md_event(sb);
...@@ -1410,13 +1418,13 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_ ...@@ -1410,13 +1418,13 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_
return -EINVAL; return -EINVAL;
if (calc_sb_1_csum(sb) != sb->sb_csum) { if (calc_sb_1_csum(sb) != sb->sb_csum) {
printk("md: invalid superblock checksum on %s\n", pr_warn("md: invalid superblock checksum on %s\n",
bdevname(rdev->bdev,b)); bdevname(rdev->bdev,b));
return -EINVAL; return -EINVAL;
} }
if (le64_to_cpu(sb->data_size) < 10) { if (le64_to_cpu(sb->data_size) < 10) {
printk("md: data_size too small on %s\n", pr_warn("md: data_size too small on %s\n",
bdevname(rdev->bdev,b)); bdevname(rdev->bdev,b));
return -EINVAL; return -EINVAL;
} }
if (sb->pad0 || if (sb->pad0 ||
...@@ -1500,8 +1508,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_ ...@@ -1500,8 +1508,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_
sb->level != refsb->level || sb->level != refsb->level ||
sb->layout != refsb->layout || sb->layout != refsb->layout ||
sb->chunksize != refsb->chunksize) { sb->chunksize != refsb->chunksize) {
printk(KERN_WARNING "md: %s has strangely different" pr_warn("md: %s has strangely different superblock to %s\n",
" superblock to %s\n",
bdevname(rdev->bdev,b), bdevname(rdev->bdev,b),
bdevname(refdev->bdev,b2)); bdevname(refdev->bdev,b2));
return -EINVAL; return -EINVAL;
...@@ -1643,8 +1650,7 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev) ...@@ -1643,8 +1650,7 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev)
case MD_DISK_ROLE_JOURNAL: /* journal device */ case MD_DISK_ROLE_JOURNAL: /* journal device */
if (!(le32_to_cpu(sb->feature_map) & MD_FEATURE_JOURNAL)) { if (!(le32_to_cpu(sb->feature_map) & MD_FEATURE_JOURNAL)) {
/* journal device without journal feature */ /* journal device without journal feature */
printk(KERN_WARNING pr_warn("md: journal device provided without journal feature, ignoring the device\n");
"md: journal device provided without journal feature, ignoring the device\n");
return -EINVAL; return -EINVAL;
} }
set_bit(Journal, &rdev->flags); set_bit(Journal, &rdev->flags);
...@@ -2001,9 +2007,9 @@ int md_integrity_register(struct mddev *mddev) ...@@ -2001,9 +2007,9 @@ int md_integrity_register(struct mddev *mddev)
blk_integrity_register(mddev->gendisk, blk_integrity_register(mddev->gendisk,
bdev_get_integrity(reference->bdev)); bdev_get_integrity(reference->bdev));
printk(KERN_NOTICE "md: data integrity enabled on %s\n", mdname(mddev)); pr_debug("md: data integrity enabled on %s\n", mdname(mddev));
if (bioset_integrity_create(mddev->bio_set, BIO_POOL_SIZE)) { if (bioset_integrity_create(mddev->bio_set, BIO_POOL_SIZE)) {
printk(KERN_ERR "md: failed to create integrity pool for %s\n", pr_err("md: failed to create integrity pool for %s\n",
mdname(mddev)); mdname(mddev));
return -EINVAL; return -EINVAL;
} }
...@@ -2031,8 +2037,8 @@ int md_integrity_add_rdev(struct md_rdev *rdev, struct mddev *mddev) ...@@ -2031,8 +2037,8 @@ int md_integrity_add_rdev(struct md_rdev *rdev, struct mddev *mddev)
return 0; return 0;
if (blk_integrity_compare(mddev->gendisk, rdev->bdev->bd_disk) != 0) { if (blk_integrity_compare(mddev->gendisk, rdev->bdev->bd_disk) != 0) {
printk(KERN_NOTICE "%s: incompatible integrity profile for %s\n", pr_err("%s: incompatible integrity profile for %s\n",
mdname(mddev), bdevname(rdev->bdev, name)); mdname(mddev), bdevname(rdev->bdev, name));
return -ENXIO; return -ENXIO;
} }
...@@ -2086,15 +2092,15 @@ static int bind_rdev_to_array(struct md_rdev *rdev, struct mddev *mddev) ...@@ -2086,15 +2092,15 @@ static int bind_rdev_to_array(struct md_rdev *rdev, struct mddev *mddev)
rcu_read_unlock(); rcu_read_unlock();
if (!test_bit(Journal, &rdev->flags) && if (!test_bit(Journal, &rdev->flags) &&
mddev->max_disks && rdev->desc_nr >= mddev->max_disks) { mddev->max_disks && rdev->desc_nr >= mddev->max_disks) {
printk(KERN_WARNING "md: %s: array is limited to %d devices\n", pr_warn("md: %s: array is limited to %d devices\n",
mdname(mddev), mddev->max_disks); mdname(mddev), mddev->max_disks);
return -EBUSY; return -EBUSY;
} }
bdevname(rdev->bdev,b); bdevname(rdev->bdev,b);
strreplace(b, '/', '!'); strreplace(b, '/', '!');
rdev->mddev = mddev; rdev->mddev = mddev;
printk(KERN_INFO "md: bind<%s>\n", b); pr_debug("md: bind<%s>\n", b);
if ((err = kobject_add(&rdev->kobj, &mddev->kobj, "dev-%s", b))) if ((err = kobject_add(&rdev->kobj, &mddev->kobj, "dev-%s", b)))
goto fail; goto fail;
...@@ -2113,8 +2119,8 @@ static int bind_rdev_to_array(struct md_rdev *rdev, struct mddev *mddev) ...@@ -2113,8 +2119,8 @@ static int bind_rdev_to_array(struct md_rdev *rdev, struct mddev *mddev)
return 0; return 0;
fail: fail:
printk(KERN_WARNING "md: failed to register dev-%s for %s\n", pr_warn("md: failed to register dev-%s for %s\n",
b, mdname(mddev)); b, mdname(mddev));
return err; return err;
} }
...@@ -2131,7 +2137,7 @@ static void unbind_rdev_from_array(struct md_rdev *rdev) ...@@ -2131,7 +2137,7 @@ static void unbind_rdev_from_array(struct md_rdev *rdev)
bd_unlink_disk_holder(rdev->bdev, rdev->mddev->gendisk); bd_unlink_disk_holder(rdev->bdev, rdev->mddev->gendisk);
list_del_rcu(&rdev->same_set); list_del_rcu(&rdev->same_set);
printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b)); pr_debug("md: unbind<%s>\n", bdevname(rdev->bdev,b));
rdev->mddev = NULL; rdev->mddev = NULL;
sysfs_remove_link(&rdev->kobj, "block"); sysfs_remove_link(&rdev->kobj, "block");
sysfs_put(rdev->sysfs_state); sysfs_put(rdev->sysfs_state);
...@@ -2161,8 +2167,7 @@ static int lock_rdev(struct md_rdev *rdev, dev_t dev, int shared) ...@@ -2161,8 +2167,7 @@ static int lock_rdev(struct md_rdev *rdev, dev_t dev, int shared)
bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL,
shared ? (struct md_rdev *)lock_rdev : rdev); shared ? (struct md_rdev *)lock_rdev : rdev);
if (IS_ERR(bdev)) { if (IS_ERR(bdev)) {
printk(KERN_ERR "md: could not open %s.\n", pr_warn("md: could not open %s.\n", __bdevname(dev, b));
__bdevname(dev, b));
return PTR_ERR(bdev); return PTR_ERR(bdev);
} }
rdev->bdev = bdev; rdev->bdev = bdev;
...@@ -2182,8 +2187,7 @@ static void export_rdev(struct md_rdev *rdev) ...@@ -2182,8 +2187,7 @@ static void export_rdev(struct md_rdev *rdev)
{ {
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
printk(KERN_INFO "md: export_rdev(%s)\n", pr_debug("md: export_rdev(%s)\n", bdevname(rdev->bdev,b));
bdevname(rdev->bdev,b));
md_rdev_clear(rdev); md_rdev_clear(rdev);
#ifndef MODULE #ifndef MODULE
if (test_bit(AutoDetected, &rdev->flags)) if (test_bit(AutoDetected, &rdev->flags))
...@@ -3204,10 +3208,8 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe ...@@ -3204,10 +3208,8 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe
sector_t size; sector_t size;
rdev = kzalloc(sizeof(*rdev), GFP_KERNEL); rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
if (!rdev) { if (!rdev)
printk(KERN_ERR "md: could not alloc mem for new device!\n");
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
}
err = md_rdev_init(rdev); err = md_rdev_init(rdev);
if (err) if (err)
...@@ -3224,8 +3226,7 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe ...@@ -3224,8 +3226,7 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe
size = i_size_read(rdev->bdev->bd_inode) >> BLOCK_SIZE_BITS; size = i_size_read(rdev->bdev->bd_inode) >> BLOCK_SIZE_BITS;
if (!size) { if (!size) {
printk(KERN_WARNING pr_warn("md: %s has zero or unknown size, marking faulty!\n",
"md: %s has zero or unknown size, marking faulty!\n",
bdevname(rdev->bdev,b)); bdevname(rdev->bdev,b));
err = -EINVAL; err = -EINVAL;
goto abort_free; goto abort_free;
...@@ -3235,16 +3236,13 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe ...@@ -3235,16 +3236,13 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe
err = super_types[super_format]. err = super_types[super_format].
load_super(rdev, NULL, super_minor); load_super(rdev, NULL, super_minor);
if (err == -EINVAL) { if (err == -EINVAL) {
printk(KERN_WARNING pr_warn("md: %s does not have a valid v%d.%d superblock, not importing!\n",
"md: %s does not have a valid v%d.%d "
"superblock, not importing!\n",
bdevname(rdev->bdev,b), bdevname(rdev->bdev,b),
super_format, super_minor); super_format, super_minor);
goto abort_free; goto abort_free;
} }
if (err < 0) { if (err < 0) {
printk(KERN_WARNING pr_warn("md: could not read %s's sb, not importing!\n",
"md: could not read %s's sb, not importing!\n",
bdevname(rdev->bdev,b)); bdevname(rdev->bdev,b));
goto abort_free; goto abort_free;
} }
...@@ -3280,9 +3278,7 @@ static void analyze_sbs(struct mddev *mddev) ...@@ -3280,9 +3278,7 @@ static void analyze_sbs(struct mddev *mddev)
case 0: case 0:
break; break;
default: default:
printk( KERN_ERR \ pr_warn("md: fatal superblock inconsistency in %s -- removing from array\n",
"md: fatal superblock inconsistency in %s"
" -- removing from array\n",
bdevname(rdev->bdev,b)); bdevname(rdev->bdev,b));
md_kick_rdev_from_array(rdev); md_kick_rdev_from_array(rdev);
} }
...@@ -3295,18 +3291,16 @@ static void analyze_sbs(struct mddev *mddev) ...@@ -3295,18 +3291,16 @@ static void analyze_sbs(struct mddev *mddev)
if (mddev->max_disks && if (mddev->max_disks &&
(rdev->desc_nr >= mddev->max_disks || (rdev->desc_nr >= mddev->max_disks ||
i > mddev->max_disks)) { i > mddev->max_disks)) {
printk(KERN_WARNING pr_warn("md: %s: %s: only %d devices permitted\n",
"md: %s: %s: only %d devices permitted\n", mdname(mddev), bdevname(rdev->bdev, b),
mdname(mddev), bdevname(rdev->bdev, b), mddev->max_disks);
mddev->max_disks);
md_kick_rdev_from_array(rdev); md_kick_rdev_from_array(rdev);
continue; continue;
} }
if (rdev != freshest) { if (rdev != freshest) {
if (super_types[mddev->major_version]. if (super_types[mddev->major_version].
validate_super(mddev, rdev)) { validate_super(mddev, rdev)) {
printk(KERN_WARNING "md: kicking non-fresh %s" pr_warn("md: kicking non-fresh %s from array!\n",
" from array!\n",
bdevname(rdev->bdev,b)); bdevname(rdev->bdev,b));
md_kick_rdev_from_array(rdev); md_kick_rdev_from_array(rdev);
continue; continue;
...@@ -3377,7 +3371,7 @@ safe_delay_store(struct mddev *mddev, const char *cbuf, size_t len) ...@@ -3377,7 +3371,7 @@ safe_delay_store(struct mddev *mddev, const char *cbuf, size_t len)
unsigned long msec; unsigned long msec;
if (mddev_is_clustered(mddev)) { if (mddev_is_clustered(mddev)) {
pr_info("md: Safemode is disabled for clustered mode\n"); pr_warn("md: Safemode is disabled for clustered mode\n");
return -EINVAL; return -EINVAL;
} }
...@@ -3465,8 +3459,8 @@ level_store(struct mddev *mddev, const char *buf, size_t len) ...@@ -3465,8 +3459,8 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
rv = -EINVAL; rv = -EINVAL;
if (!mddev->pers->quiesce) { if (!mddev->pers->quiesce) {
printk(KERN_WARNING "md: %s: %s does not support online personality change\n", pr_warn("md: %s: %s does not support online personality change\n",
mdname(mddev), mddev->pers->name); mdname(mddev), mddev->pers->name);
goto out_unlock; goto out_unlock;
} }
...@@ -3484,7 +3478,7 @@ level_store(struct mddev *mddev, const char *buf, size_t len) ...@@ -3484,7 +3478,7 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
pers = find_pers(level, clevel); pers = find_pers(level, clevel);
if (!pers || !try_module_get(pers->owner)) { if (!pers || !try_module_get(pers->owner)) {
spin_unlock(&pers_lock); spin_unlock(&pers_lock);
printk(KERN_WARNING "md: personality %s not loaded\n", clevel); pr_warn("md: personality %s not loaded\n", clevel);
rv = -EINVAL; rv = -EINVAL;
goto out_unlock; goto out_unlock;
} }
...@@ -3498,8 +3492,8 @@ level_store(struct mddev *mddev, const char *buf, size_t len) ...@@ -3498,8 +3492,8 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
} }
if (!pers->takeover) { if (!pers->takeover) {
module_put(pers->owner); module_put(pers->owner);
printk(KERN_WARNING "md: %s: %s does not support personality takeover\n", pr_warn("md: %s: %s does not support personality takeover\n",
mdname(mddev), clevel); mdname(mddev), clevel);
rv = -EINVAL; rv = -EINVAL;
goto out_unlock; goto out_unlock;
} }
...@@ -3519,8 +3513,8 @@ level_store(struct mddev *mddev, const char *buf, size_t len) ...@@ -3519,8 +3513,8 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
mddev->delta_disks = 0; mddev->delta_disks = 0;
mddev->reshape_backwards = 0; mddev->reshape_backwards = 0;
module_put(pers->owner); module_put(pers->owner);
printk(KERN_WARNING "md: %s: %s would not accept array\n", pr_warn("md: %s: %s would not accept array\n",
mdname(mddev), clevel); mdname(mddev), clevel);
rv = PTR_ERR(priv); rv = PTR_ERR(priv);
goto out_unlock; goto out_unlock;
} }
...@@ -3563,9 +3557,8 @@ level_store(struct mddev *mddev, const char *buf, size_t len) ...@@ -3563,9 +3557,8 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
pers->sync_request != NULL) { pers->sync_request != NULL) {
/* need to add the md_redundancy_group */ /* need to add the md_redundancy_group */
if (sysfs_create_group(&mddev->kobj, &md_redundancy_group)) if (sysfs_create_group(&mddev->kobj, &md_redundancy_group))
printk(KERN_WARNING pr_warn("md: cannot register extra attributes for %s\n",
"md: cannot register extra attributes for %s\n", mdname(mddev));
mdname(mddev));
mddev->sysfs_action = sysfs_get_dirent(mddev->kobj.sd, "sync_action"); mddev->sysfs_action = sysfs_get_dirent(mddev->kobj.sd, "sync_action");
} }
if (oldpers->sync_request != NULL && if (oldpers->sync_request != NULL &&
...@@ -3596,9 +3589,8 @@ level_store(struct mddev *mddev, const char *buf, size_t len) ...@@ -3596,9 +3589,8 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
clear_bit(In_sync, &rdev->flags); clear_bit(In_sync, &rdev->flags);
else { else {
if (sysfs_link_rdev(mddev, rdev)) if (sysfs_link_rdev(mddev, rdev))
printk(KERN_WARNING "md: cannot register rd%d" pr_warn("md: cannot register rd%d for %s after level change\n",
" for %s after level change\n", rdev->raid_disk, mdname(mddev));
rdev->raid_disk, mdname(mddev));
} }
} }
...@@ -5065,13 +5057,13 @@ static int md_alloc(dev_t dev, char *name) ...@@ -5065,13 +5057,13 @@ static int md_alloc(dev_t dev, char *name)
/* This isn't possible, but as kobject_init_and_add is marked /* This isn't possible, but as kobject_init_and_add is marked
* __must_check, we must do something with the result * __must_check, we must do something with the result
*/ */
printk(KERN_WARNING "md: cannot register %s/md - name in use\n", pr_debug("md: cannot register %s/md - name in use\n",
disk->disk_name); disk->disk_name);
error = 0; error = 0;
} }
if (mddev->kobj.sd && if (mddev->kobj.sd &&
sysfs_create_group(&mddev->kobj, &md_bitmap_group)) sysfs_create_group(&mddev->kobj, &md_bitmap_group))
printk(KERN_DEBUG "pointless warning\n"); pr_debug("pointless warning\n");
mutex_unlock(&mddev->open_mutex); mutex_unlock(&mddev->open_mutex);
abort: abort:
mutex_unlock(&disks_mutex); mutex_unlock(&disks_mutex);
...@@ -5173,15 +5165,15 @@ int md_run(struct mddev *mddev) ...@@ -5173,15 +5165,15 @@ int md_run(struct mddev *mddev)
if (mddev->dev_sectors && if (mddev->dev_sectors &&
rdev->data_offset + mddev->dev_sectors rdev->data_offset + mddev->dev_sectors
> rdev->sb_start) { > rdev->sb_start) {
printk("md: %s: data overlaps metadata\n", pr_warn("md: %s: data overlaps metadata\n",
mdname(mddev)); mdname(mddev));
return -EINVAL; return -EINVAL;
} }
} else { } else {
if (rdev->sb_start + rdev->sb_size/512 if (rdev->sb_start + rdev->sb_size/512
> rdev->data_offset) { > rdev->data_offset) {
printk("md: %s: metadata overlaps data\n", pr_warn("md: %s: metadata overlaps data\n",
mdname(mddev)); mdname(mddev));
return -EINVAL; return -EINVAL;
} }
} }
...@@ -5196,11 +5188,11 @@ int md_run(struct mddev *mddev) ...@@ -5196,11 +5188,11 @@ int md_run(struct mddev *mddev)
if (!pers || !try_module_get(pers->owner)) { if (!pers || !try_module_get(pers->owner)) {
spin_unlock(&pers_lock); spin_unlock(&pers_lock);
if (mddev->level != LEVEL_NONE) if (mddev->level != LEVEL_NONE)
printk(KERN_WARNING "md: personality for level %d is not loaded!\n", pr_warn("md: personality for level %d is not loaded!\n",
mddev->level); mddev->level);
else else
printk(KERN_WARNING "md: personality for level %s is not loaded!\n", pr_warn("md: personality for level %s is not loaded!\n",
mddev->clevel); mddev->clevel);
return -EINVAL; return -EINVAL;
} }
spin_unlock(&pers_lock); spin_unlock(&pers_lock);
...@@ -5230,21 +5222,16 @@ int md_run(struct mddev *mddev) ...@@ -5230,21 +5222,16 @@ int md_run(struct mddev *mddev)
if (rdev < rdev2 && if (rdev < rdev2 &&
rdev->bdev->bd_contains == rdev->bdev->bd_contains ==
rdev2->bdev->bd_contains) { rdev2->bdev->bd_contains) {
printk(KERN_WARNING pr_warn("%s: WARNING: %s appears to be on the same physical disk as %s.\n",
"%s: WARNING: %s appears to be" mdname(mddev),
" on the same physical disk as" bdevname(rdev->bdev,b),
" %s.\n", bdevname(rdev2->bdev,b2));
mdname(mddev),
bdevname(rdev->bdev,b),
bdevname(rdev2->bdev,b2));
warned = 1; warned = 1;
} }
} }
if (warned) if (warned)
printk(KERN_WARNING pr_warn("True protection against single-disk failure might be compromised.\n");
"True protection against single-disk"
" failure might be compromised.\n");
} }
mddev->recovery = 0; mddev->recovery = 0;
...@@ -5258,14 +5245,14 @@ int md_run(struct mddev *mddev) ...@@ -5258,14 +5245,14 @@ int md_run(struct mddev *mddev)
err = pers->run(mddev); err = pers->run(mddev);
if (err) if (err)
printk(KERN_ERR "md: pers->run() failed ...\n"); pr_warn("md: pers->run() failed ...\n");
else if (pers->size(mddev, 0, 0) < mddev->array_sectors) { else if (pers->size(mddev, 0, 0) < mddev->array_sectors) {
WARN_ONCE(!mddev->external_size, "%s: default size too small," WARN_ONCE(!mddev->external_size,
" but 'external_size' not in effect?\n", __func__); "%s: default size too small, but 'external_size' not in effect?\n",
printk(KERN_ERR __func__);
"md: invalid array_size %llu > default size %llu\n", pr_warn("md: invalid array_size %llu > default size %llu\n",
(unsigned long long)mddev->array_sectors / 2, (unsigned long long)mddev->array_sectors / 2,
(unsigned long long)pers->size(mddev, 0, 0) / 2); (unsigned long long)pers->size(mddev, 0, 0) / 2);
err = -EINVAL; err = -EINVAL;
} }
if (err == 0 && pers->sync_request && if (err == 0 && pers->sync_request &&
...@@ -5275,8 +5262,8 @@ int md_run(struct mddev *mddev) ...@@ -5275,8 +5262,8 @@ int md_run(struct mddev *mddev)
bitmap = bitmap_create(mddev, -1); bitmap = bitmap_create(mddev, -1);
if (IS_ERR(bitmap)) { if (IS_ERR(bitmap)) {
err = PTR_ERR(bitmap); err = PTR_ERR(bitmap);
printk(KERN_ERR "%s: failed to create bitmap (%d)\n", pr_warn("%s: failed to create bitmap (%d)\n",
mdname(mddev), err); mdname(mddev), err);
} else } else
mddev->bitmap = bitmap; mddev->bitmap = bitmap;
...@@ -5312,9 +5299,8 @@ int md_run(struct mddev *mddev) ...@@ -5312,9 +5299,8 @@ int md_run(struct mddev *mddev)
if (pers->sync_request) { if (pers->sync_request) {
if (mddev->kobj.sd && if (mddev->kobj.sd &&
sysfs_create_group(&mddev->kobj, &md_redundancy_group)) sysfs_create_group(&mddev->kobj, &md_redundancy_group))
printk(KERN_WARNING pr_warn("md: cannot register extra attributes for %s\n",
"md: cannot register extra attributes for %s\n", mdname(mddev));
mdname(mddev));
mddev->sysfs_action = sysfs_get_dirent_safe(mddev->kobj.sd, "sync_action"); mddev->sysfs_action = sysfs_get_dirent_safe(mddev->kobj.sd, "sync_action");
} else if (mddev->ro == 2) /* auto-readonly not meaningful */ } else if (mddev->ro == 2) /* auto-readonly not meaningful */
mddev->ro = 0; mddev->ro = 0;
...@@ -5415,8 +5401,7 @@ static int restart_array(struct mddev *mddev) ...@@ -5415,8 +5401,7 @@ static int restart_array(struct mddev *mddev)
mddev->safemode = 0; mddev->safemode = 0;
mddev->ro = 0; mddev->ro = 0;
set_disk_ro(disk, 0); set_disk_ro(disk, 0);
printk(KERN_INFO "md: %s switched to read-write mode.\n", pr_debug("md: %s switched to read-write mode.\n", mdname(mddev));
mdname(mddev));
/* Kick recovery or resync if necessary */ /* Kick recovery or resync if necessary */
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
md_wakeup_thread(mddev->thread); md_wakeup_thread(mddev->thread);
...@@ -5510,8 +5495,8 @@ static void mddev_detach(struct mddev *mddev) ...@@ -5510,8 +5495,8 @@ static void mddev_detach(struct mddev *mddev)
struct bitmap *bitmap = mddev->bitmap; struct bitmap *bitmap = mddev->bitmap;
/* wait for behind writes to complete */ /* wait for behind writes to complete */
if (bitmap && atomic_read(&bitmap->behind_writes) > 0) { if (bitmap && atomic_read(&bitmap->behind_writes) > 0) {
printk(KERN_INFO "md:%s: behind writes in progress - waiting to stop.\n", pr_debug("md:%s: behind writes in progress - waiting to stop.\n",
mdname(mddev)); mdname(mddev));
/* need to kick something here to make sure I/O goes? */ /* need to kick something here to make sure I/O goes? */
wait_event(bitmap->behind_wait, wait_event(bitmap->behind_wait,
atomic_read(&bitmap->behind_writes) == 0); atomic_read(&bitmap->behind_writes) == 0);
...@@ -5585,7 +5570,7 @@ static int md_set_readonly(struct mddev *mddev, struct block_device *bdev) ...@@ -5585,7 +5570,7 @@ static int md_set_readonly(struct mddev *mddev, struct block_device *bdev)
if ((mddev->pers && atomic_read(&mddev->openers) > !!bdev) || if ((mddev->pers && atomic_read(&mddev->openers) > !!bdev) ||
mddev->sync_thread || mddev->sync_thread ||
test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) { test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) {
printk("md: %s still in use.\n",mdname(mddev)); pr_warn("md: %s still in use.\n",mdname(mddev));
if (did_freeze) { if (did_freeze) {
clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
...@@ -5647,7 +5632,7 @@ static int do_md_stop(struct mddev *mddev, int mode, ...@@ -5647,7 +5632,7 @@ static int do_md_stop(struct mddev *mddev, int mode,
mddev->sysfs_active || mddev->sysfs_active ||
mddev->sync_thread || mddev->sync_thread ||
test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) { test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) {
printk("md: %s still in use.\n",mdname(mddev)); pr_warn("md: %s still in use.\n",mdname(mddev));
mutex_unlock(&mddev->open_mutex); mutex_unlock(&mddev->open_mutex);
if (did_freeze) { if (did_freeze) {
clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
...@@ -5684,7 +5669,7 @@ static int do_md_stop(struct mddev *mddev, int mode, ...@@ -5684,7 +5669,7 @@ static int do_md_stop(struct mddev *mddev, int mode,
* Free resources if final stop * Free resources if final stop
*/ */
if (mode == 0) { if (mode == 0) {
printk(KERN_INFO "md: %s stopped.\n", mdname(mddev)); pr_info("md: %s stopped.\n", mdname(mddev));
bitmap_destroy(mddev); bitmap_destroy(mddev);
if (mddev->bitmap_info.file) { if (mddev->bitmap_info.file) {
...@@ -5716,17 +5701,17 @@ static void autorun_array(struct mddev *mddev) ...@@ -5716,17 +5701,17 @@ static void autorun_array(struct mddev *mddev)
if (list_empty(&mddev->disks)) if (list_empty(&mddev->disks))
return; return;
printk(KERN_INFO "md: running: "); pr_info("md: running: ");
rdev_for_each(rdev, mddev) { rdev_for_each(rdev, mddev) {
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
printk("<%s>", bdevname(rdev->bdev,b)); pr_cont("<%s>", bdevname(rdev->bdev,b));
} }
printk("\n"); pr_cont("\n");
err = do_md_run(mddev); err = do_md_run(mddev);
if (err) { if (err) {
printk(KERN_WARNING "md: do_md_run() returned %d\n", err); pr_warn("md: do_md_run() returned %d\n", err);
do_md_stop(mddev, 0, NULL); do_md_stop(mddev, 0, NULL);
} }
} }
...@@ -5749,7 +5734,7 @@ static void autorun_devices(int part) ...@@ -5749,7 +5734,7 @@ static void autorun_devices(int part)
struct mddev *mddev; struct mddev *mddev;
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
printk(KERN_INFO "md: autorun ...\n"); pr_info("md: autorun ...\n");
while (!list_empty(&pending_raid_disks)) { while (!list_empty(&pending_raid_disks)) {
int unit; int unit;
dev_t dev; dev_t dev;
...@@ -5757,13 +5742,12 @@ static void autorun_devices(int part) ...@@ -5757,13 +5742,12 @@ static void autorun_devices(int part)
rdev0 = list_entry(pending_raid_disks.next, rdev0 = list_entry(pending_raid_disks.next,
struct md_rdev, same_set); struct md_rdev, same_set);
printk(KERN_INFO "md: considering %s ...\n", pr_debug("md: considering %s ...\n", bdevname(rdev0->bdev,b));
bdevname(rdev0->bdev,b));
INIT_LIST_HEAD(&candidates); INIT_LIST_HEAD(&candidates);
rdev_for_each_list(rdev, tmp, &pending_raid_disks) rdev_for_each_list(rdev, tmp, &pending_raid_disks)
if (super_90_load(rdev, rdev0, 0) >= 0) { if (super_90_load(rdev, rdev0, 0) >= 0) {
printk(KERN_INFO "md: adding %s ...\n", pr_debug("md: adding %s ...\n",
bdevname(rdev->bdev,b)); bdevname(rdev->bdev,b));
list_move(&rdev->same_set, &candidates); list_move(&rdev->same_set, &candidates);
} }
/* /*
...@@ -5780,8 +5764,8 @@ static void autorun_devices(int part) ...@@ -5780,8 +5764,8 @@ static void autorun_devices(int part)
unit = MINOR(dev); unit = MINOR(dev);
} }
if (rdev0->preferred_minor != unit) { if (rdev0->preferred_minor != unit) {
printk(KERN_INFO "md: unit number in %s is bad: %d\n", pr_warn("md: unit number in %s is bad: %d\n",
bdevname(rdev0->bdev, b), rdev0->preferred_minor); bdevname(rdev0->bdev, b), rdev0->preferred_minor);
break; break;
} }
...@@ -5790,21 +5774,17 @@ static void autorun_devices(int part) ...@@ -5790,21 +5774,17 @@ static void autorun_devices(int part)
if (!mddev || !mddev->gendisk) { if (!mddev || !mddev->gendisk) {
if (mddev) if (mddev)
mddev_put(mddev); mddev_put(mddev);
printk(KERN_ERR
"md: cannot allocate memory for md drive.\n");
break; break;
} }
if (mddev_lock(mddev)) if (mddev_lock(mddev))
printk(KERN_WARNING "md: %s locked, cannot run\n", pr_warn("md: %s locked, cannot run\n", mdname(mddev));
mdname(mddev));
else if (mddev->raid_disks || mddev->major_version else if (mddev->raid_disks || mddev->major_version
|| !list_empty(&mddev->disks)) { || !list_empty(&mddev->disks)) {
printk(KERN_WARNING pr_warn("md: %s already running, cannot run %s\n",
"md: %s already running, cannot run %s\n",
mdname(mddev), bdevname(rdev0->bdev,b)); mdname(mddev), bdevname(rdev0->bdev,b));
mddev_unlock(mddev); mddev_unlock(mddev);
} else { } else {
printk(KERN_INFO "md: created %s\n", mdname(mddev)); pr_debug("md: created %s\n", mdname(mddev));
mddev->persistent = 1; mddev->persistent = 1;
rdev_for_each_list(rdev, tmp, &candidates) { rdev_for_each_list(rdev, tmp, &candidates) {
list_del_init(&rdev->same_set); list_del_init(&rdev->same_set);
...@@ -5823,7 +5803,7 @@ static void autorun_devices(int part) ...@@ -5823,7 +5803,7 @@ static void autorun_devices(int part)
} }
mddev_put(mddev); mddev_put(mddev);
} }
printk(KERN_INFO "md: ... autorun DONE.\n"); pr_info("md: ... autorun DONE.\n");
} }
#endif /* !MODULE */ #endif /* !MODULE */
...@@ -5979,8 +5959,8 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info) ...@@ -5979,8 +5959,8 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info)
if (mddev_is_clustered(mddev) && if (mddev_is_clustered(mddev) &&
!(info->state & ((1 << MD_DISK_CLUSTER_ADD) | (1 << MD_DISK_CANDIDATE)))) { !(info->state & ((1 << MD_DISK_CLUSTER_ADD) | (1 << MD_DISK_CANDIDATE)))) {
pr_err("%s: Cannot add to clustered mddev.\n", pr_warn("%s: Cannot add to clustered mddev.\n",
mdname(mddev)); mdname(mddev));
return -EINVAL; return -EINVAL;
} }
...@@ -5992,8 +5972,7 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info) ...@@ -5992,8 +5972,7 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info)
/* expecting a device which has a superblock */ /* expecting a device which has a superblock */
rdev = md_import_device(dev, mddev->major_version, mddev->minor_version); rdev = md_import_device(dev, mddev->major_version, mddev->minor_version);
if (IS_ERR(rdev)) { if (IS_ERR(rdev)) {
printk(KERN_WARNING pr_warn("md: md_import_device returned %ld\n",
"md: md_import_device returned %ld\n",
PTR_ERR(rdev)); PTR_ERR(rdev));
return PTR_ERR(rdev); return PTR_ERR(rdev);
} }
...@@ -6004,8 +5983,7 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info) ...@@ -6004,8 +5983,7 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info)
err = super_types[mddev->major_version] err = super_types[mddev->major_version]
.load_super(rdev, rdev0, mddev->minor_version); .load_super(rdev, rdev0, mddev->minor_version);
if (err < 0) { if (err < 0) {
printk(KERN_WARNING pr_warn("md: %s has different UUID to %s\n",
"md: %s has different UUID to %s\n",
bdevname(rdev->bdev,b), bdevname(rdev->bdev,b),
bdevname(rdev0->bdev,b2)); bdevname(rdev0->bdev,b2));
export_rdev(rdev); export_rdev(rdev);
...@@ -6026,9 +6004,8 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info) ...@@ -6026,9 +6004,8 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info)
if (mddev->pers) { if (mddev->pers) {
int err; int err;
if (!mddev->pers->hot_add_disk) { if (!mddev->pers->hot_add_disk) {
printk(KERN_WARNING pr_warn("%s: personality does not support diskops!\n",
"%s: personality does not support diskops!\n", mdname(mddev));
mdname(mddev));
return -EINVAL; return -EINVAL;
} }
if (mddev->persistent) if (mddev->persistent)
...@@ -6037,8 +6014,7 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info) ...@@ -6037,8 +6014,7 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info)
else else
rdev = md_import_device(dev, -1, -1); rdev = md_import_device(dev, -1, -1);
if (IS_ERR(rdev)) { if (IS_ERR(rdev)) {
printk(KERN_WARNING pr_warn("md: md_import_device returned %ld\n",
"md: md_import_device returned %ld\n",
PTR_ERR(rdev)); PTR_ERR(rdev));
return PTR_ERR(rdev); return PTR_ERR(rdev);
} }
...@@ -6134,8 +6110,7 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info) ...@@ -6134,8 +6110,7 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info)
* for major_version==0 superblocks * for major_version==0 superblocks
*/ */
if (mddev->major_version != 0) { if (mddev->major_version != 0) {
printk(KERN_WARNING "%s: ADD_NEW_DISK not supported\n", pr_warn("%s: ADD_NEW_DISK not supported\n", mdname(mddev));
mdname(mddev));
return -EINVAL; return -EINVAL;
} }
...@@ -6143,8 +6118,7 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info) ...@@ -6143,8 +6118,7 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info)
int err; int err;
rdev = md_import_device(dev, -1, 0); rdev = md_import_device(dev, -1, 0);
if (IS_ERR(rdev)) { if (IS_ERR(rdev)) {
printk(KERN_WARNING pr_warn("md: error, md_import_device() returned %ld\n",
"md: error, md_import_device() returned %ld\n",
PTR_ERR(rdev)); PTR_ERR(rdev));
return PTR_ERR(rdev); return PTR_ERR(rdev);
} }
...@@ -6162,7 +6136,7 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info) ...@@ -6162,7 +6136,7 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info)
set_bit(WriteMostly, &rdev->flags); set_bit(WriteMostly, &rdev->flags);
if (!mddev->persistent) { if (!mddev->persistent) {
printk(KERN_INFO "md: nonpersistent superblock ...\n"); pr_debug("md: nonpersistent superblock ...\n");
rdev->sb_start = i_size_read(rdev->bdev->bd_inode) / 512; rdev->sb_start = i_size_read(rdev->bdev->bd_inode) / 512;
} else } else
rdev->sb_start = calc_dev_sboffset(rdev); rdev->sb_start = calc_dev_sboffset(rdev);
...@@ -6206,8 +6180,8 @@ static int hot_remove_disk(struct mddev *mddev, dev_t dev) ...@@ -6206,8 +6180,8 @@ static int hot_remove_disk(struct mddev *mddev, dev_t dev)
return 0; return 0;
busy: busy:
printk(KERN_WARNING "md: cannot remove active disk %s from %s ...\n", pr_debug("md: cannot remove active disk %s from %s ...\n",
bdevname(rdev->bdev,b), mdname(mddev)); bdevname(rdev->bdev,b), mdname(mddev));
return -EBUSY; return -EBUSY;
} }
...@@ -6221,22 +6195,19 @@ static int hot_add_disk(struct mddev *mddev, dev_t dev) ...@@ -6221,22 +6195,19 @@ static int hot_add_disk(struct mddev *mddev, dev_t dev)
return -ENODEV; return -ENODEV;
if (mddev->major_version != 0) { if (mddev->major_version != 0) {
printk(KERN_WARNING "%s: HOT_ADD may only be used with" pr_warn("%s: HOT_ADD may only be used with version-0 superblocks.\n",
" version-0 superblocks.\n",
mdname(mddev)); mdname(mddev));
return -EINVAL; return -EINVAL;
} }
if (!mddev->pers->hot_add_disk) { if (!mddev->pers->hot_add_disk) {
printk(KERN_WARNING pr_warn("%s: personality does not support diskops!\n",
"%s: personality does not support diskops!\n",
mdname(mddev)); mdname(mddev));
return -EINVAL; return -EINVAL;
} }
rdev = md_import_device(dev, -1, 0); rdev = md_import_device(dev, -1, 0);
if (IS_ERR(rdev)) { if (IS_ERR(rdev)) {
printk(KERN_WARNING pr_warn("md: error, md_import_device() returned %ld\n",
"md: error, md_import_device() returned %ld\n",
PTR_ERR(rdev)); PTR_ERR(rdev));
return -EINVAL; return -EINVAL;
} }
...@@ -6249,8 +6220,7 @@ static int hot_add_disk(struct mddev *mddev, dev_t dev) ...@@ -6249,8 +6220,7 @@ static int hot_add_disk(struct mddev *mddev, dev_t dev)
rdev->sectors = rdev->sb_start; rdev->sectors = rdev->sb_start;
if (test_bit(Faulty, &rdev->flags)) { if (test_bit(Faulty, &rdev->flags)) {
printk(KERN_WARNING pr_warn("md: can not hot-add faulty %s disk to %s!\n",
"md: can not hot-add faulty %s disk to %s!\n",
bdevname(rdev->bdev,b), mdname(mddev)); bdevname(rdev->bdev,b), mdname(mddev));
err = -EINVAL; err = -EINVAL;
goto abort_export; goto abort_export;
...@@ -6306,23 +6276,23 @@ static int set_bitmap_file(struct mddev *mddev, int fd) ...@@ -6306,23 +6276,23 @@ static int set_bitmap_file(struct mddev *mddev, int fd)
f = fget(fd); f = fget(fd);
if (f == NULL) { if (f == NULL) {
printk(KERN_ERR "%s: error: failed to get bitmap file\n", pr_warn("%s: error: failed to get bitmap file\n",
mdname(mddev)); mdname(mddev));
return -EBADF; return -EBADF;
} }
inode = f->f_mapping->host; inode = f->f_mapping->host;
if (!S_ISREG(inode->i_mode)) { if (!S_ISREG(inode->i_mode)) {
printk(KERN_ERR "%s: error: bitmap file must be a regular file\n", pr_warn("%s: error: bitmap file must be a regular file\n",
mdname(mddev)); mdname(mddev));
err = -EBADF; err = -EBADF;
} else if (!(f->f_mode & FMODE_WRITE)) { } else if (!(f->f_mode & FMODE_WRITE)) {
printk(KERN_ERR "%s: error: bitmap file must open for write\n", pr_warn("%s: error: bitmap file must open for write\n",
mdname(mddev)); mdname(mddev));
err = -EBADF; err = -EBADF;
} else if (atomic_read(&inode->i_writecount) != 1) { } else if (atomic_read(&inode->i_writecount) != 1) {
printk(KERN_ERR "%s: error: bitmap file is already in use\n", pr_warn("%s: error: bitmap file is already in use\n",
mdname(mddev)); mdname(mddev));
err = -EBUSY; err = -EBUSY;
} }
if (err) { if (err) {
...@@ -6387,8 +6357,7 @@ static int set_array_info(struct mddev *mddev, mdu_array_info_t *info) ...@@ -6387,8 +6357,7 @@ static int set_array_info(struct mddev *mddev, mdu_array_info_t *info)
info->major_version >= ARRAY_SIZE(super_types) || info->major_version >= ARRAY_SIZE(super_types) ||
super_types[info->major_version].name == NULL) { super_types[info->major_version].name == NULL) {
/* maybe try to auto-load a module? */ /* maybe try to auto-load a module? */
printk(KERN_INFO pr_warn("md: superblock version %d not known\n",
"md: superblock version %d not known\n",
info->major_version); info->major_version);
return -EINVAL; return -EINVAL;
} }
...@@ -6654,8 +6623,7 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info) ...@@ -6654,8 +6623,7 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info)
if (mddev->bitmap_info.nodes) { if (mddev->bitmap_info.nodes) {
/* hold PW on all the bitmap lock */ /* hold PW on all the bitmap lock */
if (md_cluster_ops->lock_all_bitmaps(mddev) <= 0) { if (md_cluster_ops->lock_all_bitmaps(mddev) <= 0) {
printk("md: can't change bitmap to none since the" pr_warn("md: can't change bitmap to none since the array is in use by more than one node\n");
" array is in use by more than one node\n");
rv = -EPERM; rv = -EPERM;
md_cluster_ops->unlock_all_bitmaps(mddev); md_cluster_ops->unlock_all_bitmaps(mddev);
goto err; goto err;
...@@ -6841,9 +6809,8 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, ...@@ -6841,9 +6809,8 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode,
} }
err = mddev_lock(mddev); err = mddev_lock(mddev);
if (err) { if (err) {
printk(KERN_INFO pr_debug("md: ioctl lock interrupted, reason %d, cmd %d\n",
"md: ioctl lock interrupted, reason %d, cmd %d\n", err, cmd);
err, cmd);
goto out; goto out;
} }
...@@ -6858,30 +6825,24 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, ...@@ -6858,30 +6825,24 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode,
if (mddev->pers) { if (mddev->pers) {
err = update_array_info(mddev, &info); err = update_array_info(mddev, &info);
if (err) { if (err) {
printk(KERN_WARNING "md: couldn't update" pr_warn("md: couldn't update array info. %d\n", err);
" array info. %d\n", err);
goto unlock; goto unlock;
} }
goto unlock; goto unlock;
} }
if (!list_empty(&mddev->disks)) { if (!list_empty(&mddev->disks)) {
printk(KERN_WARNING pr_warn("md: array %s already has disks!\n", mdname(mddev));
"md: array %s already has disks!\n",
mdname(mddev));
err = -EBUSY; err = -EBUSY;
goto unlock; goto unlock;
} }
if (mddev->raid_disks) { if (mddev->raid_disks) {
printk(KERN_WARNING pr_warn("md: array %s already initialised!\n", mdname(mddev));
"md: array %s already initialised!\n",
mdname(mddev));
err = -EBUSY; err = -EBUSY;
goto unlock; goto unlock;
} }
err = set_array_info(mddev, &info); err = set_array_info(mddev, &info);
if (err) { if (err) {
printk(KERN_WARNING "md: couldn't set" pr_warn("md: couldn't set array info. %d\n", err);
" array info. %d\n", err);
goto unlock; goto unlock;
} }
goto unlock; goto unlock;
...@@ -7582,8 +7543,8 @@ static const struct file_operations md_seq_fops = { ...@@ -7582,8 +7543,8 @@ static const struct file_operations md_seq_fops = {
int register_md_personality(struct md_personality *p) int register_md_personality(struct md_personality *p)
{ {
printk(KERN_INFO "md: %s personality registered for level %d\n", pr_debug("md: %s personality registered for level %d\n",
p->name, p->level); p->name, p->level);
spin_lock(&pers_lock); spin_lock(&pers_lock);
list_add_tail(&p->list, &pers_list); list_add_tail(&p->list, &pers_list);
spin_unlock(&pers_lock); spin_unlock(&pers_lock);
...@@ -7593,7 +7554,7 @@ EXPORT_SYMBOL(register_md_personality); ...@@ -7593,7 +7554,7 @@ EXPORT_SYMBOL(register_md_personality);
int unregister_md_personality(struct md_personality *p) int unregister_md_personality(struct md_personality *p)
{ {
printk(KERN_INFO "md: %s personality unregistered\n", p->name); pr_debug("md: %s personality unregistered\n", p->name);
spin_lock(&pers_lock); spin_lock(&pers_lock);
list_del_init(&p->list); list_del_init(&p->list);
spin_unlock(&pers_lock); spin_unlock(&pers_lock);
...@@ -7633,7 +7594,7 @@ int md_setup_cluster(struct mddev *mddev, int nodes) ...@@ -7633,7 +7594,7 @@ int md_setup_cluster(struct mddev *mddev, int nodes)
spin_lock(&pers_lock); spin_lock(&pers_lock);
/* ensure module won't be unloaded */ /* ensure module won't be unloaded */
if (!md_cluster_ops || !try_module_get(md_cluster_mod)) { if (!md_cluster_ops || !try_module_get(md_cluster_mod)) {
pr_err("can't find md-cluster module or get it's reference.\n"); pr_warn("can't find md-cluster module or get it's reference.\n");
spin_unlock(&pers_lock); spin_unlock(&pers_lock);
return -ENOENT; return -ENOENT;
} }
...@@ -7908,11 +7869,9 @@ void md_do_sync(struct md_thread *thread) ...@@ -7908,11 +7869,9 @@ void md_do_sync(struct md_thread *thread)
mddev2->curr_resync >= mddev->curr_resync) { mddev2->curr_resync >= mddev->curr_resync) {
if (mddev2_minor != mddev2->md_minor) { if (mddev2_minor != mddev2->md_minor) {
mddev2_minor = mddev2->md_minor; mddev2_minor = mddev2->md_minor;
printk(KERN_INFO "md: delaying %s of %s" pr_info("md: delaying %s of %s until %s has finished (they share one or more physical units)\n",
" until %s has finished (they" desc, mdname(mddev),
" share one or more physical units)\n", mdname(mddev2));
desc, mdname(mddev),
mdname(mddev2));
} }
mddev_put(mddev2); mddev_put(mddev2);
if (signal_pending(current)) if (signal_pending(current))
...@@ -7969,12 +7928,10 @@ void md_do_sync(struct md_thread *thread) ...@@ -7969,12 +7928,10 @@ void md_do_sync(struct md_thread *thread)
} }
} }
printk(KERN_INFO "md: %s of RAID array %s\n", desc, mdname(mddev)); pr_info("md: %s of RAID array %s\n", desc, mdname(mddev));
printk(KERN_INFO "md: minimum _guaranteed_ speed:" pr_debug("md: minimum _guaranteed_ speed: %d KB/sec/disk.\n", speed_min(mddev));
" %d KB/sec/disk.\n", speed_min(mddev)); pr_debug("md: using maximum available idle IO bandwidth (but not more than %d KB/sec) for %s.\n",
printk(KERN_INFO "md: using maximum available idle IO bandwidth " speed_max(mddev), desc);
"(but not more than %d KB/sec) for %s.\n",
speed_max(mddev), desc);
is_mddev_idle(mddev, 1); /* this initializes IO event counters */ is_mddev_idle(mddev, 1); /* this initializes IO event counters */
...@@ -7991,16 +7948,15 @@ void md_do_sync(struct md_thread *thread) ...@@ -7991,16 +7948,15 @@ void md_do_sync(struct md_thread *thread)
* Tune reconstruction: * Tune reconstruction:
*/ */
window = 32*(PAGE_SIZE/512); window = 32*(PAGE_SIZE/512);
printk(KERN_INFO "md: using %dk window, over a total of %lluk.\n", pr_debug("md: using %dk window, over a total of %lluk.\n",
window/2, (unsigned long long)max_sectors/2); window/2, (unsigned long long)max_sectors/2);
atomic_set(&mddev->recovery_active, 0); atomic_set(&mddev->recovery_active, 0);
last_check = 0; last_check = 0;
if (j>2) { if (j>2) {
printk(KERN_INFO pr_debug("md: resuming %s of %s from checkpoint.\n",
"md: resuming %s of %s from checkpoint.\n", desc, mdname(mddev));
desc, mdname(mddev));
mddev->curr_resync = j; mddev->curr_resync = j;
} else } else
mddev->curr_resync = 3; /* no longer delayed */ mddev->curr_resync = 3; /* no longer delayed */
...@@ -8127,9 +8083,9 @@ void md_do_sync(struct md_thread *thread) ...@@ -8127,9 +8083,9 @@ void md_do_sync(struct md_thread *thread)
} }
} }
} }
printk(KERN_INFO "md: %s: %s %s.\n",mdname(mddev), desc, pr_info("md: %s: %s %s.\n",mdname(mddev), desc,
test_bit(MD_RECOVERY_INTR, &mddev->recovery) test_bit(MD_RECOVERY_INTR, &mddev->recovery)
? "interrupted" : "done"); ? "interrupted" : "done");
/* /*
* this also signals 'finished resyncing' to md_stop * this also signals 'finished resyncing' to md_stop
*/ */
...@@ -8149,9 +8105,8 @@ void md_do_sync(struct md_thread *thread) ...@@ -8149,9 +8105,8 @@ void md_do_sync(struct md_thread *thread)
if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {
if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { if (test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {
if (mddev->curr_resync >= mddev->recovery_cp) { if (mddev->curr_resync >= mddev->recovery_cp) {
printk(KERN_INFO pr_debug("md: checkpointing %s of %s.\n",
"md: checkpointing %s of %s.\n", desc, mdname(mddev));
desc, mdname(mddev));
if (test_bit(MD_RECOVERY_ERROR, if (test_bit(MD_RECOVERY_ERROR,
&mddev->recovery)) &mddev->recovery))
mddev->recovery_cp = mddev->recovery_cp =
...@@ -8299,8 +8254,8 @@ static void md_start_sync(struct work_struct *ws) ...@@ -8299,8 +8254,8 @@ static void md_start_sync(struct work_struct *ws)
mddev, mddev,
"resync"); "resync");
if (!mddev->sync_thread) { if (!mddev->sync_thread) {
printk(KERN_ERR "%s: could not start resync thread...\n", pr_warn("%s: could not start resync thread...\n",
mdname(mddev)); mdname(mddev));
/* leave the spares where they are, it shouldn't hurt */ /* leave the spares where they are, it shouldn't hurt */
clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); clear_bit(MD_RECOVERY_SYNC, &mddev->recovery);
clear_bit(MD_RECOVERY_RESHAPE, &mddev->recovery); clear_bit(MD_RECOVERY_RESHAPE, &mddev->recovery);
...@@ -8350,8 +8305,8 @@ void md_check_recovery(struct mddev *mddev) ...@@ -8350,8 +8305,8 @@ void md_check_recovery(struct mddev *mddev)
if (signal_pending(current)) { if (signal_pending(current)) {
if (mddev->pers->sync_request && !mddev->external) { if (mddev->pers->sync_request && !mddev->external) {
printk(KERN_INFO "md: %s in immediate safe mode\n", pr_debug("md: %s in immediate safe mode\n",
mdname(mddev)); mdname(mddev));
mddev->safemode = 2; mddev->safemode = 2;
} }
flush_signals(current); flush_signals(current);
...@@ -8749,7 +8704,7 @@ static void check_sb_changes(struct mddev *mddev, struct md_rdev *rdev) ...@@ -8749,7 +8704,7 @@ static void check_sb_changes(struct mddev *mddev, struct md_rdev *rdev)
rdev2->saved_raid_disk = role; rdev2->saved_raid_disk = role;
ret = remove_and_add_spares(mddev, rdev2); ret = remove_and_add_spares(mddev, rdev2);
pr_info("Activated spare: %s\n", pr_info("Activated spare: %s\n",
bdevname(rdev2->bdev,b)); bdevname(rdev2->bdev,b));
/* wakeup mddev->thread here, so array could /* wakeup mddev->thread here, so array could
* perform resync with the new activated disk */ * perform resync with the new activated disk */
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
...@@ -8874,9 +8829,6 @@ void md_autodetect_dev(dev_t dev) ...@@ -8874,9 +8829,6 @@ void md_autodetect_dev(dev_t dev)
mutex_lock(&detected_devices_mutex); mutex_lock(&detected_devices_mutex);
list_add_tail(&node_detected_dev->list, &all_detected_devices); list_add_tail(&node_detected_dev->list, &all_detected_devices);
mutex_unlock(&detected_devices_mutex); mutex_unlock(&detected_devices_mutex);
} else {
printk(KERN_CRIT "md: md_autodetect_dev: kzalloc failed"
", skipping dev(%d,%d)\n", MAJOR(dev), MINOR(dev));
} }
} }
...@@ -8890,7 +8842,7 @@ static void autostart_arrays(int part) ...@@ -8890,7 +8842,7 @@ static void autostart_arrays(int part)
i_scanned = 0; i_scanned = 0;
i_passed = 0; i_passed = 0;
printk(KERN_INFO "md: Autodetecting RAID arrays.\n"); pr_info("md: Autodetecting RAID arrays.\n");
mutex_lock(&detected_devices_mutex); mutex_lock(&detected_devices_mutex);
while (!list_empty(&all_detected_devices) && i_scanned < INT_MAX) { while (!list_empty(&all_detected_devices) && i_scanned < INT_MAX) {
...@@ -8915,8 +8867,7 @@ static void autostart_arrays(int part) ...@@ -8915,8 +8867,7 @@ static void autostart_arrays(int part)
} }
mutex_unlock(&detected_devices_mutex); mutex_unlock(&detected_devices_mutex);
printk(KERN_INFO "md: Scanned %d and added %d devices.\n", pr_debug("md: Scanned %d and added %d devices.\n", i_scanned, i_passed);
i_scanned, i_passed);
autorun_devices(part); autorun_devices(part);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment