[PATCH] nvmet-passthru: Cleanup nvmet_passthru_map_sg()

Logan Gunthorpe logang at deltatee.com
Tue Oct 13 20:20:03 EDT 2020



On 2020-10-13 6:16 p.m., Chaitanya Kulkarni wrote:
> On 10/9/20 16:18, Logan Gunthorpe wrote:
>> Clean up some confusing elements of nvmet_passthru_map_sg() by returning
>> early if the request is greater than the maximum bio size. This allows
>> us to drop the sg_cnt variable.
>>
>> This should not result in any functional change but makes the code
>> clearer and more understandable. The original code allocated a truncated
>> bio then would return EINVAL when bio_add_pc_page() filled that bio. The
>> new code just returns EINVAL early if this would happen.
>>
>> Fixes: c1fef73f793b ("nvmet: add passthru code to process commands")
>> Signed-off-by: Logan Gunthorpe <logang at deltatee.com>
>> Suggested-by: Douglas Gilbert <dgilbert at interlog.com>
>> Cc: Christoph Hellwig <hch at lst.de>
>> Cc: Sagi Grimberg <sagi at grimberg.me>
>> Cc: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
> 
> why the prefix is nvmet-passthru ?

Well that's the prefix I used in the first patch, which follows other
similar conventions like nvmet-tcp, nvmet-fc, nvmet-rdma, nvmet-loop, etc.

Logan




More information about the Linux-nvme mailing list