Re: [PATCH 5.10 01/25] md: revert io stats accounting

From: Jack Wang
Date: Wed Jan 26 2022 - 16:22:51 EST


Guillaume Morin <guillaume@xxxxxxxxxxx> 于2022年1月26日周三 16:12写道:
>
> On 26 Jan 11:09, Jack Wang wrote:
> > >
> > > - if (bio->bi_end_io != md_end_io) {
> > > - struct md_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;
> > > -
> > > - bio->bi_end_io = md_end_io;
> > > - bio->bi_private = md_io;
> > > -
> > > - md_io->start_time = part_start_io_acct(mddev->gendisk,
> > > - &md_io->part, bio);
> > > - }
> > > -
> > > + /*
> > > + * save the sectors now since our bio can
> > > + * go away inside make_request
> > > + */
> > > + sectors = bio_sectors(bio);
> > This code snip is not inside the original patch, and it's not in
> > latest upstream too.
> > > /* bio could be mergeable after passing to underlayer */
> > > bio->bi_opf &= ~REQ_NOMERGE;
> > >
> > > md_handle_request(mddev, bio);
> > >
> > > + part_stat_lock();
> > > + part_stat_inc(&mddev->gendisk->part0, ios[sgrp]);
> > > + part_stat_add(&mddev->gendisk->part0, sectors[sgrp], sectors);
> > > + part_stat_unlock();
> > > +
> > same here, this code snip is not inside the original patch, and it's
> > not in latest upstream too.
>
> Both snippets came from the code before 41d2d848e5c0 that the patch is
> being reverted here. As I explained in my original message, upstream is
> different because of 99dfc43ecbf6 which is not in 5.10.
oh, I missed it, you are right.
>
> > I think would be good keep it as the upstream version.
>
> If you don't include these lines, isn't this worse as it's not calling
> either part_start_io_acct or bio_start_io_acct (in 99dfc43ecbf6)?

Your patch is correct.
Sorry for the noise.

>
> --
> Guillaume Morin <guillaume@xxxxxxxxxxx>