md/raid: use printk_ratelimited instead of printk_ratelimit

As per printk_ratelimit comment, it should not be used.

Signed-off-by: Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Christian Dietrich
2011-07-27 11:00:36 +10:00
committed by NeilBrown
parent a0a02a7ad6
commit 8bda470e8e
3 changed files with 53 additions and 42 deletions

View File

@@ -35,6 +35,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/ratelimit.h>
#include "md.h" #include "md.h"
#include "raid1.h" #include "raid1.h"
#include "bitmap.h" #include "bitmap.h"
@@ -287,10 +288,13 @@ static void raid1_end_read_request(struct bio *bio, int error)
* oops, read error: * oops, read error:
*/ */
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
if (printk_ratelimit()) printk_ratelimited(
printk(KERN_ERR "md/raid1:%s: %s: rescheduling sector %llu\n", KERN_ERR "md/raid1:%s: %s: "
mdname(conf->mddev), "rescheduling sector %llu\n",
bdevname(conf->mirrors[mirror].rdev->bdev,b), (unsigned long long)r1_bio->sector); mdname(conf->mddev),
bdevname(conf->mirrors[mirror].rdev->bdev,
b),
(unsigned long long)r1_bio->sector);
reschedule_retry(r1_bio); reschedule_retry(r1_bio);
} }
@@ -1580,12 +1584,13 @@ static void raid1d(mddev_t *mddev)
GFP_NOIO, mddev); GFP_NOIO, mddev);
r1_bio->bios[r1_bio->read_disk] = bio; r1_bio->bios[r1_bio->read_disk] = bio;
rdev = conf->mirrors[disk].rdev; rdev = conf->mirrors[disk].rdev;
if (printk_ratelimit()) printk_ratelimited(
printk(KERN_ERR "md/raid1:%s: redirecting sector %llu to" KERN_ERR
" other mirror: %s\n", "md/raid1:%s: redirecting sector %llu"
mdname(mddev), " to other mirror: %s\n",
(unsigned long long)r1_bio->sector, mdname(mddev),
bdevname(rdev->bdev,b)); (unsigned long long)r1_bio->sector,
bdevname(rdev->bdev, b));
bio->bi_sector = r1_bio->sector + rdev->data_offset; bio->bi_sector = r1_bio->sector + rdev->data_offset;
bio->bi_bdev = rdev->bdev; bio->bi_bdev = rdev->bdev;
bio->bi_end_io = raid1_end_read_request; bio->bi_end_io = raid1_end_read_request;

View File

@@ -22,6 +22,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/ratelimit.h>
#include "md.h" #include "md.h"
#include "raid10.h" #include "raid10.h"
#include "raid0.h" #include "raid0.h"
@@ -301,10 +302,11 @@ static void raid10_end_read_request(struct bio *bio, int error)
* oops, read error - keep the refcount on the rdev * oops, read error - keep the refcount on the rdev
*/ */
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
if (printk_ratelimit()) printk_ratelimited(KERN_ERR
printk(KERN_ERR "md/raid10:%s: %s: rescheduling sector %llu\n", "md/raid10:%s: %s: rescheduling sector %llu\n",
mdname(conf->mddev), mdname(conf->mddev),
bdevname(conf->mirrors[dev].rdev->bdev,b), (unsigned long long)r10_bio->sector); bdevname(conf->mirrors[dev].rdev->bdev, b),
(unsigned long long)r10_bio->sector);
reschedule_retry(r10_bio); reschedule_retry(r10_bio);
} }
} }
@@ -1669,12 +1671,13 @@ static void raid10d(mddev_t *mddev)
bio_put(bio); bio_put(bio);
slot = r10_bio->read_slot; slot = r10_bio->read_slot;
rdev = conf->mirrors[mirror].rdev; rdev = conf->mirrors[mirror].rdev;
if (printk_ratelimit()) printk_ratelimited(
printk(KERN_ERR "md/raid10:%s: %s: redirecting sector %llu to" KERN_ERR
" another mirror\n", "md/raid10:%s: %s: redirecting"
mdname(mddev), "sector %llu to another mirror\n",
bdevname(rdev->bdev,b), mdname(mddev),
(unsigned long long)r10_bio->sector); bdevname(rdev->bdev, b),
(unsigned long long)r10_bio->sector);
bio = bio_clone_mddev(r10_bio->master_bio, bio = bio_clone_mddev(r10_bio->master_bio,
GFP_NOIO, mddev); GFP_NOIO, mddev);
r10_bio->devs[slot].bio = bio; r10_bio->devs[slot].bio = bio;

View File

@@ -51,6 +51,7 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/ratelimit.h>
#include "md.h" #include "md.h"
#include "raid5.h" #include "raid5.h"
#include "raid0.h" #include "raid0.h"
@@ -96,8 +97,6 @@
#define __inline__ #define __inline__
#endif #endif
#define printk_rl(args...) ((void) (printk_ratelimit() && printk(args)))
/* /*
* We maintain a biased count of active stripes in the bottom 16 bits of * We maintain a biased count of active stripes in the bottom 16 bits of
* bi_phys_segments, and a count of processed stripes in the upper 16 bits * bi_phys_segments, and a count of processed stripes in the upper 16 bits
@@ -1583,12 +1582,14 @@ static void raid5_end_read_request(struct bio * bi, int error)
set_bit(R5_UPTODATE, &sh->dev[i].flags); set_bit(R5_UPTODATE, &sh->dev[i].flags);
if (test_bit(R5_ReadError, &sh->dev[i].flags)) { if (test_bit(R5_ReadError, &sh->dev[i].flags)) {
rdev = conf->disks[i].rdev; rdev = conf->disks[i].rdev;
printk_rl(KERN_INFO "md/raid:%s: read error corrected" printk_ratelimited(
" (%lu sectors at %llu on %s)\n", KERN_INFO
mdname(conf->mddev), STRIPE_SECTORS, "md/raid:%s: read error corrected"
(unsigned long long)(sh->sector " (%lu sectors at %llu on %s)\n",
+ rdev->data_offset), mdname(conf->mddev), STRIPE_SECTORS,
bdevname(rdev->bdev, b)); (unsigned long long)(sh->sector
+ rdev->data_offset),
bdevname(rdev->bdev, b));
clear_bit(R5_ReadError, &sh->dev[i].flags); clear_bit(R5_ReadError, &sh->dev[i].flags);
clear_bit(R5_ReWrite, &sh->dev[i].flags); clear_bit(R5_ReWrite, &sh->dev[i].flags);
} }
@@ -1602,22 +1603,24 @@ static void raid5_end_read_request(struct bio * bi, int error)
clear_bit(R5_UPTODATE, &sh->dev[i].flags); clear_bit(R5_UPTODATE, &sh->dev[i].flags);
atomic_inc(&rdev->read_errors); atomic_inc(&rdev->read_errors);
if (conf->mddev->degraded >= conf->max_degraded) if (conf->mddev->degraded >= conf->max_degraded)
printk_rl(KERN_WARNING printk_ratelimited(
"md/raid:%s: read error not correctable " KERN_WARNING
"(sector %llu on %s).\n", "md/raid:%s: read error not correctable "
mdname(conf->mddev), "(sector %llu on %s).\n",
(unsigned long long)(sh->sector mdname(conf->mddev),
+ rdev->data_offset), (unsigned long long)(sh->sector
bdn); + rdev->data_offset),
bdn);
else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) else if (test_bit(R5_ReWrite, &sh->dev[i].flags))
/* Oh, no!!! */ /* Oh, no!!! */
printk_rl(KERN_WARNING printk_ratelimited(
"md/raid:%s: read error NOT corrected!! " KERN_WARNING
"(sector %llu on %s).\n", "md/raid:%s: read error NOT corrected!! "
mdname(conf->mddev), "(sector %llu on %s).\n",
(unsigned long long)(sh->sector mdname(conf->mddev),
+ rdev->data_offset), (unsigned long long)(sh->sector
bdn); + rdev->data_offset),
bdn);
else if (atomic_read(&rdev->read_errors) else if (atomic_read(&rdev->read_errors)
> conf->max_nr_stripes) > conf->max_nr_stripes)
printk(KERN_WARNING printk(KERN_WARNING