[PATCH v2] block: unmap and free user mapped integrity via submitter
Kanchan Joshi
joshi.k at samsung.com
Fri May 24 03:19:31 PDT 2024
On 5/20/2024 9:19 PM, Christoph Hellwig wrote:
>> diff --git a/block/bio-integrity.c b/block/bio-integrity.c
>> index 2e3e8e04961e..8b528e12136f 100644
>> --- a/block/bio-integrity.c
>> +++ b/block/bio-integrity.c
>> @@ -144,16 +144,38 @@ void bio_integrity_free(struct bio *bio)
>> struct bio_integrity_payload *bip = bio_integrity(bio);
>> struct bio_set *bs = bio->bi_pool;
>>
>> + if (bip->bip_flags & BIP_INTEGRITY_USER)
>> + return;
>> if (bip->bip_flags & BIP_BLOCK_INTEGRITY)
>> kfree(bvec_virt(bip->bip_vec));
>> - else if (bip->bip_flags & BIP_INTEGRITY_USER)
>> - bio_integrity_unmap_user(bip);
>>
>> __bio_integrity_free(bs, bip);
>> bio->bi_integrity = NULL;
>> bio->bi_opf &= ~REQ_INTEGRITY;
>
> This looks correct. I wish we could go one step further (maybe
> in a separate patch/series) to also move freeing the bio integrity
> data to the callers. In fact I wonder if there is any point in
> doing this early separate free vs just doing it as part of the
> final bio put.
Tried to think in this direction in past.
But bio_put will not be called if bio is statically allocated. Currently
that gets freed implicitly because bio_endio is called and it tries to
free the integrity.
More information about the Linux-nvme
mailing list