The commit 41d2d848e5c0 ("md: improve io stats accounting") could cause
double fault problem per the report [1], and also it is not correct to
change ->bi_end_io if md don't own it, so let's revert it.
And io stats accounting will be replemented in later commits.
[1]. https://lore.kernel.org/linux-raid/3bf04253-3fad-434a-63a7-20214e38cf26@gmail.com/T/#t
Fixes: 41d2d848e5c0 ("md: improve io stats accounting")
Signed-off-by: Guoqing Jiang <redacted>
---
drivers/md/md.c | 45 ---------------------------------------------
drivers/md/md.h | 1 -
2 files changed, 46 deletions(-)
@@ -489,21 +465,6 @@ static blk_qc_t md_submit_bio(struct bio *bio)returnBLK_QC_T_NONE;}-if(bio->bi_end_io!=md_end_io){-structmd_io*md_io;--md_io=mempool_alloc(&mddev->md_io_pool,GFP_NOIO);-md_io->mddev=mddev;-md_io->orig_bi_end_io=bio->bi_end_io;-md_io->orig_bi_private=bio->bi_private;-md_io->orig_bi_bdev=bio->bi_bdev;--bio->bi_end_io=md_end_io;-bio->bi_private=md_io;--md_io->start_time=bio_start_io_acct(bio);-}-/* bio could be mergeable after passing to underlayer */bio->bi_opf&=~REQ_NOMERGE;
We don't need to clone bio if the relevant region has badblock.
Signed-off-by: Guoqing Jiang <redacted>
---
drivers/md/raid5.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
@@ -5427,6 +5427,13 @@ static int raid5_read_one_chunk(struct mddev *mddev, struct bio *raid_bio)atomic_inc(&rdev->nr_pending);rcu_read_unlock();+if(is_badblock(rdev,sector,bio_sectors(raid_bio),&first_bad,+&bad_sectors)){+bio_put(raid_bio);+rdev_dec_pending(rdev,mddev);+return0;+}+align_bio=bio_clone_fast(raid_bio,GFP_NOIO,&mddev->bio_set);bio_set_dev(align_bio,rdev->bdev);align_bio->bi_end_io=raid5_align_endio;
@@ -5435,13 +5442,6 @@ static int raid5_read_one_chunk(struct mddev *mddev, struct bio *raid_bio)raid_bio->bi_next=(void*)rdev;-if(is_badblock(rdev,sector,bio_sectors(align_bio),&first_bad,-&bad_sectors)){-bio_put(align_bio);-rdev_dec_pending(rdev,mddev);-return0;-}-/* No reshape active, so we can trust rdev->data_offset */align_bio->bi_iter.bi_sector+=rdev->data_offset;
We introduce a new bioset (io_acct_set) for raid0 and raid5 since they
don't own clone infrastructure to accounting io. And the bioset is added
to mddev instead of to raid0 and raid5 layer, because with this way, we
can put common functions to md.h and reuse them in raid0 and raid5.
Also struct md_io_acct is added accordingly which includes io start_time,
the origin bio and cloned bio. Then we can call bio_{start,end}_io_acct
to get related io status.
Signed-off-by: Guoqing Jiang <redacted>
---
drivers/md/md.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
drivers/md/md.h | 8 ++++++++
drivers/md/raid0.c | 3 +++
drivers/md/raid5.c | 9 +++++++++
4 files changed, 63 insertions(+), 1 deletion(-)
@@ -2340,7 +2340,8 @@ int md_integrity_register(struct mddev *mddev)bdev_get_integrity(reference->bdev));pr_debug("md: data integrity enabled on %s\n",mdname(mddev));-if(bioset_integrity_create(&mddev->bio_set,BIO_POOL_SIZE)){+if(bioset_integrity_create(&mddev->bio_set,BIO_POOL_SIZE)||+bioset_integrity_create(&mddev->io_acct_set,BIO_POOL_SIZE)){pr_err("md: failed to create integrity pool for %s\n",mdname(mddev));return-EINVAL;
After enable io accounting, chunk read bio could be cloned twice which
is not good. To avoid such inefficiency, let's clone align_bio from
io_acct_set too, then we need only call md_account_bio in make_request
unconditionally.
Signed-off-by: Guoqing Jiang <redacted>
---
drivers/md/raid5.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
@@ -5364,11 +5364,13 @@ static struct bio *remove_bio_from_retry(struct r5conf *conf,*/staticvoidraid5_align_endio(structbio*bi){-structbio*raid_bi=bi->bi_private;+structmd_io_acct*md_io_acct=bi->bi_private;+structbio*raid_bi=md_io_acct->orig_bio;structmddev*mddev;structr5conf*conf;structmd_rdev*rdev;blk_status_terror=bi->bi_status;+unsignedlongstart_time=md_io_acct->start_time;bio_put(bi);
@@ -5380,6 +5382,8 @@ static void raid5_align_endio(struct bio *bi)rdev_dec_pending(rdev,conf->mddev);if(!error){+if(blk_queue_io_stat(raid_bi->bi_bdev->bd_disk->queue))+bio_end_io_acct(raid_bi,start_time);bio_endio(raid_bi);if(atomic_dec_and_test(&conf->active_aligned_reads))wake_up(&conf->wait_for_quiescent);
@@ -5398,6 +5402,7 @@ static int raid5_read_one_chunk(struct mddev *mddev, struct bio *raid_bio)structmd_rdev*rdev;sector_tsector,end_sector,first_bad;intbad_sectors,dd_idx;+structmd_io_acct*md_io_acct;if(!in_chunk_boundary(mddev,raid_bio)){pr_debug("%s: non aligned\n",__func__);
@@ -5434,14 +5439,18 @@ static int raid5_read_one_chunk(struct mddev *mddev, struct bio *raid_bio)return0;}-align_bio=bio_clone_fast(raid_bio,GFP_NOIO,&mddev->bio_set);+align_bio=bio_clone_fast(raid_bio,GFP_NOIO,&mddev->io_acct_set);+md_io_acct=container_of(align_bio,structmd_io_acct,bio_clone);+raid_bio->bi_next=(void*)rdev;+if(blk_queue_io_stat(raid_bio->bi_bdev->bd_disk->queue))+md_io_acct->start_time=bio_start_io_acct(raid_bio);+md_io_acct->orig_bio=raid_bio;+bio_set_dev(align_bio,rdev->bdev);align_bio->bi_end_io=raid5_align_endio;-align_bio->bi_private=raid_bio;+align_bio->bi_private=md_io_acct;align_bio->bi_iter.bi_sector=sector;-raid_bio->bi_next=(void*)rdev;-/* No reshape active, so we can trust rdev->data_offset */align_bio->bi_iter.bi_sector+=rdev->data_offset;
@@ -5468,7 +5477,6 @@ static struct bio *chunk_aligned_read(struct mddev *mddev, struct bio *raid_bio)sector_tsector=raid_bio->bi_iter.bi_sector;unsignedchunk_sects=mddev->chunk_sectors;unsignedsectors=chunk_sects-(sector&(chunk_sects-1));-structr5conf*conf=mddev->private;if(sectors<bio_sectors(raid_bio)){structr5conf*conf=mddev->private;
@@ -5478,9 +5486,6 @@ static struct bio *chunk_aligned_read(struct mddev *mddev, struct bio *raid_bio)raid_bio=split;}-if(raid_bio->bi_pool!=&conf->bio_split)-md_account_bio(mddev,&raid_bio);-if(!raid5_read_one_chunk(mddev,raid_bio))returnraid_bio;
The caller of raid1_read_request could pass NULL or a valid pointer for
"struct r1bio *r1_bio", so it actually means whether r1_bio is existed
or not.
Signed-off-by: Guoqing Jiang <redacted>
---
drivers/md/raid1.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
@@ -1220,7 +1220,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,*/gfp_tgfp=r1_bio?(GFP_NOIO|__GFP_HIGH):GFP_NOIO;-if(print_msg){+if(r1bio_existed){/* Need to get the block device name carefully */structmd_rdev*rdev;rcu_read_lock();
@@ -1252,7 +1252,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,if(rdisk<0){/* couldn't find anywhere to read from */-if(print_msg){+if(r1bio_existed){pr_crit_ratelimited("md/raid1:%s: %s: unrecoverable I/O read error for block %llu\n",mdname(mddev),b,
@@ -1263,7 +1263,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,}mirror=conf->mirrors+rdisk;-if(print_msg)+if(r1bio_existed)pr_info_ratelimited("md/raid1:%s: redirecting sector %llu to other mirror: %s\n",mdname(mddev),(unsignedlonglong)r1_bio->sector,
For raid1, we record the start time between split bio and clone bio,
and finish the accounting in the final endio.
Also introduce start_time in r1bio accordingly.
Signed-off-by: Guoqing Jiang <redacted>
---
drivers/md/raid1.c | 7 +++++++
drivers/md/raid1.h | 1 +
2 files changed, 8 insertions(+)
For raid10, we record the start time between split bio and clone bio,
and finish the accounting in the final endio.
Also introduce start_time in r10bio accordingly.
Signed-off-by: Guoqing Jiang <redacted>
---
drivers/md/raid10.c | 6 ++++++
drivers/md/raid10.h | 1 +
2 files changed, 7 insertions(+)
Mark the three personalities (linear, fault and multipath) as deprecated
because:
1. people can use dm multipath or nvme multipath.
2. linear is already deprecated in MODULE_ALIAS.
3. no one actively using fault.
Signed-off-by: Guoqing Jiang <redacted>
---
drivers/md/Kconfig | 6 +++---
drivers/md/md-faulty.c | 2 +-
drivers/md/md-linear.c | 2 +-
drivers/md/md-multipath.c | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
@@ -169,7 +169,7 @@ config MD_MULTIPATHIfunsure,sayN.configMD_FAULTY-tristate"Faulty test module for MD"+tristate"Faulty test module for MD (deprecated)"depends onBLK_DEV_MDhelpThe"faulty"moduleallowsforablockdevicethatoccasionallyreturns
From: Song Liu <song@kernel.org> Date: 2021-05-26 06:32:59
On Tue, May 25, 2021 at 2:47 AM Guoqing Jiang [off-list ref] wrote:
We introduce a new bioset (io_acct_set) for raid0 and raid5 since they
don't own clone infrastructure to accounting io. And the bioset is added
to mddev instead of to raid0 and raid5 layer, because with this way, we
can put common functions to md.h and reuse them in raid0 and raid5.
Also struct md_io_acct is added accordingly which includes io start_time,
the origin bio and cloned bio. Then we can call bio_{start,end}_io_acct
to get related io status.
Signed-off-by: Guoqing Jiang <redacted>
Applied the set to md-next, with some changes on this one. Please take a look at
these changes.
Thanks,
Song
[...]
quoted hunk
--- a/drivers/md/md.c+++ b/drivers/md/md.c
@@ -2340,7 +2340,8 @@ int md_integrity_register(struct mddev *mddev)bdev_get_integrity(reference->bdev));pr_debug("md: data integrity enabled on %s\n",mdname(mddev));-if(bioset_integrity_create(&mddev->bio_set,BIO_POOL_SIZE)){+if(bioset_integrity_create(&mddev->bio_set,BIO_POOL_SIZE)||+bioset_integrity_create(&mddev->io_acct_set,BIO_POOL_SIZE)){
Added better error handling here.
quoted hunk
pr_err("md: failed to create integrity pool for %s\n",
mdname(mddev));
return -EINVAL;
+
+ if (!blk_queue_io_stat((*bio)->bi_bdev->bd_disk->queue))
+ return;
Added blk_queue_flag_set(QUEUE_FLAG_IO_STAT, mddev->queue); to md_run.
We still need it as md doesn't use mq. Without it, the default iostats is 0.
[...]
On Tue, May 25, 2021 at 2:47 AM Guoqing Jiang [off-list ref] wrote:
quoted
--- a/drivers/md/md.c+++ b/drivers/md/md.c
@@ -2340,7 +2340,8 @@ int md_integrity_register(struct mddev *mddev)bdev_get_integrity(reference->bdev));pr_debug("md: data integrity enabled on %s\n",mdname(mddev));-if(bioset_integrity_create(&mddev->bio_set,BIO_POOL_SIZE)){+if(bioset_integrity_create(&mddev->bio_set,BIO_POOL_SIZE)||+bioset_integrity_create(&mddev->io_acct_set,BIO_POOL_SIZE)){
Added better error handling here.
No need to do it here, because md_integrity_register is called from
md_run() -> pers->run(), if above returns failure, then the path
(bioset_exit -> bioset_integrity_free) is triggered.
I thought we probably need a comment here given it is not explicit.
quoted
pr_err("md: failed to create integrity pool for %s\n",
mdname(mddev));
return -EINVAL;
From: Song Liu <song@kernel.org> Date: 2021-05-26 16:00:21
On Wed, May 26, 2021 at 12:53 AM Guoqing Jiang [off-list ref] wrote:
On 5/26/21 2:32 PM, Song Liu wrote:
quoted
On Tue, May 25, 2021 at 2:47 AM Guoqing Jiang [off-list ref] wrote:
quoted
--- a/drivers/md/md.c+++ b/drivers/md/md.c
@@ -2340,7 +2340,8 @@ int md_integrity_register(struct mddev *mddev)bdev_get_integrity(reference->bdev));pr_debug("md: data integrity enabled on %s\n",mdname(mddev));-if(bioset_integrity_create(&mddev->bio_set,BIO_POOL_SIZE)){+if(bioset_integrity_create(&mddev->bio_set,BIO_POOL_SIZE)||+bioset_integrity_create(&mddev->io_acct_set,BIO_POOL_SIZE)){
Added better error handling here.
No need to do it here, because md_integrity_register is called from
md_run() -> pers->run(), if above returns failure, then the path
(bioset_exit -> bioset_integrity_free) is triggered.
I thought we probably need a comment here given it is not explicit.
I think it is better to handle it within this function. Does it have
any downside
to call bioset_integrity_free(&mddev->bio_set) here?
[...]
quoted
quoted
+
+ if (!blk_queue_io_stat((*bio)->bi_bdev->bd_disk->queue))
+ return;
Added blk_queue_flag_set(QUEUE_FLAG_IO_STAT, mddev->queue); to md_run.
We still need it as md doesn't use mq. Without it, the default iostats is 0.
It enables io accounting by default, so raid5 and raid0 users have to
disable it if they don't want the additional latency.
iostats was on by default before this set, as we didn't check
blk_queue_io_stat().
So it is better to keep the same behavior.
Thanks,
Song
On Wed, May 26, 2021 at 12:53 AM Guoqing Jiang [off-list ref] wrote:
quoted
On 5/26/21 2:32 PM, Song Liu wrote:
quoted
On Tue, May 25, 2021 at 2:47 AM Guoqing Jiang [off-list ref] wrote:
quoted
--- a/drivers/md/md.c+++ b/drivers/md/md.c
@@ -2340,7 +2340,8 @@ int md_integrity_register(struct mddev *mddev)bdev_get_integrity(reference->bdev));pr_debug("md: data integrity enabled on %s\n",mdname(mddev));-if(bioset_integrity_create(&mddev->bio_set,BIO_POOL_SIZE)){+if(bioset_integrity_create(&mddev->bio_set,BIO_POOL_SIZE)||+bioset_integrity_create(&mddev->io_acct_set,BIO_POOL_SIZE)){
Added better error handling here.
No need to do it here, because md_integrity_register is called from
md_run() -> pers->run(), if above returns failure, then the path
(bioset_exit -> bioset_integrity_free) is triggered.
I thought we probably need a comment here given it is not explicit.
I think it is better to handle it within this function. Does it have
any downside
to call bioset_integrity_free(&mddev->bio_set) here?
[...]
md_run has to deal with failure path by call bioset_exit, which
already call bioset_integrity_free implicitly. Why the additional
call of bioset_integrity_free would be helpful? Or do you want
to remove bioset_exit from md_run as well?
quoted
quoted
quoted
+
+ if (!blk_queue_io_stat((*bio)->bi_bdev->bd_disk->queue))
+ return;
Added blk_queue_flag_set(QUEUE_FLAG_IO_STAT, mddev->queue); to md_run.
We still need it as md doesn't use mq. Without it, the default iostats is 0.
It enables io accounting by default, so raid5 and raid0 users have to
disable it if they don't want the additional latency.
iostats was on by default before this set, as we didn't check
blk_queue_io_stat().
So it is better to keep the same behavior.
Could you point the place where md enables iostats before the set?
I can't find relevant code for it.
Thanks,
Guoqing
From: Song Liu <song@kernel.org> Date: 2021-05-27 06:14:28
On Wed, May 26, 2021 at 7:00 PM Guoqing Jiang [off-list ref] wrote:
[...]
quoted
quoted
(bioset_exit -> bioset_integrity_free) is triggered.
I thought we probably need a comment here given it is not explicit.
I think it is better to handle it within this function. Does it have
any downside
to call bioset_integrity_free(&mddev->bio_set) here?
[...]
md_run has to deal with failure path by call bioset_exit, which
already call bioset_integrity_free implicitly. Why the additional
call of bioset_integrity_free would be helpful? Or do you want
to remove bioset_exit from md_run as well?
I guess you are right. Removing this one.
quoted
quoted
quoted
quoted
+
+ if (!blk_queue_io_stat((*bio)->bi_bdev->bd_disk->queue))
+ return;
Added blk_queue_flag_set(QUEUE_FLAG_IO_STAT, mddev->queue); to md_run.
We still need it as md doesn't use mq. Without it, the default iostats is 0.
It enables io accounting by default, so raid5 and raid0 users have to
disable it if they don't want the additional latency.
iostats was on by default before this set, as we didn't check
blk_queue_io_stat().
So it is better to keep the same behavior.
Could you point the place where md enables iostats before the set?
I can't find relevant code for it.
Before this set, we did not set QUEUE_FLAG_IO_STAT, and we didn't
check blk_queue_io_stat() either. So even with /sys/block/mdX/queue/iostats
of 0, we still get iostats for the md device. By setting QUEUE_FLAG_IO_STAT
with the patch, the users still get iostats working by default.
Does this make sense?
Thanks,
Song
Could you point the place where md enables iostats before the set?
I can't find relevant code for it.
Before this set, we did not set QUEUE_FLAG_IO_STAT, and we didn't
check blk_queue_io_stat() either. So even with /sys/block/mdX/queue/iostats
of 0, we still get iostats for the md device. By setting QUEUE_FLAG_IO_STAT
with the patch, the users still get iostats working by default.
I am okay with enable it by default, though users need to know the
parameter given it affects the performance.
Thanks,
Guoqing
From: Christoph Hellwig <hch@infradead.org> Date: 2021-05-27 15:26:08
On Tue, May 25, 2021 at 05:46:17PM +0800, Guoqing Jiang wrote:
quoted hunk
We introduce a new bioset (io_acct_set) for raid0 and raid5 since they
don't own clone infrastructure to accounting io. And the bioset is added
to mddev instead of to raid0 and raid5 layer, because with this way, we
can put common functions to md.h and reuse them in raid0 and raid5.
Also struct md_io_acct is added accordingly which includes io start_time,
the origin bio and cloned bio. Then we can call bio_{start,end}_io_acct
to get related io status.
Signed-off-by: Guoqing Jiang <redacted>
---
drivers/md/md.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
drivers/md/md.h | 8 ++++++++
drivers/md/raid0.c | 3 +++
drivers/md/raid5.c | 9 +++++++++
4 files changed, 63 insertions(+), 1 deletion(-)
@@ -2340,7 +2340,8 @@ int md_integrity_register(struct mddev *mddev)bdev_get_integrity(reference->bdev));pr_debug("md: data integrity enabled on %s\n",mdname(mddev));-if(bioset_integrity_create(&mddev->bio_set,BIO_POOL_SIZE)){+if(bioset_integrity_create(&mddev->bio_set,BIO_POOL_SIZE)||+bioset_integrity_create(&mddev->io_acct_set,BIO_POOL_SIZE)){
Don't we need to create this new only for raid0 and raid5?
Shouldn't they call helpers to create it?
quoted hunk
@@ -5864,6 +5866,12 @@ int md_run(struct mddev *mddev) if (err) return err; }+ if (!bioset_initialized(&mddev->io_acct_set)) {+ err = bioset_init(&mddev->io_acct_set, BIO_POOL_SIZE,+ offsetof(struct md_io_acct, bio_clone), 0);+ if (err)+ return err;+ }
Can someone explain why we are having these bioset_initialized checks
here (also for the existing one)? This just smells like very sloppy
life time rules.
+/* used by personalities (raid0 and raid5) to account io stats */
Instead of mentioning the personalities this migt better explain
something like ".. by personalities that don't already clone the
bio and thus can't easily add the timestamp to their extended bio
structure"
pr_debug("md: data integrity enabled on %s\n", mdname(mddev));
- if (bioset_integrity_create(&mddev->bio_set, BIO_POOL_SIZE)) {
+ if (bioset_integrity_create(&mddev->bio_set, BIO_POOL_SIZE) ||
+ bioset_integrity_create(&mddev->io_acct_set, BIO_POOL_SIZE)) {
Don't we need to create this new only for raid0 and raid5?
Shouldn't they call helpers to create it?
Good catch, will add a check for level.
quoted
@@ -5864,6 +5866,12 @@ int md_run(struct mddev *mddev) if (err) return err; }+ if (!bioset_initialized(&mddev->io_acct_set)) {+ err = bioset_init(&mddev->io_acct_set, BIO_POOL_SIZE,+ offsetof(struct md_io_acct, bio_clone), 0);+ if (err)+ return err;+ }
Can someone explain why we are having these bioset_initialized checks
here (also for the existing one)? This just smells like very sloppy
life time rules.
My understanding is that md_run is not only called when array is
created/assembled, for example, it can also be called in md_ioctl,
which means you can't call bioset_init unconditionally. Others may
have better explanation.
BTW, besides md, dm is another user of bioset_initialized.
quoted
+/* used by personalities (raid0 and raid5) to account io stats */
Instead of mentioning the personalities this migt better explain
something like ".. by personalities that don't already clone the
bio and thus can't easily add the timestamp to their extended bio
structure"
I would find a calling conventions that returns the allocated clone
(or the original bio if there is no accounting) more logical.
Not sure if I follow, do you want the function return "struct bio *"
instead of "void"? I don't think there is fundamental difference
with current behavior.
quoted
+ struct bio_set io_acct_set; /* for raid0 and raid5 io accounting */
crazy long line.
At lease it aligns with above line and checkpatch doesn't complain
either.
Thanks,
Guoqing
From: Guoqing Jiang <redacted>
We introduce a new bioset (io_acct_set) for raid0 and raid5 since they
don't own clone infrastructure to accounting io. And the bioset is added
to mddev instead of to raid0 and raid5 layer, because with this way, we
can put common functions to md.h and reuse them in raid0 and raid5.
Also struct md_io_acct is added accordingly which includes io start_time,
the origin bio and cloned bio. Then we can call bio_{start,end}_io_acct
to get related io status.
Signed-off-by: Guoqing Jiang <redacted>
Signed-off-by: Song Liu <song@kernel.org>
---
Hi Song,
Please consider apply the updated patch which has minor changes based on
Christoph's comment.
1. don't create io_acct_set for raid1 and raid10.
2. update comment for md_account_bio.
Thanks,
Guoqing
drivers/md/md.c | 55 +++++++++++++++++++++++++++++++++++++++++++---
drivers/md/md.h | 8 +++++++
drivers/md/raid0.c | 3 +++
drivers/md/raid5.c | 9 ++++++++
4 files changed, 72 insertions(+), 3 deletions(-)
@@ -2340,7 +2340,9 @@ int md_integrity_register(struct mddev *mddev)bdev_get_integrity(reference->bdev));pr_debug("md: data integrity enabled on %s\n",mdname(mddev));-if(bioset_integrity_create(&mddev->bio_set,BIO_POOL_SIZE)){+if(bioset_integrity_create(&mddev->bio_set,BIO_POOL_SIZE)||+(mddev->level!=1&&mddev->level!=10&&+bioset_integrity_create(&mddev->io_acct_set,BIO_POOL_SIZE))){pr_err("md: failed to create integrity pool for %s\n",mdname(mddev));return-EINVAL;
From: Guoqing Jiang <redacted>
We introduce a new bioset (io_acct_set) for raid0 and raid5 since they
don't own clone infrastructure to accounting io. And the bioset is added
to mddev instead of to raid0 and raid5 layer, because with this way, we
can put common functions to md.h and reuse them in raid0 and raid5.
Also struct md_io_acct is added accordingly which includes io start_time,
the origin bio and cloned bio. Then we can call bio_{start,end}_io_acct
to get related io status.
Signed-off-by: Guoqing Jiang <redacted>
Signed-off-by: Song Liu <song@kernel.org>
---
Hi Song,
Please consider apply the updated patch which has minor changes based on
Christoph's comment.
1. don't create io_acct_set for raid1 and raid10.
2. update comment for md_account_bio.
Pls ignore this given it didn't check all the places before io_acct_set.
Do you want an incremental patch against for-next branch or a fresh
one to replace current patch in the tree?
Thanks,
Guoqing
From: Song Liu <song@kernel.org> Date: 2021-06-03 06:54:54
On Wed, Jun 2, 2021 at 6:17 PM Guoqing Jiang [off-list ref] wrote:
On 6/1/21 9:19 AM, Guoqing Jiang wrote:
quoted
From: Guoqing Jiang <redacted>
We introduce a new bioset (io_acct_set) for raid0 and raid5 since they
don't own clone infrastructure to accounting io. And the bioset is added
to mddev instead of to raid0 and raid5 layer, because with this way, we
can put common functions to md.h and reuse them in raid0 and raid5.
Also struct md_io_acct is added accordingly which includes io start_time,
the origin bio and cloned bio. Then we can call bio_{start,end}_io_acct
to get related io status.
Signed-off-by: Guoqing Jiang <redacted>
Signed-off-by: Song Liu <song@kernel.org>
---
Hi Song,
Please consider apply the updated patch which has minor changes based on
Christoph's comment.
1. don't create io_acct_set for raid1 and raid10.
2. update comment for md_account_bio.
Pls ignore this given it didn't check all the places before io_acct_set.
Do you want an incremental patch against for-next branch or a fresh
one to replace current patch in the tree?
Hi Guoqing,
Thanks for the hard work on this. Please send a fix patch on top of current
md-next.
Song