md: add a mddev_add_trace_msg helper
Add a small wrapper around blk_add_trace_msg that hides some argument dereferences and the check for a DM-mapped MD device. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed--by: Song Liu <song@kernel.org> Tested-by: Song Liu <song@kernel.org> Signed-off-by: Song Liu <song@kernel.org> Link: https://lore.kernel.org/r/20240303140150.5435-3-hch@lst.de
This commit is contained in:
parent
c396b90e50
commit
28be4fd310
@ -1046,9 +1046,8 @@ void md_bitmap_unplug(struct bitmap *bitmap)
|
|||||||
if (dirty || need_write) {
|
if (dirty || need_write) {
|
||||||
if (!writing) {
|
if (!writing) {
|
||||||
md_bitmap_wait_writes(bitmap);
|
md_bitmap_wait_writes(bitmap);
|
||||||
if (bitmap->mddev->queue)
|
mddev_add_trace_msg(bitmap->mddev,
|
||||||
blk_add_trace_msg(bitmap->mddev->queue,
|
"md bitmap_unplug");
|
||||||
"md bitmap_unplug");
|
|
||||||
}
|
}
|
||||||
clear_page_attr(bitmap, i, BITMAP_PAGE_PENDING);
|
clear_page_attr(bitmap, i, BITMAP_PAGE_PENDING);
|
||||||
filemap_write_page(bitmap, i, false);
|
filemap_write_page(bitmap, i, false);
|
||||||
@ -1319,9 +1318,7 @@ void md_bitmap_daemon_work(struct mddev *mddev)
|
|||||||
}
|
}
|
||||||
bitmap->allclean = 1;
|
bitmap->allclean = 1;
|
||||||
|
|
||||||
if (bitmap->mddev->queue)
|
mddev_add_trace_msg(bitmap->mddev, "md bitmap_daemon_work");
|
||||||
blk_add_trace_msg(bitmap->mddev->queue,
|
|
||||||
"md bitmap_daemon_work");
|
|
||||||
|
|
||||||
/* Any file-page which is PENDING now needs to be written.
|
/* Any file-page which is PENDING now needs to be written.
|
||||||
* So set NEEDWRITE now, then after we make any last-minute changes
|
* So set NEEDWRITE now, then after we make any last-minute changes
|
||||||
|
@ -2856,8 +2856,7 @@ repeat:
|
|||||||
pr_debug("md: updating %s RAID superblock on device (in sync %d)\n",
|
pr_debug("md: updating %s RAID superblock on device (in sync %d)\n",
|
||||||
mdname(mddev), mddev->in_sync);
|
mdname(mddev), mddev->in_sync);
|
||||||
|
|
||||||
if (mddev->queue)
|
mddev_add_trace_msg(mddev, "md md_update_sb");
|
||||||
blk_add_trace_msg(mddev->queue, "md md_update_sb");
|
|
||||||
rewrite:
|
rewrite:
|
||||||
md_bitmap_update_sb(mddev->bitmap);
|
md_bitmap_update_sb(mddev->bitmap);
|
||||||
rdev_for_each(rdev, mddev) {
|
rdev_for_each(rdev, mddev) {
|
||||||
|
@ -918,4 +918,10 @@ static inline void mddev_trace_remap(struct mddev *mddev, struct bio *bio,
|
|||||||
trace_block_bio_remap(bio, disk_devt(mddev->gendisk), sector);
|
trace_block_bio_remap(bio, disk_devt(mddev->gendisk), sector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define mddev_add_trace_msg(mddev, fmt, args...) \
|
||||||
|
do { \
|
||||||
|
if ((mddev)->gendisk) \
|
||||||
|
blk_add_trace_msg((mddev)->queue, fmt, ##args); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#endif /* _MD_MD_H */
|
#endif /* _MD_MD_H */
|
||||||
|
@ -46,9 +46,6 @@
|
|||||||
static void allow_barrier(struct r1conf *conf, sector_t sector_nr);
|
static void allow_barrier(struct r1conf *conf, sector_t sector_nr);
|
||||||
static void lower_barrier(struct r1conf *conf, sector_t sector_nr);
|
static void lower_barrier(struct r1conf *conf, sector_t sector_nr);
|
||||||
|
|
||||||
#define raid1_log(md, fmt, args...) \
|
|
||||||
do { if ((md)->queue) blk_add_trace_msg((md)->queue, "raid1 " fmt, ##args); } while (0)
|
|
||||||
|
|
||||||
#define RAID_1_10_NAME "raid1"
|
#define RAID_1_10_NAME "raid1"
|
||||||
#include "raid1-10.c"
|
#include "raid1-10.c"
|
||||||
|
|
||||||
@ -1196,7 +1193,7 @@ static void freeze_array(struct r1conf *conf, int extra)
|
|||||||
*/
|
*/
|
||||||
spin_lock_irq(&conf->resync_lock);
|
spin_lock_irq(&conf->resync_lock);
|
||||||
conf->array_frozen = 1;
|
conf->array_frozen = 1;
|
||||||
raid1_log(conf->mddev, "wait freeze");
|
mddev_add_trace_msg(conf->mddev, "raid1 wait freeze");
|
||||||
wait_event_lock_irq_cmd(
|
wait_event_lock_irq_cmd(
|
||||||
conf->wait_barrier,
|
conf->wait_barrier,
|
||||||
get_unqueued_pending(conf) == extra,
|
get_unqueued_pending(conf) == extra,
|
||||||
@ -1385,7 +1382,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,
|
|||||||
* Reading from a write-mostly device must take care not to
|
* Reading from a write-mostly device must take care not to
|
||||||
* over-take any writes that are 'behind'
|
* over-take any writes that are 'behind'
|
||||||
*/
|
*/
|
||||||
raid1_log(mddev, "wait behind writes");
|
mddev_add_trace_msg(mddev, "raid1 wait behind writes");
|
||||||
wait_event(bitmap->behind_wait,
|
wait_event(bitmap->behind_wait,
|
||||||
atomic_read(&bitmap->behind_writes) == 0);
|
atomic_read(&bitmap->behind_writes) == 0);
|
||||||
}
|
}
|
||||||
@ -1568,7 +1565,8 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
|
|||||||
bio_wouldblock_error(bio);
|
bio_wouldblock_error(bio);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
raid1_log(mddev, "wait rdev %d blocked", blocked_rdev->raid_disk);
|
mddev_add_trace_msg(mddev, "raid1 wait rdev %d blocked",
|
||||||
|
blocked_rdev->raid_disk);
|
||||||
md_wait_for_blocked_rdev(blocked_rdev, mddev);
|
md_wait_for_blocked_rdev(blocked_rdev, mddev);
|
||||||
wait_barrier(conf, bio->bi_iter.bi_sector, false);
|
wait_barrier(conf, bio->bi_iter.bi_sector, false);
|
||||||
goto retry_write;
|
goto retry_write;
|
||||||
|
@ -76,9 +76,6 @@ static void reshape_request_write(struct mddev *mddev, struct r10bio *r10_bio);
|
|||||||
static void end_reshape_write(struct bio *bio);
|
static void end_reshape_write(struct bio *bio);
|
||||||
static void end_reshape(struct r10conf *conf);
|
static void end_reshape(struct r10conf *conf);
|
||||||
|
|
||||||
#define raid10_log(md, fmt, args...) \
|
|
||||||
do { if ((md)->queue) blk_add_trace_msg((md)->queue, "raid10 " fmt, ##args); } while (0)
|
|
||||||
|
|
||||||
#include "raid1-10.c"
|
#include "raid1-10.c"
|
||||||
|
|
||||||
#define NULL_CMD
|
#define NULL_CMD
|
||||||
@ -1019,7 +1016,7 @@ static bool wait_barrier(struct r10conf *conf, bool nowait)
|
|||||||
ret = false;
|
ret = false;
|
||||||
} else {
|
} else {
|
||||||
conf->nr_waiting++;
|
conf->nr_waiting++;
|
||||||
raid10_log(conf->mddev, "wait barrier");
|
mddev_add_trace_msg(conf->mddev, "raid10 wait barrier");
|
||||||
wait_event_barrier(conf, stop_waiting_barrier(conf));
|
wait_event_barrier(conf, stop_waiting_barrier(conf));
|
||||||
conf->nr_waiting--;
|
conf->nr_waiting--;
|
||||||
}
|
}
|
||||||
@ -1138,7 +1135,7 @@ static bool regular_request_wait(struct mddev *mddev, struct r10conf *conf,
|
|||||||
bio_wouldblock_error(bio);
|
bio_wouldblock_error(bio);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
raid10_log(conf->mddev, "wait reshape");
|
mddev_add_trace_msg(conf->mddev, "raid10 wait reshape");
|
||||||
wait_event(conf->wait_barrier,
|
wait_event(conf->wait_barrier,
|
||||||
conf->reshape_progress <= bio->bi_iter.bi_sector ||
|
conf->reshape_progress <= bio->bi_iter.bi_sector ||
|
||||||
conf->reshape_progress >= bio->bi_iter.bi_sector +
|
conf->reshape_progress >= bio->bi_iter.bi_sector +
|
||||||
@ -1336,8 +1333,9 @@ retry_wait:
|
|||||||
if (unlikely(blocked_rdev)) {
|
if (unlikely(blocked_rdev)) {
|
||||||
/* Have to wait for this device to get unblocked, then retry */
|
/* Have to wait for this device to get unblocked, then retry */
|
||||||
allow_barrier(conf);
|
allow_barrier(conf);
|
||||||
raid10_log(conf->mddev, "%s wait rdev %d blocked",
|
mddev_add_trace_msg(conf->mddev,
|
||||||
__func__, blocked_rdev->raid_disk);
|
"raid10 %s wait rdev %d blocked",
|
||||||
|
__func__, blocked_rdev->raid_disk);
|
||||||
md_wait_for_blocked_rdev(blocked_rdev, mddev);
|
md_wait_for_blocked_rdev(blocked_rdev, mddev);
|
||||||
wait_barrier(conf, false);
|
wait_barrier(conf, false);
|
||||||
goto retry_wait;
|
goto retry_wait;
|
||||||
@ -1392,7 +1390,8 @@ static void raid10_write_request(struct mddev *mddev, struct bio *bio,
|
|||||||
bio_wouldblock_error(bio);
|
bio_wouldblock_error(bio);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
raid10_log(conf->mddev, "wait reshape metadata");
|
mddev_add_trace_msg(conf->mddev,
|
||||||
|
"raid10 wait reshape metadata");
|
||||||
wait_event(mddev->sb_wait,
|
wait_event(mddev->sb_wait,
|
||||||
!test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags));
|
!test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags));
|
||||||
|
|
||||||
|
@ -4195,10 +4195,9 @@ static int handle_stripe_dirtying(struct r5conf *conf,
|
|||||||
set_bit(STRIPE_HANDLE, &sh->state);
|
set_bit(STRIPE_HANDLE, &sh->state);
|
||||||
if ((rmw < rcw || (rmw == rcw && conf->rmw_level == PARITY_PREFER_RMW)) && rmw > 0) {
|
if ((rmw < rcw || (rmw == rcw && conf->rmw_level == PARITY_PREFER_RMW)) && rmw > 0) {
|
||||||
/* prefer read-modify-write, but need to get some data */
|
/* prefer read-modify-write, but need to get some data */
|
||||||
if (conf->mddev->queue)
|
mddev_add_trace_msg(conf->mddev, "raid5 rmw %llu %d",
|
||||||
blk_add_trace_msg(conf->mddev->queue,
|
sh->sector, rmw);
|
||||||
"raid5 rmw %llu %d",
|
|
||||||
(unsigned long long)sh->sector, rmw);
|
|
||||||
for (i = disks; i--; ) {
|
for (i = disks; i--; ) {
|
||||||
struct r5dev *dev = &sh->dev[i];
|
struct r5dev *dev = &sh->dev[i];
|
||||||
if (test_bit(R5_InJournal, &dev->flags) &&
|
if (test_bit(R5_InJournal, &dev->flags) &&
|
||||||
@ -4276,9 +4275,10 @@ static int handle_stripe_dirtying(struct r5conf *conf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rcw && conf->mddev->queue)
|
if (rcw && conf->mddev->queue)
|
||||||
blk_add_trace_msg(conf->mddev->queue, "raid5 rcw %llu %d %d %d",
|
mddev_add_trace_msg(conf->mddev,
|
||||||
(unsigned long long)sh->sector,
|
"raid5 rcw %llu %d %d %d",
|
||||||
rcw, qread, test_bit(STRIPE_DELAYED, &sh->state));
|
sh->sector, rcw, qread,
|
||||||
|
test_bit(STRIPE_DELAYED, &sh->state));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcw > disks && rmw > disks &&
|
if (rcw > disks && rmw > disks &&
|
||||||
|
Loading…
Reference in New Issue
Block a user