[PATCH 2/4] xen-blkfront: rely on the default discard granularity

2024-02-21 Thread Christoph Hellwig
The block layer now sets the discard granularity to the physical
block size default.  Take advantage of that in xen-blkfront and only
set the discard granularity if explicitly specified.

Signed-off-by: Christoph Hellwig 
Acked-by: Roger Pau Monné 
---
 drivers/block/xen-blkfront.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index f78167cd5a6333..1258f24b285500 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -951,8 +951,8 @@ static void blkif_set_queue_limits(struct blkfront_info 
*info)
 
if (info->feature_discard) {
blk_queue_max_discard_sectors(rq, UINT_MAX);
-   rq->limits.discard_granularity = info->discard_granularity ?:
-info->physical_sector_size;
+   if (info->discard_granularity)
+   rq->limits.discard_granularity = 
info->discard_granularity;
rq->limits.discard_alignment = info->discard_alignment;
if (info->feature_secdiscard)
blk_queue_max_secure_erase_sectors(rq, UINT_MAX);
-- 
2.39.2




Re: [PATCH 2/4] xen-blkfront: rely on the default discard granularity

2024-02-20 Thread Roger Pau Monné
On Tue, Feb 20, 2024 at 09:49:33AM +0100, Christoph Hellwig wrote:
> The block layer now sets the discard granularity to the physical
> block size default.  Take advantage of that in xen-blkfront and only
> set the discard granularity if explicitly specified.
> 
> Signed-off-by: Christoph Hellwig 

Acked-by: Roger Pau Monné 

Thanks, Roger.



[PATCH 2/4] xen-blkfront: rely on the default discard granularity

2024-02-20 Thread Christoph Hellwig
The block layer now sets the discard granularity to the physical
block size default.  Take advantage of that in xen-blkfront and only
set the discard granularity if explicitly specified.

Signed-off-by: Christoph Hellwig 
---
 drivers/block/xen-blkfront.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index f78167cd5a6333..1258f24b285500 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -951,8 +951,8 @@ static void blkif_set_queue_limits(struct blkfront_info 
*info)
 
if (info->feature_discard) {
blk_queue_max_discard_sectors(rq, UINT_MAX);
-   rq->limits.discard_granularity = info->discard_granularity ?:
-info->physical_sector_size;
+   if (info->discard_granularity)
+   rq->limits.discard_granularity = 
info->discard_granularity;
rq->limits.discard_alignment = info->discard_alignment;
if (info->feature_secdiscard)
blk_queue_max_secure_erase_sectors(rq, UINT_MAX);
-- 
2.39.2