[PATCH V2 05/13] block: only account passthrough IO from userspace

Ming Lei ming.lei at redhat.com
Wed Jan 26 00:33:54 PST 2022


On Wed, Jan 26, 2022 at 09:10:52AM +0100, Christoph Hellwig wrote:
> On Wed, Jan 26, 2022 at 03:21:04PM +0800, Ming Lei wrote:
> > > I think the right way would be to just remove this branch entirely.
> > > This means we only account bios with a block_device, which implies
> > > they have a gendisk.
> > 
> > That will not account userspace IO, and people may complain.
> > 
> > We can just account passthrough request from userspace by the patch
> > in my last email.
> 
> Let's take a step back:  what I/O do we want to account, and how
> do we want to archive that?

FS IO, and passthrough IO from userspace at least, since
that is what user cares.

Also the bdev/disk is guaranteed to be live when this userspace
passthrough IO is inflight.

> 
> Assuming accounting is enabled:
> 
>  - current mainline accounts all I/O one queues that have a gendisk
>  - your original patch accounts file system I/O and some passthrough I/O
>    that has a special flag set

The special flag is just for recognizing userspace passthrough IO.

> 
> Dropping the conditional to grab a bdev from the queue leaves us with
> the following rule:
> 
>  - all I/O that has a bio and bdev is accounted.  This requires
>    passthrough I/O to explicitly set the bdev in case we haven't
>    done so, and it requires them to have a bio at all

That is basically to make bio->bi_bdev points to part0, and the
problem is that you have to make sure that part0 won't be released
when this request is inflight.

> 
> I guess you are worried about the latter conditionin that we stop
> accounting for no data transfer passthrough commands?

No, I meant that bio->bi_bdev isn't setup yet for passthrough request,
and not sure that can be done easily.


Thanks,
Ming




More information about the Linux-nvme mailing list