[PATCH 0/3] nvmet: add buffered_io support for bdev-ns

Chaitanya Kulkarni chaitanyak at nvidia.com
Thu Jan 27 00:04:45 PST 2022


On 1/26/22 11:46 PM, Chaitanya Kulkarni wrote:
> Christoph,
> 
> On 1/26/22 8:27 AM, Christoph Hellwig wrote:
>> External email: Use caution opening links or attachments
>>
>>
>> Shouldn't something like the patch below be all we need to use
>> buffered I/O on a block device?
>>
>> diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c
>> index 70ca9dfc1771a..7d9da2f77b83a 100644
>> --- a/drivers/nvme/target/io-cmd-bdev.c
>> +++ b/drivers/nvme/target/io-cmd-bdev.c
>> @@ -76,6 +76,10 @@ int nvmet_bdev_ns_enable(struct nvmet_ns *ns)
>>    {
>>           int ret;
>>
>> +       /* force fallback to the file backend for buffered I/O mode */
>> +       if (ns->buffered_io)
>> +               return -ENOTBLK;
>> +
>>           ns->bdev = blkdev_get_by_path(ns->device_path,
>>                           FMODE_READ | FMODE_WRITE, NULL);
>>           if (IS_ERR(ns->bdev)) {
>>
> 
> This is exactly how I stared this patch-series, but above doesn't
> work since it errors out in the nvme_identify_ns() due to ncap value
> set to 0 (set from ns->size in id-ns admin on target side) see [1],
> since ns->size value we get is 0, that is set using call to
> vfs_getattr(STATX_SIZE) in the nvmet_file_ns_revalidate()
> for file backend.
> 
> 

Also, I believe we need to make sure ns->device_path is block device
type with vfs_getattr(STATX_MODE).




More information about the Linux-nvme mailing list