[PATCH V2 12/12] nvmet: use inline bio for passthru fast path
Chaitanya Kulkarni
Chaitanya.Kulkarni at wdc.com
Tue Sep 1 20:39:03 EDT 2020
On 9/1/20 10:29, Logan Gunthorpe wrote:
>> + if (req->transfer_len <= NVMET_MAX_INLINE_DATA_LEN) {
>> + bio = &req->p.inline_bio;
>> + bio_init(bio, req->inline_bvec, ARRAY_SIZE(req->inline_bvec));
>> + } else {
>> + bio = bio_alloc(GFP_KERNEL, min(sg_cnt, BIO_MAX_PAGES));
>> + }
>> +
>> + bio->bi_end_io = nvmet_passthru_bio_done;
>> bio->bi_opf = req_op(rq) | op_flags;
>> + bio->bi_private = req;
> I still think this would be cleaner to just do:
>
> if (req->transfer_len <= NVMET_MAX_INLINE_DATA_LEN) {
> bio = &req->p.inline_bio;
> bio_init(bio, req->inline_bvec, ARRAY_SIZE(req->inline_bvec));
> } else {
> bio = bio_alloc(GFP_KERNEL, min(sg_cnt, BIO_MAX_PAGES));
> bio->bi_end_io = bio_put
This is intentionally kept consistent with what we have for bdev-ns.
> }
>
>> for_each_sg(req->sg, sg, req->sg_cnt, i) {
>> if (bio_add_pc_page(rq->q, bio, sg_page(sg), sg->length,
>> sg->offset) < sg->length) {
>> - bio_put(bio);
>> + nvmet_passthru_bio_done(bio);
> Then just open code this function here...
> Logan
>
More information about the Linux-nvme
mailing list