On Sat, Apr 23, 2022 at 07:53:09PM +0200, Christoph Hellwig wrote: >On Wed, Apr 06, 2022 at 10:50:14AM +0530, Kanchan Joshi wrote: >> > In that case we will base the newer version on its top. >> But if it saves some cycles for you, and also the travel from nvme to >> linux-block tree - I can carry that refactoring as a prep patch in >> this series. Your call. > >FYI, this is what I have so far: > >http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/nvme-passthrough-refactor > >the idea would be to use these lower level helpers for uring, and >not really share the higher level function at all. This does create >a little extra code, but I think it'll be more modular and better >maintainable. Feel free to pull this in if it helps you, otherwise >I'll try to find some time to do more than just light testing and >will post it. Thanks for sharing. So I had picked your previous version, and this one streamlines meta handling further. But the problem is bip gets freed before we reach to this point - +static int nvme_free_user_metadata(struct bio *bio, void __user *ubuf, int ret) +{ + struct bio_integrity_payload *bip = bio_integrity(bio); + void *buf = bvec_virt(bip->bip_vec); + + if (!ret && bio_op(bio) == REQ_OP_DRV_IN && + copy_to_user(ubuf, buf, bip->bip_vec->bv_len)) Without bip, we cannot kill current meta/meta_len fields.