Re: [PATCH V3 2/8] md: add io accounting for raid0 and raid5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 25, 2021 at 2:47 AM Guoqing Jiang <jgq516@xxxxxxxxx> 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 <jiangguoqing@xxxxxxxxxx>

Applied the set to md-next, with some changes on this one. Please take a look at
these changes.

Thanks,
Song

[...]

> --- 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.

>                 pr_err("md: failed to create integrity pool for %s\n",
>                        mdname(mddev));
>                 return -EINVAL;
> @@ -5569,6 +5570,7 @@ static void md_free(struct kobject *ko)
>
>         bioset_exit(&mddev->bio_set);
>         bioset_exit(&mddev->sync_set);
> +       bioset_exit(&mddev->io_acct_set);
>         kfree(mddev);
>  }
>
> @@ -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;
> +       }

And here (for the other two bioset_initialized calls).

>
>         spin_lock(&pers_lock);
>         pers = find_pers(mddev->level, mddev->clevel);

[...]

> +
> +       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.

[...]



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux