Skip to content

Commit 396799e

Browse files
Christoph Hellwigliu-song-6
authored andcommitted
md: remove mddev->queue
Just use the request_queue from the gendisk pointer in the relatively few places that sill need it. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed--by: Song Liu <[email protected]> Tested-by: Song Liu <[email protected]> Signed-off-by: Song Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 81a16e1 commit 396799e

File tree

7 files changed

+26
-23
lines changed

7 files changed

+26
-23
lines changed

drivers/md/md.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5770,10 +5770,10 @@ int mddev_stack_new_rdev(struct mddev *mddev, struct md_rdev *rdev)
57705770
if (mddev_is_dm(mddev))
57715771
return 0;
57725772

5773-
lim = queue_limits_start_update(mddev->queue);
5773+
lim = queue_limits_start_update(mddev->gendisk->queue);
57745774
queue_limits_stack_bdev(&lim, rdev->bdev, rdev->data_offset,
57755775
mddev->gendisk->disk_name);
5776-
return queue_limits_commit_update(mddev->queue, &lim);
5776+
return queue_limits_commit_update(mddev->gendisk->queue, &lim);
57775777
}
57785778
EXPORT_SYMBOL_GPL(mddev_stack_new_rdev);
57795779

@@ -5877,8 +5877,7 @@ struct mddev *md_alloc(dev_t dev, char *name)
58775877
disk->fops = &md_fops;
58785878
disk->private_data = mddev;
58795879

5880-
mddev->queue = disk->queue;
5881-
blk_queue_write_cache(mddev->queue, true, true);
5880+
blk_queue_write_cache(disk->queue, true, true);
58825881
disk->events |= DISK_EVENT_MEDIA_CHANGE;
58835882
mddev->gendisk = disk;
58845883
error = add_disk(disk);
@@ -6183,6 +6182,7 @@ int md_run(struct mddev *mddev)
61836182
}
61846183

61856184
if (!mddev_is_dm(mddev)) {
6185+
struct request_queue *q = mddev->gendisk->queue;
61866186
bool nonrot = true;
61876187

61886188
rdev_for_each(rdev, mddev) {
@@ -6194,14 +6194,14 @@ int md_run(struct mddev *mddev)
61946194
if (mddev->degraded)
61956195
nonrot = false;
61966196
if (nonrot)
6197-
blk_queue_flag_set(QUEUE_FLAG_NONROT, mddev->queue);
6197+
blk_queue_flag_set(QUEUE_FLAG_NONROT, q);
61986198
else
6199-
blk_queue_flag_clear(QUEUE_FLAG_NONROT, mddev->queue);
6200-
blk_queue_flag_set(QUEUE_FLAG_IO_STAT, mddev->queue);
6199+
blk_queue_flag_clear(QUEUE_FLAG_NONROT, q);
6200+
blk_queue_flag_set(QUEUE_FLAG_IO_STAT, q);
62016201

62026202
/* Set the NOWAIT flags if all underlying devices support it */
62036203
if (nowait)
6204-
blk_queue_flag_set(QUEUE_FLAG_NOWAIT, mddev->queue);
6204+
blk_queue_flag_set(QUEUE_FLAG_NOWAIT, q);
62056205
}
62066206
if (pers->sync_request) {
62076207
if (mddev->kobj.sd &&
@@ -6447,8 +6447,10 @@ static void mddev_detach(struct mddev *mddev)
64476447
mddev->pers->quiesce(mddev, 0);
64486448
}
64496449
md_unregister_thread(mddev, &mddev->thread);
6450+
6451+
/* the unplug fn references 'conf' */
64506452
if (!mddev_is_dm(mddev))
6451-
blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
6453+
blk_sync_queue(mddev->gendisk->queue);
64526454
}
64536455

64546456
static void __md_stop(struct mddev *mddev)
@@ -7166,7 +7168,7 @@ static int hot_add_disk(struct mddev *mddev, dev_t dev)
71667168
if (!bdev_nowait(rdev->bdev)) {
71677169
pr_info("%s: Disabling nowait because %pg does not support nowait\n",
71687170
mdname(mddev), rdev->bdev);
7169-
blk_queue_flag_clear(QUEUE_FLAG_NOWAIT, mddev->queue);
7171+
blk_queue_flag_clear(QUEUE_FLAG_NOWAIT, mddev->gendisk->queue);
71707172
}
71717173
/*
71727174
* Kick recovery, maybe this spare has to be added to the

drivers/md/md.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,6 @@ struct mddev {
480480
struct timer_list safemode_timer;
481481
struct percpu_ref writes_pending;
482482
int sync_checkers; /* # of threads checking writes_pending */
483-
struct request_queue *queue; /* for plugging ... */
484483

485484
struct bitmap *bitmap; /* the bitmap for the device */
486485
struct {
@@ -869,7 +868,7 @@ static inline void mddev_check_write_zeroes(struct mddev *mddev, struct bio *bio
869868
{
870869
if (bio_op(bio) == REQ_OP_WRITE_ZEROES &&
871870
!bio->bi_bdev->bd_disk->queue->limits.max_write_zeroes_sectors)
872-
mddev->queue->limits.max_write_zeroes_sectors = 0;
871+
mddev->gendisk->queue->limits.max_write_zeroes_sectors = 0;
873872
}
874873

875874
static inline int mddev_suspend_and_lock(struct mddev *mddev)
@@ -932,7 +931,7 @@ static inline void mddev_trace_remap(struct mddev *mddev, struct bio *bio,
932931
#define mddev_add_trace_msg(mddev, fmt, args...) \
933932
do { \
934933
if (!mddev_is_dm(mddev)) \
935-
blk_add_trace_msg((mddev)->queue, fmt, ##args); \
934+
blk_add_trace_msg((mddev)->gendisk->queue, fmt, ##args); \
936935
} while (0)
937936

938937
#endif /* _MD_MD_H */

drivers/md/raid0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ static int raid0_set_limits(struct mddev *mddev)
389389
lim.io_min = mddev->chunk_sectors << 9;
390390
lim.io_opt = lim.io_min * mddev->raid_disks;
391391
mddev_stack_rdev_limits(mddev, &lim);
392-
return queue_limits_set(mddev->queue, &lim);
392+
return queue_limits_set(mddev->gendisk->queue, &lim);
393393
}
394394

395395
static int raid0_run(struct mddev *mddev)

drivers/md/raid1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3201,7 +3201,7 @@ static int raid1_set_limits(struct mddev *mddev)
32013201
blk_set_stacking_limits(&lim);
32023202
lim.max_write_zeroes_sectors = 0;
32033203
mddev_stack_rdev_limits(mddev, &lim);
3204-
return queue_limits_set(mddev->queue, &lim);
3204+
return queue_limits_set(mddev->gendisk->queue, &lim);
32053205
}
32063206

32073207
static void raid1_free(struct mddev *mddev, void *priv);

drivers/md/raid10.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3986,7 +3986,7 @@ static int raid10_set_queue_limits(struct mddev *mddev)
39863986
lim.io_min = mddev->chunk_sectors << 9;
39873987
lim.io_opt = lim.io_min * raid10_nr_stripes(conf);
39883988
mddev_stack_rdev_limits(mddev, &lim);
3989-
return queue_limits_set(mddev->queue, &lim);
3989+
return queue_limits_set(mddev->gendisk->queue, &lim);
39903990
}
39913991

39923992
static int raid10_run(struct mddev *mddev)

drivers/md/raid5-ppl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,8 @@ int ppl_init_log(struct r5conf *conf)
13931393
ppl_conf->signature = ~crc32c_le(~0, mddev->uuid, sizeof(mddev->uuid));
13941394
ppl_conf->block_size = 512;
13951395
} else {
1396-
ppl_conf->block_size = queue_logical_block_size(mddev->queue);
1396+
ppl_conf->block_size =
1397+
queue_logical_block_size(mddev->gendisk->queue);
13971398
}
13981399

13991400
for (i = 0; i < ppl_conf->count; i++) {

drivers/md/raid5.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4275,9 +4275,10 @@ static int handle_stripe_dirtying(struct r5conf *conf,
42754275
}
42764276
}
42774277
if (rcw && !mddev_is_dm(conf->mddev))
4278-
blk_add_trace_msg(conf->mddev->queue, "raid5 rcw %llu %d %d %d",
4279-
(unsigned long long)sh->sector,
4280-
rcw, qread, test_bit(STRIPE_DELAYED, &sh->state));
4278+
blk_add_trace_msg(conf->mddev->gendisk->queue,
4279+
"raid5 rcw %llu %d %d %d",
4280+
(unsigned long long)sh->sector, rcw, qread,
4281+
test_bit(STRIPE_DELAYED, &sh->state));
42814282
}
42824283

42834284
if (rcw > disks && rmw > disks &&
@@ -5686,7 +5687,7 @@ static void raid5_unplug(struct blk_plug_cb *blk_cb, bool from_schedule)
56865687
release_inactive_stripe_list(conf, cb->temp_inactive_list,
56875688
NR_STRIPE_HASH_LOCKS);
56885689
if (!mddev_is_dm(mddev))
5689-
trace_block_unplug(mddev->queue, cnt, !from_schedule);
5690+
trace_block_unplug(mddev->gendisk->queue, cnt, !from_schedule);
56905691
kfree(cb);
56915692
}
56925693

@@ -7089,7 +7090,7 @@ raid5_store_skip_copy(struct mddev *mddev, const char *page, size_t len)
70897090
if (!conf)
70907091
err = -ENODEV;
70917092
else if (new != conf->skip_copy) {
7092-
struct request_queue *q = mddev->queue;
7093+
struct request_queue *q = mddev->gendisk->queue;
70937094

70947095
conf->skip_copy = new;
70957096
if (new)
@@ -7749,7 +7750,7 @@ static int raid5_set_limits(struct mddev *mddev)
77497750
/* No restrictions on the number of segments in the request */
77507751
lim.max_segments = USHRT_MAX;
77517752

7752-
return queue_limits_set(mddev->queue, &lim);
7753+
return queue_limits_set(mddev->gendisk->queue, &lim);
77537754
}
77547755

77557756
static int raid5_run(struct mddev *mddev)

0 commit comments

Comments
 (0)