Skip to content

Commit daae161

Browse files
mtkaczykliu-song-6
authored andcommitted
md: raid1/raid10: drop pending_cnt
Those counters are not necessary after commit 11bb45e8aaf6 ("md: drop queue limitation for RAID1 and RAID10"). Remove them from all code (conf and plug structs). raid1_plug_cb and raid10_plug_cb are identical, so move definition of raid1_plug_cb to common raid1-10 definitions and use it for RAID10 too. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Song Liu <song@kernel.org>
1 parent a763706 commit daae161

File tree

5 files changed

+8
-27
lines changed

5 files changed

+8
-27
lines changed

drivers/md/raid1-10.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ struct resync_pages {
2828
struct page *pages[RESYNC_PAGES];
2929
};
3030

31+
struct raid1_plug_cb {
32+
struct blk_plug_cb cb;
33+
struct bio_list pending;
34+
};
35+
3136
static void rbio_pool_free(void *rbio, void *data)
3237
{
3338
kfree(rbio);

drivers/md/raid1.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,6 @@ static void flush_pending_writes(struct r1conf *conf)
824824
struct bio *bio;
825825

826826
bio = bio_list_get(&conf->pending_bio_list);
827-
conf->pending_count = 0;
828827
spin_unlock_irq(&conf->device_lock);
829828

830829
/*
@@ -1167,12 +1166,6 @@ static void alloc_behind_master_bio(struct r1bio *r1_bio,
11671166
bio_put(behind_bio);
11681167
}
11691168

1170-
struct raid1_plug_cb {
1171-
struct blk_plug_cb cb;
1172-
struct bio_list pending;
1173-
int pending_cnt;
1174-
};
1175-
11761169
static void raid1_unplug(struct blk_plug_cb *cb, bool from_schedule)
11771170
{
11781171
struct raid1_plug_cb *plug = container_of(cb, struct raid1_plug_cb,
@@ -1184,7 +1177,6 @@ static void raid1_unplug(struct blk_plug_cb *cb, bool from_schedule)
11841177
if (from_schedule || current->bio_list) {
11851178
spin_lock_irq(&conf->device_lock);
11861179
bio_list_merge(&conf->pending_bio_list, &plug->pending);
1187-
conf->pending_count += plug->pending_cnt;
11881180
spin_unlock_irq(&conf->device_lock);
11891181
wake_up(&conf->wait_barrier);
11901182
md_wakeup_thread(mddev->thread);
@@ -1588,11 +1580,9 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
15881580
plug = NULL;
15891581
if (plug) {
15901582
bio_list_add(&plug->pending, mbio);
1591-
plug->pending_cnt++;
15921583
} else {
15931584
spin_lock_irqsave(&conf->device_lock, flags);
15941585
bio_list_add(&conf->pending_bio_list, mbio);
1595-
conf->pending_count++;
15961586
spin_unlock_irqrestore(&conf->device_lock, flags);
15971587
md_wakeup_thread(mddev->thread);
15981588
}
@@ -3058,7 +3048,6 @@ static struct r1conf *setup_conf(struct mddev *mddev)
30583048
init_waitqueue_head(&conf->wait_barrier);
30593049

30603050
bio_list_init(&conf->pending_bio_list);
3061-
conf->pending_count = 0;
30623051
conf->recovery_disabled = mddev->recovery_disabled - 1;
30633052

30643053
err = -EIO;

drivers/md/raid1.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ struct r1conf {
8787

8888
/* queue pending writes to be submitted on unplug */
8989
struct bio_list pending_bio_list;
90-
int pending_count;
9190

9291
/* for use when syncing mirrors:
9392
* We don't allow both normal IO and resync/recovery IO at

drivers/md/raid10.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,6 @@ static void flush_pending_writes(struct r10conf *conf)
861861
struct bio *bio;
862862

863863
bio = bio_list_get(&conf->pending_bio_list);
864-
conf->pending_count = 0;
865864
spin_unlock_irq(&conf->device_lock);
866865

867866
/*
@@ -1054,24 +1053,16 @@ static sector_t choose_data_offset(struct r10bio *r10_bio,
10541053
return rdev->new_data_offset;
10551054
}
10561055

1057-
struct raid10_plug_cb {
1058-
struct blk_plug_cb cb;
1059-
struct bio_list pending;
1060-
int pending_cnt;
1061-
};
1062-
10631056
static void raid10_unplug(struct blk_plug_cb *cb, bool from_schedule)
10641057
{
1065-
struct raid10_plug_cb *plug = container_of(cb, struct raid10_plug_cb,
1066-
cb);
1058+
struct raid1_plug_cb *plug = container_of(cb, struct raid1_plug_cb, cb);
10671059
struct mddev *mddev = plug->cb.data;
10681060
struct r10conf *conf = mddev->private;
10691061
struct bio *bio;
10701062

10711063
if (from_schedule || current->bio_list) {
10721064
spin_lock_irq(&conf->device_lock);
10731065
bio_list_merge(&conf->pending_bio_list, &plug->pending);
1074-
conf->pending_count += plug->pending_cnt;
10751066
spin_unlock_irq(&conf->device_lock);
10761067
wake_up(&conf->wait_barrier);
10771068
md_wakeup_thread(mddev->thread);
@@ -1238,7 +1229,7 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio,
12381229
const unsigned long do_fua = (bio->bi_opf & REQ_FUA);
12391230
unsigned long flags;
12401231
struct blk_plug_cb *cb;
1241-
struct raid10_plug_cb *plug = NULL;
1232+
struct raid1_plug_cb *plug = NULL;
12421233
struct r10conf *conf = mddev->private;
12431234
struct md_rdev *rdev;
12441235
int devnum = r10_bio->devs[n_copy].devnum;
@@ -1280,16 +1271,14 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio,
12801271

12811272
cb = blk_check_plugged(raid10_unplug, mddev, sizeof(*plug));
12821273
if (cb)
1283-
plug = container_of(cb, struct raid10_plug_cb, cb);
1274+
plug = container_of(cb, struct raid1_plug_cb, cb);
12841275
else
12851276
plug = NULL;
12861277
if (plug) {
12871278
bio_list_add(&plug->pending, mbio);
1288-
plug->pending_cnt++;
12891279
} else {
12901280
spin_lock_irqsave(&conf->device_lock, flags);
12911281
bio_list_add(&conf->pending_bio_list, mbio);
1292-
conf->pending_count++;
12931282
spin_unlock_irqrestore(&conf->device_lock, flags);
12941283
md_wakeup_thread(mddev->thread);
12951284
}

drivers/md/raid10.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ struct r10conf {
7575

7676
/* queue pending writes and submit them on unplug */
7777
struct bio_list pending_bio_list;
78-
int pending_count;
7978

8079
spinlock_t resync_lock;
8180
atomic_t nr_pending;

0 commit comments

Comments
 (0)