On 2/24/21 4:53 AM, Stefan Hajnoczi wrote:> On Mon, Feb 22, 2021 at 01:11:15PM -0800, Chaitanya Kulkarni wrote:
>> The function blk_put_request() is just a wrapper to
>> blk_mq_free_request(), remove the unnecessary wrapper.
>>
>> Any feedback is welcome on this RFC.
>>
>> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
>> ---
>> block/blk-core.c | 6 ------
>> block/blk-merge.c | 2 +-
>> block/bsg-lib.c | 4 ++--
>> block/bsg.c | 4 ++--
>> block/scsi_ioctl.c | 6 +++---
>> drivers/block/paride/pd.c | 2 +-
>> drivers/block/pktcdvd.c | 2 +-
>> drivers/block/virtio_blk.c | 2 +-
>> drivers/cdrom/cdrom.c | 4 ++--
>> drivers/ide/ide-atapi.c | 2 +-
>> drivers/ide/ide-cd.c | 4 ++--
>> drivers/ide/ide-cd_ioctl.c | 2 +-
>> drivers/ide/ide-devsets.c | 2 +-
>> drivers/ide/ide-disk.c | 2 +-
>> drivers/ide/ide-ioctls.c | 4 ++--
>> drivers/ide/ide-park.c | 2 +-
>> drivers/ide/ide-pm.c | 4 ++--
>> drivers/ide/ide-tape.c | 2 +-
>> drivers/ide/ide-taskfile.c | 2 +-
>> drivers/md/dm-mpath.c | 2 +-
>> drivers/mmc/core/block.c | 10 +++++-----
>> drivers/scsi/scsi_error.c | 2 +-
>> drivers/scsi/scsi_lib.c | 2 +-
>> drivers/scsi/sg.c | 6 +++---
>> drivers/scsi/st.c | 4 ++--
>> drivers/scsi/ufs/ufshcd.c | 6 +++---
>> drivers/target/target_core_pscsi.c | 4 ++--
>> fs/nfsd/blocklayout.c | 4 ++--
>> include/linux/blkdev.h | 1 -
>> 29 files changed, 46 insertions(+), 53 deletions(-)
>>
>> diff --git a/block/blk-core.c b/block/blk-core.c
>> index fc60ff208497..1754f5e7cc80 100644
>> --- a/block/blk-core.c
>> +++ b/block/blk-core.c
>> @@ -642,12 +642,6 @@ struct request *blk_get_request(struct
request_queue *q, unsigned int op,
>> }
>> EXPORT_SYMBOL(blk_get_request);
>>
>> -void blk_put_request(struct request *req)
>> -{
>> - blk_mq_free_request(req);
>> -}
>> -EXPORT_SYMBOL(blk_put_request);
>
> blk_get_request() still exists after this patch. A "get" API
usually has
> a corresponding "put" API. I'm not sure this patch helps the
consistency
> and clarity of the code.
>
> If you do go ahead, please update the blk_get_request() doc comment
> explicitly mentioning that blk_mq_free_request() needs to be called.
Would make sense to rename blk_get_request() to blk_mq_alloc_request()
and then we have API symmetry. The get/put don't make sense when there
are no references involved.
But it's a lot of churn for very little reward, which is always kind
of annoying. Especially for the person that has to carry the patches.
--
Jens Axboe