On 7/2/20 11:25 PM, Song Liu wrote:
On Thu, Jul 2, 2020 at 7:29 AM Artur Paszkiewicz
<artur.paszkiewicz@xxxxxxxxx> wrote:
Use generic io accounting functions to manage io stats. There was an
attempt to do this earlier in commit 18c0b223cf99 ("md: use generic io
stats accounting functions to simplify io stat accounting"), but it did
not include a call to generic_end_io_acct() and caused issues with
tracking in-flight IOs, so it was later removed in commit 74672d069b29
("md: fix md io stats accounting broken").
This patch attempts to fix this by using both bio_start_io_acct() and
bio_end_io_acct(). To make it possible, a struct md_io is allocated for
every new md bio, which includes the io start_time. A new mempool is
introduced for this purpose. We override bio->bi_end_io with our own
callback and call bio_start_io_acct() before passing the bio to
md_handle_request(). When it completes, we call bio_end_io_acct() and
the original bi_end_io callback.
This adds correct statistics about in-flight IOs and IO processing time,
interpreted e.g. in iostat as await, svctm, aqu-sz and %util.
It also fixes a situation where too many IOs where reported if a bio was
re-submitted to the mddev, because io accounting is now performed only
on newly arriving bios.
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@xxxxxxxxx>
Thanks Artur and Guoqing!
I run quick test with this. Seems it only adds proper statistics to
raid5 array, but
not to raid0 array. Is this expected?
Because bio_endio is not called, and it is same for linear and faulty.
I think we have to clone bio for them ..., then it is better to do the
job in the personality layer.
1. For md-multipath, raid1 and raid10, track start time by change the
multipath_bh, r1bio and r10bio.
2. For raid5, override the bi_end_io like this.
3. Then other personalities have to clone bio ...
Thanks,
Guoqing