diff options
author | NeilBrown <neilb@suse.com> | 2016-11-14 06:30:21 +0100 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2016-11-18 18:35:37 +0100 |
commit | 578b54ade8a5e04df6edc14cb68ad0f6f491a1a1 (patch) | |
tree | 8a538bd4decbbe556c585455efd9ea5daf33bfa9 /drivers/md/raid1.c | |
parent | md/bitmap: add blktrace event for writes to the bitmap (diff) | |
download | linux-578b54ade8a5e04df6edc14cb68ad0f6f491a1a1.tar.xz linux-578b54ade8a5e04df6edc14cb68ad0f6f491a1a1.zip |
md/raid1, raid10: add blktrace records when IO is delayed
Both raid1 and raid10 will sometimes delay handling an IO request,
such as when resync is happening or there are too many requests queued.
Add some blktrace messsages so we can see when that is happening when
looking for performance artefacts.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 2dc1934925ec..d24adc50a31f 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -71,6 +71,9 @@ static void allow_barrier(struct r1conf *conf, sector_t start_next_window, sector_t bi_sector); static void lower_barrier(struct r1conf *conf); +#define raid1_log(md, fmt, args...) \ + do { if ((md)->queue) blk_add_trace_msg((md)->queue, "raid1 " fmt, ##args); } while (0) + static void * r1bio_pool_alloc(gfp_t gfp_flags, void *data) { struct pool_info *pi = data; @@ -861,6 +864,7 @@ static sector_t wait_barrier(struct r1conf *conf, struct bio *bio) * that queue to allow conf->start_next_window * to increase. */ + raid1_log(conf->mddev, "wait barrier"); wait_event_lock_irq(conf->wait_barrier, !conf->array_frozen && (!conf->barrier || @@ -940,6 +944,7 @@ static void freeze_array(struct r1conf *conf, int extra) */ spin_lock_irq(&conf->resync_lock); conf->array_frozen = 1; + raid1_log(conf->mddev, "wait freeze"); wait_event_lock_irq_cmd(conf->wait_barrier, conf->nr_pending == conf->nr_queued+extra, conf->resync_lock, @@ -1144,6 +1149,7 @@ read_again: * take care not to over-take any writes * that are 'behind' */ + raid1_log(mddev, "wait behind writes"); wait_event(bitmap->behind_wait, atomic_read(&bitmap->behind_writes) == 0); } @@ -1208,6 +1214,7 @@ read_again: */ if (conf->pending_count >= max_queued_requests) { md_wakeup_thread(mddev->thread); + raid1_log(mddev, "wait queued"); wait_event(conf->wait_barrier, conf->pending_count < max_queued_requests); } @@ -1299,6 +1306,7 @@ read_again: rdev_dec_pending(conf->mirrors[j].rdev, mddev); r1_bio->state = 0; allow_barrier(conf, start_next_window, bio->bi_iter.bi_sector); + raid1_log(mddev, "wait rdev %d blocked", blocked_rdev->raid_disk); md_wait_for_blocked_rdev(blocked_rdev, mddev); start_next_window = wait_barrier(conf, bio); /* |