diff mbox series

[V2,8/9] nvmet: add zns bdev config support

Message ID 20201130032909.40638-9-chaitanya.kulkarni@wdc.com (mailing list archive)
State New, archived
Headers show
Series nvmet: add genblk ZBD backend | expand

Commit Message

Chaitanya Kulkarni Nov. 30, 2020, 3:29 a.m. UTC
For zbd based bdev backend we need to override the ns->blksize_shift
with the physical block size instead of using the logical block size
so that SMR drives will not result in an error.

Update the nvmet_bdev_ns_enable() to reflect that.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/nvme/target/io-cmd-bdev.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Damien Le Moal Nov. 30, 2020, 12:02 p.m. UTC | #1
On 2020/11/30 12:30, Chaitanya Kulkarni wrote:
> For zbd based bdev backend we need to override the ns->blksize_shift
> with the physical block size instead of using the logical block size
> so that SMR drives will not result in an error.
> 
> Update the nvmet_bdev_ns_enable() to reflect that.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  drivers/nvme/target/io-cmd-bdev.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c
> index 125dde3f410e..e1f6d59dd341 100644
> --- a/drivers/nvme/target/io-cmd-bdev.c
> +++ b/drivers/nvme/target/io-cmd-bdev.c
> @@ -86,6 +86,9 @@ int nvmet_bdev_ns_enable(struct nvmet_ns *ns)
>  	if (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY_T10))
>  		nvmet_bdev_ns_enable_integrity(ns);
>  
> +	if (bdev_is_zoned(ns->bdev) && !nvmet_bdev_zns_enable(ns))
> +		return -EINVAL;
> +
>  	return 0;
>  }
>  
> 

I think this should be merged with patch 9. I do not see the point in having
this as a separate patch.
Chaitanya Kulkarni Dec. 1, 2020, 3:40 a.m. UTC | #2
On 11/30/20 04:02, Damien Le Moal wrote:
>>  
>>
> I think this should be merged with patch 9. I do not see the point in having
> this as a separate patch.

These two patches are doing different things, one deals with the target side

configuration management and other deals with the host side I/O handlers
which

has no relation to the target side configuration management, so I kept
it separate.
diff mbox series

Patch

diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c
index 125dde3f410e..e1f6d59dd341 100644
--- a/drivers/nvme/target/io-cmd-bdev.c
+++ b/drivers/nvme/target/io-cmd-bdev.c
@@ -86,6 +86,9 @@  int nvmet_bdev_ns_enable(struct nvmet_ns *ns)
 	if (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY_T10))
 		nvmet_bdev_ns_enable_integrity(ns);
 
+	if (bdev_is_zoned(ns->bdev) && !nvmet_bdev_zns_enable(ns))
+		return -EINVAL;
+
 	return 0;
 }