All of lore.kernel.org
 help / color / mirror / Atom feed
* fix and cleanup discard_alignment handling
@ 2022-04-18  4:53 ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

Hi all,

the somewhat confusing name of the discard_alignment queue limit, that
really is an offset for the discard granularity mislead a lot of driver
authors to set it to an incorrect value.  This series tries to fix up
all these cases.

Diffstat:
 arch/um/drivers/ubd_kern.c         |    1 -
 drivers/block/loop.c               |    1 -
 drivers/block/nbd.c                |    3 ---
 drivers/block/null_blk/main.c      |    1 -
 drivers/block/rnbd/rnbd-srv-dev.h  |    2 +-
 drivers/block/virtio_blk.c         |    7 ++++---
 drivers/block/xen-blkback/xenbus.c |    4 ++--
 drivers/md/dm-zoned-target.c       |    2 +-
 drivers/md/raid5.c                 |    1 -
 drivers/nvme/host/core.c           |    1 -
 drivers/s390/block/dasd_fba.c      |    1 -
 11 files changed, 8 insertions(+), 16 deletions(-)

^ permalink raw reply	[flat|nested] 99+ messages in thread

* fix and cleanup discard_alignment handling
@ 2022-04-18  4:53 ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, linux-nvme, virtualization,
	Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang, linux-s390,
	Richard Weinberger, xen-devel, linux-um, Mike Snitzer,
	Josef Bacik, nbd, linux-block, Stefan Haberland, linux-raid,
	Martin K. Petersen, Johannes Berg, Roger Pau Monné

Hi all,

the somewhat confusing name of the discard_alignment queue limit, that
really is an offset for the discard granularity mislead a lot of driver
authors to set it to an incorrect value.  This series tries to fix up
all these cases.

Diffstat:
 arch/um/drivers/ubd_kern.c         |    1 -
 drivers/block/loop.c               |    1 -
 drivers/block/nbd.c                |    3 ---
 drivers/block/null_blk/main.c      |    1 -
 drivers/block/rnbd/rnbd-srv-dev.h  |    2 +-
 drivers/block/virtio_blk.c         |    7 ++++---
 drivers/block/xen-blkback/xenbus.c |    4 ++--
 drivers/md/dm-zoned-target.c       |    2 +-
 drivers/md/raid5.c                 |    1 -
 drivers/nvme/host/core.c           |    1 -
 drivers/s390/block/dasd_fba.c      |    1 -
 11 files changed, 8 insertions(+), 16 deletions(-)
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [dm-devel] fix and cleanup discard_alignment handling
@ 2022-04-18  4:53 ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

Hi all,

the somewhat confusing name of the discard_alignment queue limit, that
really is an offset for the discard granularity mislead a lot of driver
authors to set it to an incorrect value.  This series tries to fix up
all these cases.

Diffstat:
 arch/um/drivers/ubd_kern.c         |    1 -
 drivers/block/loop.c               |    1 -
 drivers/block/nbd.c                |    3 ---
 drivers/block/null_blk/main.c      |    1 -
 drivers/block/rnbd/rnbd-srv-dev.h  |    2 +-
 drivers/block/virtio_blk.c         |    7 ++++---
 drivers/block/xen-blkback/xenbus.c |    4 ++--
 drivers/md/dm-zoned-target.c       |    2 +-
 drivers/md/raid5.c                 |    1 -
 drivers/nvme/host/core.c           |    1 -
 drivers/s390/block/dasd_fba.c      |    1 -
 11 files changed, 8 insertions(+), 16 deletions(-)

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 99+ messages in thread

* fix and cleanup discard_alignment handling
@ 2022-04-18  4:53 ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

Hi all,

the somewhat confusing name of the discard_alignment queue limit, that
really is an offset for the discard granularity mislead a lot of driver
authors to set it to an incorrect value.  This series tries to fix up
all these cases.

Diffstat:
 arch/um/drivers/ubd_kern.c         |    1 -
 drivers/block/loop.c               |    1 -
 drivers/block/nbd.c                |    3 ---
 drivers/block/null_blk/main.c      |    1 -
 drivers/block/rnbd/rnbd-srv-dev.h  |    2 +-
 drivers/block/virtio_blk.c         |    7 ++++---
 drivers/block/xen-blkback/xenbus.c |    4 ++--
 drivers/md/dm-zoned-target.c       |    2 +-
 drivers/md/raid5.c                 |    1 -
 drivers/nvme/host/core.c           |    1 -
 drivers/s390/block/dasd_fba.c      |    1 -
 11 files changed, 8 insertions(+), 16 deletions(-)

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 99+ messages in thread

* [PATCH 01/11] ubd: don't set the discard_alignment queue limit
  2022-04-18  4:53 ` Christoph Hellwig
  (?)
  (?)
@ 2022-04-18  4:53   ` Christoph Hellwig
  -1 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by ubd is mostly harmless
but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/um/drivers/ubd_kern.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 085ffdf98e57e..c4344b67628dd 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -799,7 +799,6 @@ static int ubd_open_dev(struct ubd *ubd_dev)
 	}
 	if (ubd_dev->no_trim == 0) {
 		ubd_dev->queue->limits.discard_granularity = SECTOR_SIZE;
-		ubd_dev->queue->limits.discard_alignment = SECTOR_SIZE;
 		blk_queue_max_discard_sectors(ubd_dev->queue, UBD_MAX_REQUEST);
 		blk_queue_max_write_zeroes_sectors(ubd_dev->queue, UBD_MAX_REQUEST);
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 01/11] ubd: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, linux-nvme, virtualization,
	Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang, linux-s390,
	Richard Weinberger, xen-devel, linux-um, Mike Snitzer,
	Josef Bacik, nbd, linux-block, Stefan Haberland, linux-raid,
	Martin K. Petersen, Johannes Berg, Roger Pau Monné

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by ubd is mostly harmless
but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/um/drivers/ubd_kern.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 085ffdf98e57e..c4344b67628dd 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -799,7 +799,6 @@ static int ubd_open_dev(struct ubd *ubd_dev)
 	}
 	if (ubd_dev->no_trim == 0) {
 		ubd_dev->queue->limits.discard_granularity = SECTOR_SIZE;
-		ubd_dev->queue->limits.discard_alignment = SECTOR_SIZE;
 		blk_queue_max_discard_sectors(ubd_dev->queue, UBD_MAX_REQUEST);
 		blk_queue_max_write_zeroes_sectors(ubd_dev->queue, UBD_MAX_REQUEST);
 	}
-- 
2.30.2

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [dm-devel] [PATCH 01/11] ubd: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by ubd is mostly harmless
but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/um/drivers/ubd_kern.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 085ffdf98e57e..c4344b67628dd 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -799,7 +799,6 @@ static int ubd_open_dev(struct ubd *ubd_dev)
 	}
 	if (ubd_dev->no_trim == 0) {
 		ubd_dev->queue->limits.discard_granularity = SECTOR_SIZE;
-		ubd_dev->queue->limits.discard_alignment = SECTOR_SIZE;
 		blk_queue_max_discard_sectors(ubd_dev->queue, UBD_MAX_REQUEST);
 		blk_queue_max_write_zeroes_sectors(ubd_dev->queue, UBD_MAX_REQUEST);
 	}
-- 
2.30.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 01/11] ubd: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by ubd is mostly harmless
but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/um/drivers/ubd_kern.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 085ffdf98e57e..c4344b67628dd 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -799,7 +799,6 @@ static int ubd_open_dev(struct ubd *ubd_dev)
 	}
 	if (ubd_dev->no_trim == 0) {
 		ubd_dev->queue->limits.discard_granularity = SECTOR_SIZE;
-		ubd_dev->queue->limits.discard_alignment = SECTOR_SIZE;
 		blk_queue_max_discard_sectors(ubd_dev->queue, UBD_MAX_REQUEST);
 		blk_queue_max_write_zeroes_sectors(ubd_dev->queue, UBD_MAX_REQUEST);
 	}
-- 
2.30.2


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 02/11] nbd: don't set the discard_alignment queue limit
  2022-04-18  4:53 ` Christoph Hellwig
  (?)
  (?)
@ 2022-04-18  4:53   ` Christoph Hellwig
  -1 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by nbd is mostly harmless
but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/nbd.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 4729aef8c6462..102597a4277b9 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -333,7 +333,6 @@ static int nbd_set_size(struct nbd_device *nbd, loff_t bytesize,
 
 	if (nbd->config->flags & NBD_FLAG_SEND_TRIM) {
 		nbd->disk->queue->limits.discard_granularity = blksize;
-		nbd->disk->queue->limits.discard_alignment = blksize;
 		blk_queue_max_discard_sectors(nbd->disk->queue, UINT_MAX);
 	}
 	blk_queue_logical_block_size(nbd->disk->queue, blksize);
@@ -1316,7 +1315,6 @@ static void nbd_config_put(struct nbd_device *nbd)
 
 		nbd->tag_set.timeout = 0;
 		nbd->disk->queue->limits.discard_granularity = 0;
-		nbd->disk->queue->limits.discard_alignment = 0;
 		blk_queue_max_discard_sectors(nbd->disk->queue, 0);
 
 		mutex_unlock(&nbd->config_lock);
@@ -1781,7 +1779,6 @@ static struct nbd_device *nbd_dev_add(int index, unsigned int refs)
 	blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
 	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, disk->queue);
 	disk->queue->limits.discard_granularity = 0;
-	disk->queue->limits.discard_alignment = 0;
 	blk_queue_max_discard_sectors(disk->queue, 0);
 	blk_queue_max_segment_size(disk->queue, UINT_MAX);
 	blk_queue_max_segments(disk->queue, USHRT_MAX);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 02/11] nbd: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, linux-nvme, virtualization,
	Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang, linux-s390,
	Richard Weinberger, xen-devel, linux-um, Mike Snitzer,
	Josef Bacik, nbd, linux-block, Stefan Haberland, linux-raid,
	Martin K. Petersen, Johannes Berg, Roger Pau Monné

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by nbd is mostly harmless
but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/nbd.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 4729aef8c6462..102597a4277b9 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -333,7 +333,6 @@ static int nbd_set_size(struct nbd_device *nbd, loff_t bytesize,
 
 	if (nbd->config->flags & NBD_FLAG_SEND_TRIM) {
 		nbd->disk->queue->limits.discard_granularity = blksize;
-		nbd->disk->queue->limits.discard_alignment = blksize;
 		blk_queue_max_discard_sectors(nbd->disk->queue, UINT_MAX);
 	}
 	blk_queue_logical_block_size(nbd->disk->queue, blksize);
@@ -1316,7 +1315,6 @@ static void nbd_config_put(struct nbd_device *nbd)
 
 		nbd->tag_set.timeout = 0;
 		nbd->disk->queue->limits.discard_granularity = 0;
-		nbd->disk->queue->limits.discard_alignment = 0;
 		blk_queue_max_discard_sectors(nbd->disk->queue, 0);
 
 		mutex_unlock(&nbd->config_lock);
@@ -1781,7 +1779,6 @@ static struct nbd_device *nbd_dev_add(int index, unsigned int refs)
 	blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
 	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, disk->queue);
 	disk->queue->limits.discard_granularity = 0;
-	disk->queue->limits.discard_alignment = 0;
 	blk_queue_max_discard_sectors(disk->queue, 0);
 	blk_queue_max_segment_size(disk->queue, UINT_MAX);
 	blk_queue_max_segments(disk->queue, USHRT_MAX);
-- 
2.30.2

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [dm-devel] [PATCH 02/11] nbd: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by nbd is mostly harmless
but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/nbd.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 4729aef8c6462..102597a4277b9 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -333,7 +333,6 @@ static int nbd_set_size(struct nbd_device *nbd, loff_t bytesize,
 
 	if (nbd->config->flags & NBD_FLAG_SEND_TRIM) {
 		nbd->disk->queue->limits.discard_granularity = blksize;
-		nbd->disk->queue->limits.discard_alignment = blksize;
 		blk_queue_max_discard_sectors(nbd->disk->queue, UINT_MAX);
 	}
 	blk_queue_logical_block_size(nbd->disk->queue, blksize);
@@ -1316,7 +1315,6 @@ static void nbd_config_put(struct nbd_device *nbd)
 
 		nbd->tag_set.timeout = 0;
 		nbd->disk->queue->limits.discard_granularity = 0;
-		nbd->disk->queue->limits.discard_alignment = 0;
 		blk_queue_max_discard_sectors(nbd->disk->queue, 0);
 
 		mutex_unlock(&nbd->config_lock);
@@ -1781,7 +1779,6 @@ static struct nbd_device *nbd_dev_add(int index, unsigned int refs)
 	blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
 	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, disk->queue);
 	disk->queue->limits.discard_granularity = 0;
-	disk->queue->limits.discard_alignment = 0;
 	blk_queue_max_discard_sectors(disk->queue, 0);
 	blk_queue_max_segment_size(disk->queue, UINT_MAX);
 	blk_queue_max_segments(disk->queue, USHRT_MAX);
-- 
2.30.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 02/11] nbd: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by nbd is mostly harmless
but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/nbd.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 4729aef8c6462..102597a4277b9 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -333,7 +333,6 @@ static int nbd_set_size(struct nbd_device *nbd, loff_t bytesize,
 
 	if (nbd->config->flags & NBD_FLAG_SEND_TRIM) {
 		nbd->disk->queue->limits.discard_granularity = blksize;
-		nbd->disk->queue->limits.discard_alignment = blksize;
 		blk_queue_max_discard_sectors(nbd->disk->queue, UINT_MAX);
 	}
 	blk_queue_logical_block_size(nbd->disk->queue, blksize);
@@ -1316,7 +1315,6 @@ static void nbd_config_put(struct nbd_device *nbd)
 
 		nbd->tag_set.timeout = 0;
 		nbd->disk->queue->limits.discard_granularity = 0;
-		nbd->disk->queue->limits.discard_alignment = 0;
 		blk_queue_max_discard_sectors(nbd->disk->queue, 0);
 
 		mutex_unlock(&nbd->config_lock);
@@ -1781,7 +1779,6 @@ static struct nbd_device *nbd_dev_add(int index, unsigned int refs)
 	blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
 	blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, disk->queue);
 	disk->queue->limits.discard_granularity = 0;
-	disk->queue->limits.discard_alignment = 0;
 	blk_queue_max_discard_sectors(disk->queue, 0);
 	blk_queue_max_segment_size(disk->queue, UINT_MAX);
 	blk_queue_max_segments(disk->queue, USHRT_MAX);
-- 
2.30.2


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 03/11] null_blk: don't set the discard_alignment queue limit
  2022-04-18  4:53 ` Christoph Hellwig
  (?)
  (?)
@ 2022-04-18  4:53   ` Christoph Hellwig
  -1 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by null_blk is mostly
harmless but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/null_blk/main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 5cb4c92cdffea..a521e914a9843 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -1765,7 +1765,6 @@ static void null_config_discard(struct nullb *nullb)
 	}
 
 	nullb->q->limits.discard_granularity = nullb->dev->blocksize;
-	nullb->q->limits.discard_alignment = nullb->dev->blocksize;
 	blk_queue_max_discard_sectors(nullb->q, UINT_MAX >> 9);
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 03/11] null_blk: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, linux-nvme, virtualization,
	Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang, linux-s390,
	Richard Weinberger, xen-devel, linux-um, Mike Snitzer,
	Josef Bacik, nbd, linux-block, Stefan Haberland, linux-raid,
	Martin K. Petersen, Johannes Berg, Roger Pau Monné

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by null_blk is mostly
harmless but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/null_blk/main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 5cb4c92cdffea..a521e914a9843 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -1765,7 +1765,6 @@ static void null_config_discard(struct nullb *nullb)
 	}
 
 	nullb->q->limits.discard_granularity = nullb->dev->blocksize;
-	nullb->q->limits.discard_alignment = nullb->dev->blocksize;
 	blk_queue_max_discard_sectors(nullb->q, UINT_MAX >> 9);
 }
 
-- 
2.30.2

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [dm-devel] [PATCH 03/11] null_blk: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by null_blk is mostly
harmless but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/null_blk/main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 5cb4c92cdffea..a521e914a9843 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -1765,7 +1765,6 @@ static void null_config_discard(struct nullb *nullb)
 	}
 
 	nullb->q->limits.discard_granularity = nullb->dev->blocksize;
-	nullb->q->limits.discard_alignment = nullb->dev->blocksize;
 	blk_queue_max_discard_sectors(nullb->q, UINT_MAX >> 9);
 }
 
-- 
2.30.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 03/11] null_blk: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by null_blk is mostly
harmless but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/null_blk/main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 5cb4c92cdffea..a521e914a9843 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -1765,7 +1765,6 @@ static void null_config_discard(struct nullb *nullb)
 	}
 
 	nullb->q->limits.discard_granularity = nullb->dev->blocksize;
-	nullb->q->limits.discard_alignment = nullb->dev->blocksize;
 	blk_queue_max_discard_sectors(nullb->q, UINT_MAX >> 9);
 }
 
-- 
2.30.2


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 04/11] virtio_blk: fix the discard_granularity and discard_alignment queue limits
  2022-04-18  4:53 ` Christoph Hellwig
  (?)
  (?)
@ 2022-04-18  4:53   ` Christoph Hellwig
  -1 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.

On the other hand the discard_sector_alignment from the virtio 1.1 looks
similar to what Linux uses as discard granularity (even if not very well
described):

  "discard_sector_alignment can be used by OS when splitting a request
   based on alignment. "

And at least qemu does set it to the discard granularity.

So stop setting the discard_alignment and use the virtio
discard_sector_alignment to set the discard granularity.

Fixes: 1f23816b8eb8 ("virtio_blk: add discard and write zeroes support")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/virtio_blk.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 6ccf15253dee1..d624cc8eddc3c 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -867,11 +867,12 @@ static int virtblk_probe(struct virtio_device *vdev)
 		blk_queue_io_opt(q, blk_size * opt_io_size);
 
 	if (virtio_has_feature(vdev, VIRTIO_BLK_F_DISCARD)) {
-		q->limits.discard_granularity = blk_size;
-
 		virtio_cread(vdev, struct virtio_blk_config,
 			     discard_sector_alignment, &v);
-		q->limits.discard_alignment = v ? v << SECTOR_SHIFT : 0;
+		if (v)
+			q->limits.discard_granularity = v << SECTOR_SHIFT;
+		else
+			q->limits.discard_granularity = blk_size;
 
 		virtio_cread(vdev, struct virtio_blk_config,
 			     max_discard_sectors, &v);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 04/11] virtio_blk: fix the discard_granularity and discard_alignment queue limits
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, linux-nvme, virtualization,
	Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang, linux-s390,
	Richard Weinberger, xen-devel, linux-um, Mike Snitzer,
	Josef Bacik, nbd, linux-block, Stefan Haberland, linux-raid,
	Martin K. Petersen, Johannes Berg, Roger Pau Monné

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.

On the other hand the discard_sector_alignment from the virtio 1.1 looks
similar to what Linux uses as discard granularity (even if not very well
described):

  "discard_sector_alignment can be used by OS when splitting a request
   based on alignment. "

And at least qemu does set it to the discard granularity.

So stop setting the discard_alignment and use the virtio
discard_sector_alignment to set the discard granularity.

Fixes: 1f23816b8eb8 ("virtio_blk: add discard and write zeroes support")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/virtio_blk.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 6ccf15253dee1..d624cc8eddc3c 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -867,11 +867,12 @@ static int virtblk_probe(struct virtio_device *vdev)
 		blk_queue_io_opt(q, blk_size * opt_io_size);
 
 	if (virtio_has_feature(vdev, VIRTIO_BLK_F_DISCARD)) {
-		q->limits.discard_granularity = blk_size;
-
 		virtio_cread(vdev, struct virtio_blk_config,
 			     discard_sector_alignment, &v);
-		q->limits.discard_alignment = v ? v << SECTOR_SHIFT : 0;
+		if (v)
+			q->limits.discard_granularity = v << SECTOR_SHIFT;
+		else
+			q->limits.discard_granularity = blk_size;
 
 		virtio_cread(vdev, struct virtio_blk_config,
 			     max_discard_sectors, &v);
-- 
2.30.2

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [dm-devel] [PATCH 04/11] virtio_blk: fix the discard_granularity and discard_alignment queue limits
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.

On the other hand the discard_sector_alignment from the virtio 1.1 looks
similar to what Linux uses as discard granularity (even if not very well
described):

  "discard_sector_alignment can be used by OS when splitting a request
   based on alignment. "

And at least qemu does set it to the discard granularity.

So stop setting the discard_alignment and use the virtio
discard_sector_alignment to set the discard granularity.

Fixes: 1f23816b8eb8 ("virtio_blk: add discard and write zeroes support")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/virtio_blk.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 6ccf15253dee1..d624cc8eddc3c 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -867,11 +867,12 @@ static int virtblk_probe(struct virtio_device *vdev)
 		blk_queue_io_opt(q, blk_size * opt_io_size);
 
 	if (virtio_has_feature(vdev, VIRTIO_BLK_F_DISCARD)) {
-		q->limits.discard_granularity = blk_size;
-
 		virtio_cread(vdev, struct virtio_blk_config,
 			     discard_sector_alignment, &v);
-		q->limits.discard_alignment = v ? v << SECTOR_SHIFT : 0;
+		if (v)
+			q->limits.discard_granularity = v << SECTOR_SHIFT;
+		else
+			q->limits.discard_granularity = blk_size;
 
 		virtio_cread(vdev, struct virtio_blk_config,
 			     max_discard_sectors, &v);
-- 
2.30.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 04/11] virtio_blk: fix the discard_granularity and discard_alignment queue limits
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.

On the other hand the discard_sector_alignment from the virtio 1.1 looks
similar to what Linux uses as discard granularity (even if not very well
described):

  "discard_sector_alignment can be used by OS when splitting a request
   based on alignment. "

And at least qemu does set it to the discard granularity.

So stop setting the discard_alignment and use the virtio
discard_sector_alignment to set the discard granularity.

Fixes: 1f23816b8eb8 ("virtio_blk: add discard and write zeroes support")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/virtio_blk.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 6ccf15253dee1..d624cc8eddc3c 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -867,11 +867,12 @@ static int virtblk_probe(struct virtio_device *vdev)
 		blk_queue_io_opt(q, blk_size * opt_io_size);
 
 	if (virtio_has_feature(vdev, VIRTIO_BLK_F_DISCARD)) {
-		q->limits.discard_granularity = blk_size;
-
 		virtio_cread(vdev, struct virtio_blk_config,
 			     discard_sector_alignment, &v);
-		q->limits.discard_alignment = v ? v << SECTOR_SHIFT : 0;
+		if (v)
+			q->limits.discard_granularity = v << SECTOR_SHIFT;
+		else
+			q->limits.discard_granularity = blk_size;
 
 		virtio_cread(vdev, struct virtio_blk_config,
 			     max_discard_sectors, &v);
-- 
2.30.2


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 05/11] dm-zoned: don't set the discard_alignment queue limit
  2022-04-18  4:53 ` Christoph Hellwig
  (?)
  (?)
@ 2022-04-18  4:53   ` Christoph Hellwig
  -1 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by dm-zoned is mostly
harmless but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/dm-zoned-target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
index cac295cc8840e..0ec5d8b9b1a4e 100644
--- a/drivers/md/dm-zoned-target.c
+++ b/drivers/md/dm-zoned-target.c
@@ -1001,7 +1001,7 @@ static void dmz_io_hints(struct dm_target *ti, struct queue_limits *limits)
 	blk_limits_io_min(limits, DMZ_BLOCK_SIZE);
 	blk_limits_io_opt(limits, DMZ_BLOCK_SIZE);
 
-	limits->discard_alignment = DMZ_BLOCK_SIZE;
+	limits->discard_alignment = 0;
 	limits->discard_granularity = DMZ_BLOCK_SIZE;
 	limits->max_discard_sectors = chunk_sectors;
 	limits->max_hw_discard_sectors = chunk_sectors;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 05/11] dm-zoned: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, linux-nvme, virtualization,
	Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang, linux-s390,
	Richard Weinberger, xen-devel, linux-um, Mike Snitzer,
	Josef Bacik, nbd, linux-block, Stefan Haberland, linux-raid,
	Martin K. Petersen, Johannes Berg, Roger Pau Monné

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by dm-zoned is mostly
harmless but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/dm-zoned-target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
index cac295cc8840e..0ec5d8b9b1a4e 100644
--- a/drivers/md/dm-zoned-target.c
+++ b/drivers/md/dm-zoned-target.c
@@ -1001,7 +1001,7 @@ static void dmz_io_hints(struct dm_target *ti, struct queue_limits *limits)
 	blk_limits_io_min(limits, DMZ_BLOCK_SIZE);
 	blk_limits_io_opt(limits, DMZ_BLOCK_SIZE);
 
-	limits->discard_alignment = DMZ_BLOCK_SIZE;
+	limits->discard_alignment = 0;
 	limits->discard_granularity = DMZ_BLOCK_SIZE;
 	limits->max_discard_sectors = chunk_sectors;
 	limits->max_hw_discard_sectors = chunk_sectors;
-- 
2.30.2

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [dm-devel] [PATCH 05/11] dm-zoned: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by dm-zoned is mostly
harmless but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/dm-zoned-target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
index cac295cc8840e..0ec5d8b9b1a4e 100644
--- a/drivers/md/dm-zoned-target.c
+++ b/drivers/md/dm-zoned-target.c
@@ -1001,7 +1001,7 @@ static void dmz_io_hints(struct dm_target *ti, struct queue_limits *limits)
 	blk_limits_io_min(limits, DMZ_BLOCK_SIZE);
 	blk_limits_io_opt(limits, DMZ_BLOCK_SIZE);
 
-	limits->discard_alignment = DMZ_BLOCK_SIZE;
+	limits->discard_alignment = 0;
 	limits->discard_granularity = DMZ_BLOCK_SIZE;
 	limits->max_discard_sectors = chunk_sectors;
 	limits->max_hw_discard_sectors = chunk_sectors;
-- 
2.30.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 05/11] dm-zoned: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by dm-zoned is mostly
harmless but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/dm-zoned-target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
index cac295cc8840e..0ec5d8b9b1a4e 100644
--- a/drivers/md/dm-zoned-target.c
+++ b/drivers/md/dm-zoned-target.c
@@ -1001,7 +1001,7 @@ static void dmz_io_hints(struct dm_target *ti, struct queue_limits *limits)
 	blk_limits_io_min(limits, DMZ_BLOCK_SIZE);
 	blk_limits_io_opt(limits, DMZ_BLOCK_SIZE);
 
-	limits->discard_alignment = DMZ_BLOCK_SIZE;
+	limits->discard_alignment = 0;
 	limits->discard_granularity = DMZ_BLOCK_SIZE;
 	limits->max_discard_sectors = chunk_sectors;
 	limits->max_hw_discard_sectors = chunk_sectors;
-- 
2.30.2


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 06/11] raid5: don't set the discard_alignment queue limit
  2022-04-18  4:53 ` Christoph Hellwig
  (?)
  (?)
@ 2022-04-18  4:53   ` Christoph Hellwig
  -1 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by raid5 is mostly
harmless but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/raid5.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 59f91e392a2ae..39b0afdf40d0a 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -7749,7 +7749,6 @@ static int raid5_run(struct mddev *mddev)
 		 */
 		stripe = stripe * PAGE_SIZE;
 		stripe = roundup_pow_of_two(stripe);
-		mddev->queue->limits.discard_alignment = stripe;
 		mddev->queue->limits.discard_granularity = stripe;
 
 		blk_queue_max_write_zeroes_sectors(mddev->queue, 0);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 06/11] raid5: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, linux-nvme, virtualization,
	Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang, linux-s390,
	Richard Weinberger, xen-devel, linux-um, Mike Snitzer,
	Josef Bacik, nbd, linux-block, Stefan Haberland, linux-raid,
	Martin K. Petersen, Johannes Berg, Roger Pau Monné

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by raid5 is mostly
harmless but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/raid5.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 59f91e392a2ae..39b0afdf40d0a 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -7749,7 +7749,6 @@ static int raid5_run(struct mddev *mddev)
 		 */
 		stripe = stripe * PAGE_SIZE;
 		stripe = roundup_pow_of_two(stripe);
-		mddev->queue->limits.discard_alignment = stripe;
 		mddev->queue->limits.discard_granularity = stripe;
 
 		blk_queue_max_write_zeroes_sectors(mddev->queue, 0);
-- 
2.30.2

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [dm-devel] [PATCH 06/11] raid5: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by raid5 is mostly
harmless but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/raid5.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 59f91e392a2ae..39b0afdf40d0a 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -7749,7 +7749,6 @@ static int raid5_run(struct mddev *mddev)
 		 */
 		stripe = stripe * PAGE_SIZE;
 		stripe = roundup_pow_of_two(stripe);
-		mddev->queue->limits.discard_alignment = stripe;
 		mddev->queue->limits.discard_granularity = stripe;
 
 		blk_queue_max_write_zeroes_sectors(mddev->queue, 0);
-- 
2.30.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 06/11] raid5: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to the discard granularity as done by raid5 is mostly
harmless but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/raid5.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 59f91e392a2ae..39b0afdf40d0a 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -7749,7 +7749,6 @@ static int raid5_run(struct mddev *mddev)
 		 */
 		stripe = stripe * PAGE_SIZE;
 		stripe = roundup_pow_of_two(stripe);
-		mddev->queue->limits.discard_alignment = stripe;
 		mddev->queue->limits.discard_granularity = stripe;
 
 		blk_queue_max_write_zeroes_sectors(mddev->queue, 0);
-- 
2.30.2


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 07/11] dasd: don't set the discard_alignment queue limit
  2022-04-18  4:53 ` Christoph Hellwig
  (?)
  (?)
@ 2022-04-18  4:53   ` Christoph Hellwig
  -1 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to PAGE_SIZE while the discard granularity is the block size
that is smaller or the same as PAGE_SIZE as done by dasd is mostly
harmless but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/s390/block/dasd_fba.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
index 8bd5665db9198..60be7f7bf2d16 100644
--- a/drivers/s390/block/dasd_fba.c
+++ b/drivers/s390/block/dasd_fba.c
@@ -782,7 +782,6 @@ static void dasd_fba_setup_blk_queue(struct dasd_block *block)
 	blk_queue_segment_boundary(q, PAGE_SIZE - 1);
 
 	q->limits.discard_granularity = logical_block_size;
-	q->limits.discard_alignment = PAGE_SIZE;
 
 	/* Calculate max_discard_sectors and make it PAGE aligned */
 	max_bytes = USHRT_MAX * logical_block_size;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 07/11] dasd: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, linux-nvme, virtualization,
	Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang, linux-s390,
	Richard Weinberger, xen-devel, linux-um, Mike Snitzer,
	Josef Bacik, nbd, linux-block, Stefan Haberland, linux-raid,
	Martin K. Petersen, Johannes Berg, Roger Pau Monné

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to PAGE_SIZE while the discard granularity is the block size
that is smaller or the same as PAGE_SIZE as done by dasd is mostly
harmless but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/s390/block/dasd_fba.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
index 8bd5665db9198..60be7f7bf2d16 100644
--- a/drivers/s390/block/dasd_fba.c
+++ b/drivers/s390/block/dasd_fba.c
@@ -782,7 +782,6 @@ static void dasd_fba_setup_blk_queue(struct dasd_block *block)
 	blk_queue_segment_boundary(q, PAGE_SIZE - 1);
 
 	q->limits.discard_granularity = logical_block_size;
-	q->limits.discard_alignment = PAGE_SIZE;
 
 	/* Calculate max_discard_sectors and make it PAGE aligned */
 	max_bytes = USHRT_MAX * logical_block_size;
-- 
2.30.2

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [dm-devel] [PATCH 07/11] dasd: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to PAGE_SIZE while the discard granularity is the block size
that is smaller or the same as PAGE_SIZE as done by dasd is mostly
harmless but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/s390/block/dasd_fba.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
index 8bd5665db9198..60be7f7bf2d16 100644
--- a/drivers/s390/block/dasd_fba.c
+++ b/drivers/s390/block/dasd_fba.c
@@ -782,7 +782,6 @@ static void dasd_fba_setup_blk_queue(struct dasd_block *block)
 	blk_queue_segment_boundary(q, PAGE_SIZE - 1);
 
 	q->limits.discard_granularity = logical_block_size;
-	q->limits.discard_alignment = PAGE_SIZE;
 
 	/* Calculate max_discard_sectors and make it PAGE aligned */
 	max_bytes = USHRT_MAX * logical_block_size;
-- 
2.30.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 07/11] dasd: don't set the discard_alignment queue limit
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The discard_alignment queue limit is named a bit misleading means the
offset into the block device at which the discard granularity starts.
Setting it to PAGE_SIZE while the discard granularity is the block size
that is smaller or the same as PAGE_SIZE as done by dasd is mostly
harmless but also useless.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/s390/block/dasd_fba.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
index 8bd5665db9198..60be7f7bf2d16 100644
--- a/drivers/s390/block/dasd_fba.c
+++ b/drivers/s390/block/dasd_fba.c
@@ -782,7 +782,6 @@ static void dasd_fba_setup_blk_queue(struct dasd_block *block)
 	blk_queue_segment_boundary(q, PAGE_SIZE - 1);
 
 	q->limits.discard_granularity = logical_block_size;
-	q->limits.discard_alignment = PAGE_SIZE;
 
 	/* Calculate max_discard_sectors and make it PAGE aligned */
 	max_bytes = USHRT_MAX * logical_block_size;
-- 
2.30.2


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 08/11] loop: remove a spurious clear of discard_alignment
  2022-04-18  4:53 ` Christoph Hellwig
  (?)
  (?)
@ 2022-04-18  4:53   ` Christoph Hellwig
  -1 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The loop driver never sets a discard_alignment, so it also doens't need
to clear it to zero.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/loop.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 976cf987b3920..61b642b966a08 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -789,7 +789,6 @@ static void loop_config_discard(struct loop_device *lo)
 		blk_queue_max_discard_sectors(q, 0);
 		blk_queue_max_write_zeroes_sectors(q, 0);
 	}
-	q->limits.discard_alignment = 0;
 }
 
 struct loop_worker {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 08/11] loop: remove a spurious clear of discard_alignment
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, linux-nvme, virtualization,
	Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang, linux-s390,
	Richard Weinberger, xen-devel, linux-um, Mike Snitzer,
	Josef Bacik, nbd, linux-block, Stefan Haberland, linux-raid,
	Martin K. Petersen, Johannes Berg, Roger Pau Monné

The loop driver never sets a discard_alignment, so it also doens't need
to clear it to zero.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/loop.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 976cf987b3920..61b642b966a08 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -789,7 +789,6 @@ static void loop_config_discard(struct loop_device *lo)
 		blk_queue_max_discard_sectors(q, 0);
 		blk_queue_max_write_zeroes_sectors(q, 0);
 	}
-	q->limits.discard_alignment = 0;
 }
 
 struct loop_worker {
-- 
2.30.2

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [dm-devel] [PATCH 08/11] loop: remove a spurious clear of discard_alignment
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

The loop driver never sets a discard_alignment, so it also doens't need
to clear it to zero.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/loop.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 976cf987b3920..61b642b966a08 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -789,7 +789,6 @@ static void loop_config_discard(struct loop_device *lo)
 		blk_queue_max_discard_sectors(q, 0);
 		blk_queue_max_write_zeroes_sectors(q, 0);
 	}
-	q->limits.discard_alignment = 0;
 }
 
 struct loop_worker {
-- 
2.30.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 08/11] loop: remove a spurious clear of discard_alignment
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The loop driver never sets a discard_alignment, so it also doens't need
to clear it to zero.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/loop.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 976cf987b3920..61b642b966a08 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -789,7 +789,6 @@ static void loop_config_discard(struct loop_device *lo)
 		blk_queue_max_discard_sectors(q, 0);
 		blk_queue_max_write_zeroes_sectors(q, 0);
 	}
-	q->limits.discard_alignment = 0;
 }
 
 struct loop_worker {
-- 
2.30.2


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 09/11] nvme: remove a spurious clear of discard_alignment
  2022-04-18  4:53 ` Christoph Hellwig
  (?)
  (?)
@ 2022-04-18  4:53   ` Christoph Hellwig
  -1 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The nvme driver never sets a discard_alignment, so it also doens't need
to clear it to zero.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index b9b0fbde97c80..76a9ccd5d064a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1628,7 +1628,6 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)
 	BUILD_BUG_ON(PAGE_SIZE / sizeof(struct nvme_dsm_range) <
 			NVME_DSM_MAX_RANGES);
 
-	queue->limits.discard_alignment = 0;
 	queue->limits.discard_granularity = size;
 
 	/* If discard is already enabled, don't reset queue limits */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 09/11] nvme: remove a spurious clear of discard_alignment
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, linux-nvme, virtualization,
	Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang, linux-s390,
	Richard Weinberger, xen-devel, linux-um, Mike Snitzer,
	Josef Bacik, nbd, linux-block, Stefan Haberland, linux-raid,
	Martin K. Petersen, Johannes Berg, Roger Pau Monné

The nvme driver never sets a discard_alignment, so it also doens't need
to clear it to zero.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index b9b0fbde97c80..76a9ccd5d064a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1628,7 +1628,6 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)
 	BUILD_BUG_ON(PAGE_SIZE / sizeof(struct nvme_dsm_range) <
 			NVME_DSM_MAX_RANGES);
 
-	queue->limits.discard_alignment = 0;
 	queue->limits.discard_granularity = size;
 
 	/* If discard is already enabled, don't reset queue limits */
-- 
2.30.2

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [dm-devel] [PATCH 09/11] nvme: remove a spurious clear of discard_alignment
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

The nvme driver never sets a discard_alignment, so it also doens't need
to clear it to zero.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index b9b0fbde97c80..76a9ccd5d064a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1628,7 +1628,6 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)
 	BUILD_BUG_ON(PAGE_SIZE / sizeof(struct nvme_dsm_range) <
 			NVME_DSM_MAX_RANGES);
 
-	queue->limits.discard_alignment = 0;
 	queue->limits.discard_granularity = size;
 
 	/* If discard is already enabled, don't reset queue limits */
-- 
2.30.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 09/11] nvme: remove a spurious clear of discard_alignment
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

The nvme driver never sets a discard_alignment, so it also doens't need
to clear it to zero.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index b9b0fbde97c80..76a9ccd5d064a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1628,7 +1628,6 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)
 	BUILD_BUG_ON(PAGE_SIZE / sizeof(struct nvme_dsm_range) <
 			NVME_DSM_MAX_RANGES);
 
-	queue->limits.discard_alignment = 0;
 	queue->limits.discard_granularity = size;
 
 	/* If discard is already enabled, don't reset queue limits */
-- 
2.30.2


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 10/11] rnbd-srv: use bdev_discard_alignment
  2022-04-18  4:53 ` Christoph Hellwig
  (?)
  (?)
@ 2022-04-18  4:53   ` Christoph Hellwig
  -1 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, linux-nvme, virtualization,
	Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang, linux-s390,
	Richard Weinberger, xen-devel, linux-um, Mike Snitzer,
	Josef Bacik, nbd, linux-block, Stefan Haberland, linux-raid,
	Martin K. Petersen, Johannes Berg, Roger Pau Monné

Use bdev_discard_alignment to calculate the correct discard alignment
offset even for partitions instead of just looking at the queue limit.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/rnbd/rnbd-srv-dev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/rnbd/rnbd-srv-dev.h b/drivers/block/rnbd/rnbd-srv-dev.h
index d080a0de59225..4309e52524691 100644
--- a/drivers/block/rnbd/rnbd-srv-dev.h
+++ b/drivers/block/rnbd/rnbd-srv-dev.h
@@ -59,7 +59,7 @@ static inline int rnbd_dev_get_discard_granularity(const struct rnbd_dev *dev)
 
 static inline int rnbd_dev_get_discard_alignment(const struct rnbd_dev *dev)
 {
-	return bdev_get_queue(dev->bdev)->limits.discard_alignment;
+	return bdev_discard_alignment(dev->bdev);
 }
 
 #endif /* RNBD_SRV_DEV_H */
-- 
2.30.2

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 10/11] rnbd-srv: use bdev_discard_alignment
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

Use bdev_discard_alignment to calculate the correct discard alignment
offset even for partitions instead of just looking at the queue limit.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/rnbd/rnbd-srv-dev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/rnbd/rnbd-srv-dev.h b/drivers/block/rnbd/rnbd-srv-dev.h
index d080a0de59225..4309e52524691 100644
--- a/drivers/block/rnbd/rnbd-srv-dev.h
+++ b/drivers/block/rnbd/rnbd-srv-dev.h
@@ -59,7 +59,7 @@ static inline int rnbd_dev_get_discard_granularity(const struct rnbd_dev *dev)
 
 static inline int rnbd_dev_get_discard_alignment(const struct rnbd_dev *dev)
 {
-	return bdev_get_queue(dev->bdev)->limits.discard_alignment;
+	return bdev_discard_alignment(dev->bdev);
 }
 
 #endif /* RNBD_SRV_DEV_H */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [dm-devel] [PATCH 10/11] rnbd-srv: use bdev_discard_alignment
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

Use bdev_discard_alignment to calculate the correct discard alignment
offset even for partitions instead of just looking at the queue limit.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/rnbd/rnbd-srv-dev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/rnbd/rnbd-srv-dev.h b/drivers/block/rnbd/rnbd-srv-dev.h
index d080a0de59225..4309e52524691 100644
--- a/drivers/block/rnbd/rnbd-srv-dev.h
+++ b/drivers/block/rnbd/rnbd-srv-dev.h
@@ -59,7 +59,7 @@ static inline int rnbd_dev_get_discard_granularity(const struct rnbd_dev *dev)
 
 static inline int rnbd_dev_get_discard_alignment(const struct rnbd_dev *dev)
 {
-	return bdev_get_queue(dev->bdev)->limits.discard_alignment;
+	return bdev_discard_alignment(dev->bdev);
 }
 
 #endif /* RNBD_SRV_DEV_H */
-- 
2.30.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 10/11] rnbd-srv: use bdev_discard_alignment
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

Use bdev_discard_alignment to calculate the correct discard alignment
offset even for partitions instead of just looking at the queue limit.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/rnbd/rnbd-srv-dev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/rnbd/rnbd-srv-dev.h b/drivers/block/rnbd/rnbd-srv-dev.h
index d080a0de59225..4309e52524691 100644
--- a/drivers/block/rnbd/rnbd-srv-dev.h
+++ b/drivers/block/rnbd/rnbd-srv-dev.h
@@ -59,7 +59,7 @@ static inline int rnbd_dev_get_discard_granularity(const struct rnbd_dev *dev)
 
 static inline int rnbd_dev_get_discard_alignment(const struct rnbd_dev *dev)
 {
-	return bdev_get_queue(dev->bdev)->limits.discard_alignment;
+	return bdev_discard_alignment(dev->bdev);
 }
 
 #endif /* RNBD_SRV_DEV_H */
-- 
2.30.2


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 11/11] xen-blkback: use bdev_discard_alignment
  2022-04-18  4:53 ` Christoph Hellwig
  (?)
  (?)
@ 2022-04-18  4:53   ` Christoph Hellwig
  -1 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, linux-nvme, virtualization,
	Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang, linux-s390,
	Richard Weinberger, xen-devel, linux-um, Mike Snitzer,
	Josef Bacik, nbd, linux-block, Stefan Haberland, linux-raid,
	Martin K. Petersen, Johannes Berg, Roger Pau Monné

Use bdev_discard_alignment to calculate the correct discard alignment
offset even for partitions instead of just looking at the queue limit.

Also switch to use bdev_discard_granularity to get rid of the last direct
queue reference in xen_blkbk_discard.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/xen-blkback/xenbus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index b21bffc9c50bc..04c90cb8955f6 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -583,14 +583,14 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info
 	if (bdev_max_discard_sectors(bdev)) {
 		err = xenbus_printf(xbt, dev->nodename,
 			"discard-granularity", "%u",
-			q->limits.discard_granularity);
+			bdev_discard_granularity(bdev));
 		if (err) {
 			dev_warn(&dev->dev, "writing discard-granularity (%d)", err);
 			return;
 		}
 		err = xenbus_printf(xbt, dev->nodename,
 			"discard-alignment", "%u",
-			q->limits.discard_alignment);
+			bdev_discard_alignment(bdev));
 		if (err) {
 			dev_warn(&dev->dev, "writing discard-alignment (%d)", err);
 			return;
-- 
2.30.2

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 11/11] xen-blkback: use bdev_discard_alignment
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

Use bdev_discard_alignment to calculate the correct discard alignment
offset even for partitions instead of just looking at the queue limit.

Also switch to use bdev_discard_granularity to get rid of the last direct
queue reference in xen_blkbk_discard.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/xen-blkback/xenbus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index b21bffc9c50bc..04c90cb8955f6 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -583,14 +583,14 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info
 	if (bdev_max_discard_sectors(bdev)) {
 		err = xenbus_printf(xbt, dev->nodename,
 			"discard-granularity", "%u",
-			q->limits.discard_granularity);
+			bdev_discard_granularity(bdev));
 		if (err) {
 			dev_warn(&dev->dev, "writing discard-granularity (%d)", err);
 			return;
 		}
 		err = xenbus_printf(xbt, dev->nodename,
 			"discard-alignment", "%u",
-			q->limits.discard_alignment);
+			bdev_discard_alignment(bdev));
 		if (err) {
 			dev_warn(&dev->dev, "writing discard-alignment (%d)", err);
 			return;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [dm-devel] [PATCH 11/11] xen-blkback: use bdev_discard_alignment
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

Use bdev_discard_alignment to calculate the correct discard alignment
offset even for partitions instead of just looking at the queue limit.

Also switch to use bdev_discard_granularity to get rid of the last direct
queue reference in xen_blkbk_discard.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/xen-blkback/xenbus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index b21bffc9c50bc..04c90cb8955f6 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -583,14 +583,14 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info
 	if (bdev_max_discard_sectors(bdev)) {
 		err = xenbus_printf(xbt, dev->nodename,
 			"discard-granularity", "%u",
-			q->limits.discard_granularity);
+			bdev_discard_granularity(bdev));
 		if (err) {
 			dev_warn(&dev->dev, "writing discard-granularity (%d)", err);
 			return;
 		}
 		err = xenbus_printf(xbt, dev->nodename,
 			"discard-alignment", "%u",
-			q->limits.discard_alignment);
+			bdev_discard_alignment(bdev));
 		if (err) {
 			dev_warn(&dev->dev, "writing discard-alignment (%d)", err);
 			return;
-- 
2.30.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [PATCH 11/11] xen-blkback: use bdev_discard_alignment
@ 2022-04-18  4:53   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-04-18  4:53 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

Use bdev_discard_alignment to calculate the correct discard alignment
offset even for partitions instead of just looking at the queue limit.

Also switch to use bdev_discard_granularity to get rid of the last direct
queue reference in xen_blkbk_discard.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/xen-blkback/xenbus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index b21bffc9c50bc..04c90cb8955f6 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -583,14 +583,14 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info
 	if (bdev_max_discard_sectors(bdev)) {
 		err = xenbus_printf(xbt, dev->nodename,
 			"discard-granularity", "%u",
-			q->limits.discard_granularity);
+			bdev_discard_granularity(bdev));
 		if (err) {
 			dev_warn(&dev->dev, "writing discard-granularity (%d)", err);
 			return;
 		}
 		err = xenbus_printf(xbt, dev->nodename,
 			"discard-alignment", "%u",
-			q->limits.discard_alignment);
+			bdev_discard_alignment(bdev));
 		if (err) {
 			dev_warn(&dev->dev, "writing discard-alignment (%d)", err);
 			return;
-- 
2.30.2


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 05/11] dm-zoned: don't set the discard_alignment queue limit
  2022-04-18  4:53   ` Christoph Hellwig
  (?)
@ 2022-04-18  8:00     ` Damien Le Moal
  -1 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:00 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> The discard_alignment queue limit is named a bit misleading means the
> offset into the block device at which the discard granularity starts.
> Setting it to the discard granularity as done by dm-zoned is mostly
> harmless but also useless.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/md/dm-zoned-target.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
> index cac295cc8840e..0ec5d8b9b1a4e 100644
> --- a/drivers/md/dm-zoned-target.c
> +++ b/drivers/md/dm-zoned-target.c
> @@ -1001,7 +1001,7 @@ static void dmz_io_hints(struct dm_target *ti, struct queue_limits *limits)
>  	blk_limits_io_min(limits, DMZ_BLOCK_SIZE);
>  	blk_limits_io_opt(limits, DMZ_BLOCK_SIZE);
>  
> -	limits->discard_alignment = DMZ_BLOCK_SIZE;
> +	limits->discard_alignment = 0;
>  	limits->discard_granularity = DMZ_BLOCK_SIZE;
>  	limits->max_discard_sectors = chunk_sectors;
>  	limits->max_hw_discard_sectors = chunk_sectors
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 05/11] dm-zoned: don't set the discard_alignment queue limit
@ 2022-04-18  8:00     ` Damien Le Moal
  0 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:00 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, Mike Snitzer,
	linux-um, Josef Bacik, nbd, linux-raid, Stefan Haberland,
	linux-block, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> The discard_alignment queue limit is named a bit misleading means the
> offset into the block device at which the discard granularity starts.
> Setting it to the discard granularity as done by dm-zoned is mostly
> harmless but also useless.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/md/dm-zoned-target.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
> index cac295cc8840e..0ec5d8b9b1a4e 100644
> --- a/drivers/md/dm-zoned-target.c
> +++ b/drivers/md/dm-zoned-target.c
> @@ -1001,7 +1001,7 @@ static void dmz_io_hints(struct dm_target *ti, struct queue_limits *limits)
>  	blk_limits_io_min(limits, DMZ_BLOCK_SIZE);
>  	blk_limits_io_opt(limits, DMZ_BLOCK_SIZE);
>  
> -	limits->discard_alignment = DMZ_BLOCK_SIZE;
> +	limits->discard_alignment = 0;
>  	limits->discard_granularity = DMZ_BLOCK_SIZE;
>  	limits->max_discard_sectors = chunk_sectors;
>  	limits->max_hw_discard_sectors = chunk_sectors
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 05/11] dm-zoned: don't set the discard_alignment queue limit
@ 2022-04-18  8:00     ` Damien Le Moal
  0 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:00 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> The discard_alignment queue limit is named a bit misleading means the
> offset into the block device at which the discard granularity starts.
> Setting it to the discard granularity as done by dm-zoned is mostly
> harmless but also useless.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/md/dm-zoned-target.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
> index cac295cc8840e..0ec5d8b9b1a4e 100644
> --- a/drivers/md/dm-zoned-target.c
> +++ b/drivers/md/dm-zoned-target.c
> @@ -1001,7 +1001,7 @@ static void dmz_io_hints(struct dm_target *ti, struct queue_limits *limits)
>  	blk_limits_io_min(limits, DMZ_BLOCK_SIZE);
>  	blk_limits_io_opt(limits, DMZ_BLOCK_SIZE);
>  
> -	limits->discard_alignment = DMZ_BLOCK_SIZE;
> +	limits->discard_alignment = 0;
>  	limits->discard_granularity = DMZ_BLOCK_SIZE;
>  	limits->max_discard_sectors = chunk_sectors;
>  	limits->max_hw_discard_sectors = chunk_sectors
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 03/11] null_blk: don't set the discard_alignment queue limit
  2022-04-18  4:53   ` Christoph Hellwig
  (?)
@ 2022-04-18  8:01     ` Damien Le Moal
  -1 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:01 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> The discard_alignment queue limit is named a bit misleading means the
> offset into the block device at which the discard granularity starts.
> Setting it to the discard granularity as done by null_blk is mostly
> harmless but also useless.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/block/null_blk/main.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
> index 5cb4c92cdffea..a521e914a9843 100644
> --- a/drivers/block/null_blk/main.c
> +++ b/drivers/block/null_blk/main.c
> @@ -1765,7 +1765,6 @@ static void null_config_discard(struct nullb *nullb)
>  	}
>  
>  	nullb->q->limits.discard_granularity = nullb->dev->blocksize;
> -	nullb->q->limits.discard_alignment = nullb->dev->blocksize;
>  	blk_queue_max_discard_sectors(nullb->q, UINT_MAX >> 9);
>  }
>  

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 03/11] null_blk: don't set the discard_alignment queue limit
@ 2022-04-18  8:01     ` Damien Le Moal
  0 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:01 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, Mike Snitzer,
	linux-um, Josef Bacik, nbd, linux-raid, Stefan Haberland,
	linux-block, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> The discard_alignment queue limit is named a bit misleading means the
> offset into the block device at which the discard granularity starts.
> Setting it to the discard granularity as done by null_blk is mostly
> harmless but also useless.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/block/null_blk/main.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
> index 5cb4c92cdffea..a521e914a9843 100644
> --- a/drivers/block/null_blk/main.c
> +++ b/drivers/block/null_blk/main.c
> @@ -1765,7 +1765,6 @@ static void null_config_discard(struct nullb *nullb)
>  	}
>  
>  	nullb->q->limits.discard_granularity = nullb->dev->blocksize;
> -	nullb->q->limits.discard_alignment = nullb->dev->blocksize;
>  	blk_queue_max_discard_sectors(nullb->q, UINT_MAX >> 9);
>  }
>  

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 03/11] null_blk: don't set the discard_alignment queue limit
@ 2022-04-18  8:01     ` Damien Le Moal
  0 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:01 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> The discard_alignment queue limit is named a bit misleading means the
> offset into the block device at which the discard granularity starts.
> Setting it to the discard granularity as done by null_blk is mostly
> harmless but also useless.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/block/null_blk/main.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
> index 5cb4c92cdffea..a521e914a9843 100644
> --- a/drivers/block/null_blk/main.c
> +++ b/drivers/block/null_blk/main.c
> @@ -1765,7 +1765,6 @@ static void null_config_discard(struct nullb *nullb)
>  	}
>  
>  	nullb->q->limits.discard_granularity = nullb->dev->blocksize;
> -	nullb->q->limits.discard_alignment = nullb->dev->blocksize;
>  	blk_queue_max_discard_sectors(nullb->q, UINT_MAX >> 9);
>  }
>  

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 09/11] nvme: remove a spurious clear of discard_alignment
  2022-04-18  4:53   ` Christoph Hellwig
  (?)
@ 2022-04-18  8:02     ` Damien Le Moal
  -1 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:02 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> The nvme driver never sets a discard_alignment, so it also doens't need
> to clear it to zero.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/nvme/host/core.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index b9b0fbde97c80..76a9ccd5d064a 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -1628,7 +1628,6 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)
>  	BUILD_BUG_ON(PAGE_SIZE / sizeof(struct nvme_dsm_range) <
>  			NVME_DSM_MAX_RANGES);
>  
> -	queue->limits.discard_alignment = 0;
>  	queue->limits.discard_granularity = size;
>  
>  	/* If discard is already enabled, don't reset queue limits */

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 09/11] nvme: remove a spurious clear of discard_alignment
@ 2022-04-18  8:02     ` Damien Le Moal
  0 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:02 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, Mike Snitzer,
	linux-um, Josef Bacik, nbd, linux-raid, Stefan Haberland,
	linux-block, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> The nvme driver never sets a discard_alignment, so it also doens't need
> to clear it to zero.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/nvme/host/core.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index b9b0fbde97c80..76a9ccd5d064a 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -1628,7 +1628,6 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)
>  	BUILD_BUG_ON(PAGE_SIZE / sizeof(struct nvme_dsm_range) <
>  			NVME_DSM_MAX_RANGES);
>  
> -	queue->limits.discard_alignment = 0;
>  	queue->limits.discard_granularity = size;
>  
>  	/* If discard is already enabled, don't reset queue limits */

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 09/11] nvme: remove a spurious clear of discard_alignment
@ 2022-04-18  8:02     ` Damien Le Moal
  0 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:02 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> The nvme driver never sets a discard_alignment, so it also doens't need
> to clear it to zero.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/nvme/host/core.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index b9b0fbde97c80..76a9ccd5d064a 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -1628,7 +1628,6 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)
>  	BUILD_BUG_ON(PAGE_SIZE / sizeof(struct nvme_dsm_range) <
>  			NVME_DSM_MAX_RANGES);
>  
> -	queue->limits.discard_alignment = 0;
>  	queue->limits.discard_granularity = size;
>  
>  	/* If discard is already enabled, don't reset queue limits */

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 10/11] rnbd-srv: use bdev_discard_alignment
  2022-04-18  4:53   ` Christoph Hellwig
  (?)
@ 2022-04-18  8:02     ` Damien Le Moal
  -1 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:02 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> Use bdev_discard_alignment to calculate the correct discard alignment
> offset even for partitions instead of just looking at the queue limit.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/block/rnbd/rnbd-srv-dev.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/rnbd/rnbd-srv-dev.h b/drivers/block/rnbd/rnbd-srv-dev.h
> index d080a0de59225..4309e52524691 100644
> --- a/drivers/block/rnbd/rnbd-srv-dev.h
> +++ b/drivers/block/rnbd/rnbd-srv-dev.h
> @@ -59,7 +59,7 @@ static inline int rnbd_dev_get_discard_granularity(const struct rnbd_dev *dev)
>  
>  static inline int rnbd_dev_get_discard_alignment(const struct rnbd_dev *dev)
>  {
> -	return bdev_get_queue(dev->bdev)->limits.discard_alignment;
> +	return bdev_discard_alignment(dev->bdev);
>  }
>  
>  #endif /* RNBD_SRV_DEV_H */

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 10/11] rnbd-srv: use bdev_discard_alignment
@ 2022-04-18  8:02     ` Damien Le Moal
  0 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:02 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, Mike Snitzer,
	linux-um, Josef Bacik, nbd, linux-raid, Stefan Haberland,
	linux-block, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> Use bdev_discard_alignment to calculate the correct discard alignment
> offset even for partitions instead of just looking at the queue limit.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/block/rnbd/rnbd-srv-dev.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/rnbd/rnbd-srv-dev.h b/drivers/block/rnbd/rnbd-srv-dev.h
> index d080a0de59225..4309e52524691 100644
> --- a/drivers/block/rnbd/rnbd-srv-dev.h
> +++ b/drivers/block/rnbd/rnbd-srv-dev.h
> @@ -59,7 +59,7 @@ static inline int rnbd_dev_get_discard_granularity(const struct rnbd_dev *dev)
>  
>  static inline int rnbd_dev_get_discard_alignment(const struct rnbd_dev *dev)
>  {
> -	return bdev_get_queue(dev->bdev)->limits.discard_alignment;
> +	return bdev_discard_alignment(dev->bdev);
>  }
>  
>  #endif /* RNBD_SRV_DEV_H */

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 10/11] rnbd-srv: use bdev_discard_alignment
@ 2022-04-18  8:02     ` Damien Le Moal
  0 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:02 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> Use bdev_discard_alignment to calculate the correct discard alignment
> offset even for partitions instead of just looking at the queue limit.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/block/rnbd/rnbd-srv-dev.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/rnbd/rnbd-srv-dev.h b/drivers/block/rnbd/rnbd-srv-dev.h
> index d080a0de59225..4309e52524691 100644
> --- a/drivers/block/rnbd/rnbd-srv-dev.h
> +++ b/drivers/block/rnbd/rnbd-srv-dev.h
> @@ -59,7 +59,7 @@ static inline int rnbd_dev_get_discard_granularity(const struct rnbd_dev *dev)
>  
>  static inline int rnbd_dev_get_discard_alignment(const struct rnbd_dev *dev)
>  {
> -	return bdev_get_queue(dev->bdev)->limits.discard_alignment;
> +	return bdev_discard_alignment(dev->bdev);
>  }
>  
>  #endif /* RNBD_SRV_DEV_H */

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 11/11] xen-blkback: use bdev_discard_alignment
  2022-04-18  4:53   ` Christoph Hellwig
  (?)
@ 2022-04-18  8:03     ` Damien Le Moal
  -1 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:03 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> Use bdev_discard_alignment to calculate the correct discard alignment
> offset even for partitions instead of just looking at the queue limit.
> 
> Also switch to use bdev_discard_granularity to get rid of the last direct
> queue reference in xen_blkbk_discard.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/block/xen-blkback/xenbus.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
> index b21bffc9c50bc..04c90cb8955f6 100644
> --- a/drivers/block/xen-blkback/xenbus.c
> +++ b/drivers/block/xen-blkback/xenbus.c
> @@ -583,14 +583,14 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info
>  	if (bdev_max_discard_sectors(bdev)) {
>  		err = xenbus_printf(xbt, dev->nodename,
>  			"discard-granularity", "%u",
> -			q->limits.discard_granularity);
> +			bdev_discard_granularity(bdev));
>  		if (err) {
>  			dev_warn(&dev->dev, "writing discard-granularity (%d)", err);
>  			return;
>  		}
>  		err = xenbus_printf(xbt, dev->nodename,
>  			"discard-alignment", "%u",
> -			q->limits.discard_alignment);
> +			bdev_discard_alignment(bdev));
>  		if (err) {
>  			dev_warn(&dev->dev, "writing discard-alignment (%d)", err);
>  			return;

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 11/11] xen-blkback: use bdev_discard_alignment
@ 2022-04-18  8:03     ` Damien Le Moal
  0 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:03 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, Mike Snitzer,
	linux-um, Josef Bacik, nbd, linux-raid, Stefan Haberland,
	linux-block, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> Use bdev_discard_alignment to calculate the correct discard alignment
> offset even for partitions instead of just looking at the queue limit.
> 
> Also switch to use bdev_discard_granularity to get rid of the last direct
> queue reference in xen_blkbk_discard.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/block/xen-blkback/xenbus.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
> index b21bffc9c50bc..04c90cb8955f6 100644
> --- a/drivers/block/xen-blkback/xenbus.c
> +++ b/drivers/block/xen-blkback/xenbus.c
> @@ -583,14 +583,14 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info
>  	if (bdev_max_discard_sectors(bdev)) {
>  		err = xenbus_printf(xbt, dev->nodename,
>  			"discard-granularity", "%u",
> -			q->limits.discard_granularity);
> +			bdev_discard_granularity(bdev));
>  		if (err) {
>  			dev_warn(&dev->dev, "writing discard-granularity (%d)", err);
>  			return;
>  		}
>  		err = xenbus_printf(xbt, dev->nodename,
>  			"discard-alignment", "%u",
> -			q->limits.discard_alignment);
> +			bdev_discard_alignment(bdev));
>  		if (err) {
>  			dev_warn(&dev->dev, "writing discard-alignment (%d)", err);
>  			return;

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 11/11] xen-blkback: use bdev_discard_alignment
@ 2022-04-18  8:03     ` Damien Le Moal
  0 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:03 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> Use bdev_discard_alignment to calculate the correct discard alignment
> offset even for partitions instead of just looking at the queue limit.
> 
> Also switch to use bdev_discard_granularity to get rid of the last direct
> queue reference in xen_blkbk_discard.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/block/xen-blkback/xenbus.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
> index b21bffc9c50bc..04c90cb8955f6 100644
> --- a/drivers/block/xen-blkback/xenbus.c
> +++ b/drivers/block/xen-blkback/xenbus.c
> @@ -583,14 +583,14 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info
>  	if (bdev_max_discard_sectors(bdev)) {
>  		err = xenbus_printf(xbt, dev->nodename,
>  			"discard-granularity", "%u",
> -			q->limits.discard_granularity);
> +			bdev_discard_granularity(bdev));
>  		if (err) {
>  			dev_warn(&dev->dev, "writing discard-granularity (%d)", err);
>  			return;
>  		}
>  		err = xenbus_printf(xbt, dev->nodename,
>  			"discard-alignment", "%u",
> -			q->limits.discard_alignment);
> +			bdev_discard_alignment(bdev));
>  		if (err) {
>  			dev_warn(&dev->dev, "writing discard-alignment (%d)", err);
>  			return;

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 08/11] loop: remove a spurious clear of discard_alignment
  2022-04-18  4:53   ` Christoph Hellwig
  (?)
@ 2022-04-18  8:04     ` Damien Le Moal
  -1 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:04 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> The loop driver never sets a discard_alignment, so it also doens't need
> to clear it to zero.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/block/loop.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index 976cf987b3920..61b642b966a08 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -789,7 +789,6 @@ static void loop_config_discard(struct loop_device *lo)
>  		blk_queue_max_discard_sectors(q, 0);
>  		blk_queue_max_write_zeroes_sectors(q, 0);
>  	}
> -	q->limits.discard_alignment = 0;
>  }
>  
>  struct loop_worker {

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 08/11] loop: remove a spurious clear of discard_alignment
@ 2022-04-18  8:04     ` Damien Le Moal
  0 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:04 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, Mike Snitzer,
	linux-um, Josef Bacik, nbd, linux-raid, Stefan Haberland,
	linux-block, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> The loop driver never sets a discard_alignment, so it also doens't need
> to clear it to zero.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/block/loop.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index 976cf987b3920..61b642b966a08 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -789,7 +789,6 @@ static void loop_config_discard(struct loop_device *lo)
>  		blk_queue_max_discard_sectors(q, 0);
>  		blk_queue_max_write_zeroes_sectors(q, 0);
>  	}
> -	q->limits.discard_alignment = 0;
>  }
>  
>  struct loop_worker {

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 08/11] loop: remove a spurious clear of discard_alignment
@ 2022-04-18  8:04     ` Damien Le Moal
  0 siblings, 0 replies; 99+ messages in thread
From: Damien Le Moal @ 2022-04-18  8:04 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/18/22 13:53, Christoph Hellwig wrote:
> The loop driver never sets a discard_alignment, so it also doens't need
> to clear it to zero.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/block/loop.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index 976cf987b3920..61b642b966a08 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -789,7 +789,6 @@ static void loop_config_discard(struct loop_device *lo)
>  		blk_queue_max_discard_sectors(q, 0);
>  		blk_queue_max_write_zeroes_sectors(q, 0);
>  	}
> -	q->limits.discard_alignment = 0;
>  }
>  
>  struct loop_worker {

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

-- 
Damien Le Moal
Western Digital Research

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [PATCH 08/11] loop: remove a spurious clear of discard_alignment
  2022-04-18  4:53   ` Christoph Hellwig
  (?)
@ 2022-04-18 21:21     ` Chaitanya Kulkarni
  -1 siblings, 0 replies; 99+ messages in thread
From: Chaitanya Kulkarni @ 2022-04-18 21:21 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

On 4/17/22 21:53, Christoph Hellwig wrote:
> The loop driver never sets a discard_alignment, so it also doens't need

s/doens't/doesn't/

> to clear it to zero.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 08/11] loop: remove a spurious clear of discard_alignment
@ 2022-04-18 21:21     ` Chaitanya Kulkarni
  0 siblings, 0 replies; 99+ messages in thread
From: Chaitanya Kulkarni @ 2022-04-18 21:21 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/17/22 21:53, Christoph Hellwig wrote:
> The loop driver never sets a discard_alignment, so it also doens't need

s/doens't/doesn't/

> to clear it to zero.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [PATCH 08/11] loop: remove a spurious clear of discard_alignment
@ 2022-04-18 21:21     ` Chaitanya Kulkarni
  0 siblings, 0 replies; 99+ messages in thread
From: Chaitanya Kulkarni @ 2022-04-18 21:21 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik,
	Md. Haris Iqbal  <haris.iqbal@ionos.com>,
	Jack Wang <jinpu.wang@ionos.com>,
	 Michael S. Tsirkin  <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner

On 4/17/22 21:53, Christoph Hellwig wrote:
> The loop driver never sets a discard_alignment, so it also doens't need

s/doens't/doesn't/

> to clear it to zero.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [PATCH 03/11] null_blk: don't set the discard_alignment queue limit
  2022-04-18  4:53   ` Christoph Hellwig
  (?)
@ 2022-04-18 21:22     ` Chaitanya Kulkarni
  -1 siblings, 0 replies; 99+ messages in thread
From: Chaitanya Kulkarni @ 2022-04-18 21:22 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

On 4/17/22 21:53, Christoph Hellwig wrote:
> The discard_alignment queue limit is named a bit misleading means the
> offset into the block device at which the discard granularity starts.
> Setting it to the discard granularity as done by null_blk is mostly
> harmless but also useless.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck




^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 03/11] null_blk: don't set the discard_alignment queue limit
@ 2022-04-18 21:22     ` Chaitanya Kulkarni
  0 siblings, 0 replies; 99+ messages in thread
From: Chaitanya Kulkarni @ 2022-04-18 21:22 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/17/22 21:53, Christoph Hellwig wrote:
> The discard_alignment queue limit is named a bit misleading means the
> offset into the block device at which the discard granularity starts.
> Setting it to the discard granularity as done by null_blk is mostly
> harmless but also useless.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [PATCH 03/11] null_blk: don't set the discard_alignment queue limit
@ 2022-04-18 21:22     ` Chaitanya Kulkarni
  0 siblings, 0 replies; 99+ messages in thread
From: Chaitanya Kulkarni @ 2022-04-18 21:22 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik,
	Md. Haris Iqbal  <haris.iqbal@ionos.com>,
	Jack Wang <jinpu.wang@ionos.com>,
	 Michael S. Tsirkin  <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner

On 4/17/22 21:53, Christoph Hellwig wrote:
> The discard_alignment queue limit is named a bit misleading means the
> offset into the block device at which the discard granularity starts.
> Setting it to the discard granularity as done by null_blk is mostly
> harmless but also useless.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [PATCH 09/11] nvme: remove a spurious clear of discard_alignment
  2022-04-18  4:53   ` Christoph Hellwig
  (?)
@ 2022-04-18 21:23     ` Chaitanya Kulkarni
  -1 siblings, 0 replies; 99+ messages in thread
From: Chaitanya Kulkarni @ 2022-04-18 21:23 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

On 4/17/22 21:53, Christoph Hellwig wrote:
> The nvme driver never sets a discard_alignment, so it also doens't need
> to clear it to zero.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 09/11] nvme: remove a spurious clear of discard_alignment
@ 2022-04-18 21:23     ` Chaitanya Kulkarni
  0 siblings, 0 replies; 99+ messages in thread
From: Chaitanya Kulkarni @ 2022-04-18 21:23 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On 4/17/22 21:53, Christoph Hellwig wrote:
> The nvme driver never sets a discard_alignment, so it also doens't need
> to clear it to zero.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [PATCH 09/11] nvme: remove a spurious clear of discard_alignment
@ 2022-04-18 21:23     ` Chaitanya Kulkarni
  0 siblings, 0 replies; 99+ messages in thread
From: Chaitanya Kulkarni @ 2022-04-18 21:23 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik,
	Md. Haris Iqbal  <haris.iqbal@ionos.com>,
	Jack Wang <jinpu.wang@ionos.com>,
	 Michael S. Tsirkin  <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner

On 4/17/22 21:53, Christoph Hellwig wrote:
> The nvme driver never sets a discard_alignment, so it also doens't need
> to clear it to zero.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [PATCH 10/11] rnbd-srv: use bdev_discard_alignment
  2022-04-18  4:53   ` Christoph Hellwig
  (?)
@ 2022-04-19  4:51     ` Jinpu Wang
  -1 siblings, 0 replies; 99+ messages in thread
From: Jinpu Wang @ 2022-04-19  4:51 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Richard Weinberger, Johannes Berg, Josef Bacik,
	Md. Haris Iqbal, Michael S. Tsirkin, Jason Wang,
	Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

On Mon, Apr 18, 2022 at 6:53 AM Christoph Hellwig <hch@lst.de> wrote:
>
> Use bdev_discard_alignment to calculate the correct discard alignment
> offset even for partitions instead of just looking at the queue limit.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Thx!
Acked-by: Jack Wang <jinpu.wang@ionos.com>
> ---
>  drivers/block/rnbd/rnbd-srv-dev.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/block/rnbd/rnbd-srv-dev.h b/drivers/block/rnbd/rnbd-srv-dev.h
> index d080a0de59225..4309e52524691 100644
> --- a/drivers/block/rnbd/rnbd-srv-dev.h
> +++ b/drivers/block/rnbd/rnbd-srv-dev.h
> @@ -59,7 +59,7 @@ static inline int rnbd_dev_get_discard_granularity(const struct rnbd_dev *dev)
>
>  static inline int rnbd_dev_get_discard_alignment(const struct rnbd_dev *dev)
>  {
> -       return bdev_get_queue(dev->bdev)->limits.discard_alignment;
> +       return bdev_discard_alignment(dev->bdev);
>  }
>
>  #endif /* RNBD_SRV_DEV_H */
> --
> 2.30.2
>

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 10/11] rnbd-srv: use bdev_discard_alignment
@ 2022-04-19  4:51     ` Jinpu Wang
  0 siblings, 0 replies; 99+ messages in thread
From: Jinpu Wang @ 2022-04-19  4:51 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, linux-s390,
	Richard Weinberger, xen-devel, linux-um, Mike Snitzer,
	Josef Bacik, nbd, linux-block, Stefan Haberland, Jens Axboe,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On Mon, Apr 18, 2022 at 6:53 AM Christoph Hellwig <hch@lst.de> wrote:
>
> Use bdev_discard_alignment to calculate the correct discard alignment
> offset even for partitions instead of just looking at the queue limit.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Thx!
Acked-by: Jack Wang <jinpu.wang@ionos.com>
> ---
>  drivers/block/rnbd/rnbd-srv-dev.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/block/rnbd/rnbd-srv-dev.h b/drivers/block/rnbd/rnbd-srv-dev.h
> index d080a0de59225..4309e52524691 100644
> --- a/drivers/block/rnbd/rnbd-srv-dev.h
> +++ b/drivers/block/rnbd/rnbd-srv-dev.h
> @@ -59,7 +59,7 @@ static inline int rnbd_dev_get_discard_granularity(const struct rnbd_dev *dev)
>
>  static inline int rnbd_dev_get_discard_alignment(const struct rnbd_dev *dev)
>  {
> -       return bdev_get_queue(dev->bdev)->limits.discard_alignment;
> +       return bdev_discard_alignment(dev->bdev);
>  }
>
>  #endif /* RNBD_SRV_DEV_H */
> --
> 2.30.2
>

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [PATCH 10/11] rnbd-srv: use bdev_discard_alignment
@ 2022-04-19  4:51     ` Jinpu Wang
  0 siblings, 0 replies; 99+ messages in thread
From: Jinpu Wang @ 2022-04-19  4:51 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Richard Weinberger, Johannes Berg, Josef Bacik,
	Md. Haris Iqbal, Michael S. Tsirkin, Jason Wang,
	Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

On Mon, Apr 18, 2022 at 6:53 AM Christoph Hellwig <hch@lst.de> wrote:
>
> Use bdev_discard_alignment to calculate the correct discard alignment
> offset even for partitions instead of just looking at the queue limit.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Thx!
Acked-by: Jack Wang <jinpu.wang@ionos.com>
> ---
>  drivers/block/rnbd/rnbd-srv-dev.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/block/rnbd/rnbd-srv-dev.h b/drivers/block/rnbd/rnbd-srv-dev.h
> index d080a0de59225..4309e52524691 100644
> --- a/drivers/block/rnbd/rnbd-srv-dev.h
> +++ b/drivers/block/rnbd/rnbd-srv-dev.h
> @@ -59,7 +59,7 @@ static inline int rnbd_dev_get_discard_granularity(const struct rnbd_dev *dev)
>
>  static inline int rnbd_dev_get_discard_alignment(const struct rnbd_dev *dev)
>  {
> -       return bdev_get_queue(dev->bdev)->limits.discard_alignment;
> +       return bdev_discard_alignment(dev->bdev);
>  }
>
>  #endif /* RNBD_SRV_DEV_H */
> --
> 2.30.2
>

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [PATCH 06/11] raid5: don't set the discard_alignment queue limit
  2022-04-18  4:53   ` Christoph Hellwig
  (?)
@ 2022-04-25 21:08     ` Song Liu
  -1 siblings, 0 replies; 99+ messages in thread
From: Song Liu @ 2022-04-25 21:08 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Richard Weinberger, Johannes Berg, Josef Bacik,
	Md. Haris Iqbal, Jack Wang, Michael S. Tsirkin, Jason Wang,
	Roger Pau Monné,
	Mike Snitzer, Stefan Haberland, Jan Hoeppner, Martin K. Petersen,
	linux-um, linux-block, nbd, virtualization, xen-devel,
	linux-raid, linux-nvme, linux-s390, dm-devel

On Sun, Apr 17, 2022 at 9:53 PM Christoph Hellwig <hch@lst.de> wrote:
>
> The discard_alignment queue limit is named a bit misleading means the
> offset into the block device at which the discard granularity starts.
> Setting it to the discard granularity as done by raid5 is mostly
> harmless but also useless.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Song Liu <song@kernel.org>

> ---
>  drivers/md/raid5.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 59f91e392a2ae..39b0afdf40d0a 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -7749,7 +7749,6 @@ static int raid5_run(struct mddev *mddev)
>                  */
>                 stripe = stripe * PAGE_SIZE;
>                 stripe = roundup_pow_of_two(stripe);
> -               mddev->queue->limits.discard_alignment = stripe;
>                 mddev->queue->limits.discard_granularity = stripe;
>
>                 blk_queue_max_write_zeroes_sectors(mddev->queue, 0);
> --
> 2.30.2
>

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 06/11] raid5: don't set the discard_alignment queue limit
@ 2022-04-25 21:08     ` Song Liu
  0 siblings, 0 replies; 99+ messages in thread
From: Song Liu @ 2022-04-25 21:08 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, dm-devel, Md. Haris Iqbal, Jack Wang, linux-s390,
	Richard Weinberger, xen-devel, linux-um, Mike Snitzer,
	Josef Bacik, nbd, linux-block, Stefan Haberland, Jens Axboe,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

On Sun, Apr 17, 2022 at 9:53 PM Christoph Hellwig <hch@lst.de> wrote:
>
> The discard_alignment queue limit is named a bit misleading means the
> offset into the block device at which the discard granularity starts.
> Setting it to the discard granularity as done by raid5 is mostly
> harmless but also useless.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Song Liu <song@kernel.org>

> ---
>  drivers/md/raid5.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 59f91e392a2ae..39b0afdf40d0a 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -7749,7 +7749,6 @@ static int raid5_run(struct mddev *mddev)
>                  */
>                 stripe = stripe * PAGE_SIZE;
>                 stripe = roundup_pow_of_two(stripe);
> -               mddev->queue->limits.discard_alignment = stripe;
>                 mddev->queue->limits.discard_granularity = stripe;
>
>                 blk_queue_max_write_zeroes_sectors(mddev->queue, 0);
> --
> 2.30.2
>

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [PATCH 06/11] raid5: don't set the discard_alignment queue limit
@ 2022-04-25 21:08     ` Song Liu
  0 siblings, 0 replies; 99+ messages in thread
From: Song Liu @ 2022-04-25 21:08 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Richard Weinberger, Johannes Berg, Josef Bacik,
	Md. Haris Iqbal, Jack Wang, Michael S. Tsirkin, Jason Wang,
	Roger Pau Monné,
	Mike Snitzer, Stefan Haberland, Jan Hoeppner, Martin K. Petersen,
	linux-um, linux-block, nbd, virtualization, xen-devel,
	linux-raid, linux-nvme, linux-s390, dm-devel

On Sun, Apr 17, 2022 at 9:53 PM Christoph Hellwig <hch@lst.de> wrote:
>
> The discard_alignment queue limit is named a bit misleading means the
> offset into the block device at which the discard granularity starts.
> Setting it to the discard granularity as done by raid5 is mostly
> harmless but also useless.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Song Liu <song@kernel.org>

> ---
>  drivers/md/raid5.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 59f91e392a2ae..39b0afdf40d0a 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -7749,7 +7749,6 @@ static int raid5_run(struct mddev *mddev)
>                  */
>                 stripe = stripe * PAGE_SIZE;
>                 stripe = roundup_pow_of_two(stripe);
> -               mddev->queue->limits.discard_alignment = stripe;
>                 mddev->queue->limits.discard_granularity = stripe;
>
>                 blk_queue_max_write_zeroes_sectors(mddev->queue, 0);
> --
> 2.30.2
>

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: fix and cleanup discard_alignment handling
  2022-04-18  4:53 ` Christoph Hellwig
  (?)
  (?)
@ 2022-04-26  4:16   ` Martin K. Petersen
  -1 siblings, 0 replies; 99+ messages in thread
From: Martin K. Petersen @ 2022-04-26  4:16 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Richard Weinberger, Johannes Berg, Josef Bacik,
	Md. Haris Iqbal, Jack Wang, Michael S. Tsirkin, Jason Wang,
	Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel


Christoph,

> the somewhat confusing name of the discard_alignment queue limit, that
> really is an offset for the discard granularity mislead a lot of
> driver authors to set it to an incorrect value.  This series tries to
> fix up all these cases.

Not sure how I ended up with "discard_alignment" when I called the
corresponding I/O parameter "alignment_offset".

Anyway. All this looks good to me.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: fix and cleanup discard_alignment handling
@ 2022-04-26  4:16   ` Martin K. Petersen
  0 siblings, 0 replies; 99+ messages in thread
From: Martin K. Petersen @ 2022-04-26  4:16 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jan Hoeppner, Michael S. Tsirkin, linux-nvme, virtualization,
	Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang, linux-s390,
	Richard Weinberger, xen-devel, linux-um, Mike Snitzer,
	Josef Bacik, nbd, linux-block, Stefan Haberland, Jens Axboe,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné


Christoph,

> the somewhat confusing name of the discard_alignment queue limit, that
> really is an offset for the discard granularity mislead a lot of
> driver authors to set it to an incorrect value.  This series tries to
> fix up all these cases.

Not sure how I ended up with "discard_alignment" when I called the
corresponding I/O parameter "alignment_offset".

Anyway. All this looks good to me.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] fix and cleanup discard_alignment handling
@ 2022-04-26  4:16   ` Martin K. Petersen
  0 siblings, 0 replies; 99+ messages in thread
From: Martin K. Petersen @ 2022-04-26  4:16 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	Jens Axboe, linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné


Christoph,

> the somewhat confusing name of the discard_alignment queue limit, that
> really is an offset for the discard granularity mislead a lot of
> driver authors to set it to an incorrect value.  This series tries to
> fix up all these cases.

Not sure how I ended up with "discard_alignment" when I called the
corresponding I/O parameter "alignment_offset".

Anyway. All this looks good to me.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: fix and cleanup discard_alignment handling
@ 2022-04-26  4:16   ` Martin K. Petersen
  0 siblings, 0 replies; 99+ messages in thread
From: Martin K. Petersen @ 2022-04-26  4:16 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Richard Weinberger, Johannes Berg, Josef Bacik,
	Md. Haris Iqbal, Jack Wang, Michael S. Tsirkin, Jason Wang,
	Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel


Christoph,

> the somewhat confusing name of the discard_alignment queue limit, that
> really is an offset for the discard granularity mislead a lot of
> driver authors to set it to an incorrect value.  This series tries to
> fix up all these cases.

Not sure how I ended up with "discard_alignment" when I called the
corresponding I/O parameter "alignment_offset".

Anyway. All this looks good to me.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [PATCH 09/11] nvme: remove a spurious clear of discard_alignment
  2022-04-18  4:53   ` Christoph Hellwig
  (?)
@ 2022-04-26 14:25     ` Sagi Grimberg
  -1 siblings, 0 replies; 99+ messages in thread
From: Sagi Grimberg @ 2022-04-26 14:25 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 09/11] nvme: remove a spurious clear of discard_alignment
@ 2022-04-26 14:25     ` Sagi Grimberg
  0 siblings, 0 replies; 99+ messages in thread
From: Sagi Grimberg @ 2022-04-26 14:25 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [PATCH 09/11] nvme: remove a spurious clear of discard_alignment
@ 2022-04-26 14:25     ` Sagi Grimberg
  0 siblings, 0 replies; 99+ messages in thread
From: Sagi Grimberg @ 2022-04-26 14:25 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: fix and cleanup discard_alignment handling
  2022-04-18  4:53 ` Christoph Hellwig
  (?)
  (?)
@ 2022-05-02 16:46   ` Christoph Hellwig
  -1 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-05-02 16:46 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

ping?

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: fix and cleanup discard_alignment handling
@ 2022-05-02 16:46   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-05-02 16:46 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, linux-nvme, virtualization,
	Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang, linux-s390,
	Richard Weinberger, xen-devel, linux-um, Mike Snitzer,
	Josef Bacik, nbd, linux-block, Stefan Haberland, linux-raid,
	Martin K. Petersen, Johannes Berg, Roger Pau Monné

ping?
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] fix and cleanup discard_alignment handling
@ 2022-05-02 16:46   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-05-02 16:46 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Jan Hoeppner, Michael S. Tsirkin, Jason Wang, linux-nvme,
	virtualization, Song Liu, dm-devel, Md. Haris Iqbal, Jack Wang,
	linux-s390, Richard Weinberger, xen-devel, linux-um,
	Mike Snitzer, Josef Bacik, nbd, linux-block, Stefan Haberland,
	linux-raid, Martin K. Petersen, Johannes Berg,
	Roger Pau Monné

ping?

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: fix and cleanup discard_alignment handling
@ 2022-05-02 16:46   ` Christoph Hellwig
  0 siblings, 0 replies; 99+ messages in thread
From: Christoph Hellwig @ 2022-05-02 16:46 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Jan Hoeppner,
	Martin K. Petersen, linux-um, linux-block, nbd, virtualization,
	xen-devel, linux-raid, linux-nvme, linux-s390, dm-devel

ping?

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: fix and cleanup discard_alignment handling
  2022-04-18  4:53 ` Christoph Hellwig
  (?)
  (?)
@ 2022-05-03 16:39   ` Jens Axboe
  -1 siblings, 0 replies; 99+ messages in thread
From: Jens Axboe @ 2022-05-03 16:39 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: mst, linux-s390, sth, martin.petersen, dm-devel, hoeppner,
	linux-nvme, richard, josef, virtualization, snitzer, roger.pau,
	linux-um, linux-block, song, nbd, linux-raid, johannes,
	haris.iqbal, xen-devel, jasowang, jinpu.wang

On Mon, 18 Apr 2022 06:53:03 +0200, Christoph Hellwig wrote:
> the somewhat confusing name of the discard_alignment queue limit, that
> really is an offset for the discard granularity mislead a lot of driver
> authors to set it to an incorrect value.  This series tries to fix up
> all these cases.
> 
> Diffstat:
>  arch/um/drivers/ubd_kern.c         |    1 -
>  drivers/block/loop.c               |    1 -
>  drivers/block/nbd.c                |    3 ---
>  drivers/block/null_blk/main.c      |    1 -
>  drivers/block/rnbd/rnbd-srv-dev.h  |    2 +-
>  drivers/block/virtio_blk.c         |    7 ++++---
>  drivers/block/xen-blkback/xenbus.c |    4 ++--
>  drivers/md/dm-zoned-target.c       |    2 +-
>  drivers/md/raid5.c                 |    1 -
>  drivers/nvme/host/core.c           |    1 -
>  drivers/s390/block/dasd_fba.c      |    1 -
>  11 files changed, 8 insertions(+), 16 deletions(-)
> 
> [...]

Applied, thanks!

[01/11] ubd: don't set the discard_alignment queue limit
        commit: 07c6e92a8478770a7302f7dde72f03a5465901bd
[02/11] nbd: don't set the discard_alignment queue limit
        commit: 4a04d517c56e0616c6f69afc226ee2691e543712
[03/11] null_blk: don't set the discard_alignment queue limit
        commit: fb749a87f4536d2fa86ea135ae4eff1072903438
[04/11] virtio_blk: fix the discard_granularity and discard_alignment queue limits
        commit: 62952cc5bccd89b76d710de1d0b43244af0f2903
[05/11] dm-zoned: don't set the discard_alignment queue limit
        commit: 44d583702f4429763c558624fac763650a1f05bf
[06/11] raid5: don't set the discard_alignment queue limit
        commit: 3d50d368c92ade2f98a3d0d28b842a57c35284e9
[07/11] dasd: don't set the discard_alignment queue limit
        commit: c3f765299632727fa5ea5a0acf118665227a4f1a
[08/11] loop: remove a spurious clear of discard_alignment
        commit: 4418bfd8fb9602d9cd8747c3ad52fdbaa02e2ffd
[09/11] nvme: remove a spurious clear of discard_alignment
        commit: 4e7f0ece41e1be8f876f320a0972a715daec0a50
[10/11] rnbd-srv: use bdev_discard_alignment
        commit: 18292faa89d2bff3bdd33ab9c065f45fb6710e47
[11/11] xen-blkback: use bdev_discard_alignment
        commit: c899b23533866910c90ef4386b501af50270d320

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: fix and cleanup discard_alignment handling
@ 2022-05-03 16:39   ` Jens Axboe
  0 siblings, 0 replies; 99+ messages in thread
From: Jens Axboe @ 2022-05-03 16:39 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: hoeppner, mst, linux-nvme, virtualization, song, dm-devel,
	haris.iqbal, jinpu.wang, linux-s390, richard, xen-devel,
	linux-um, snitzer, josef, nbd, linux-raid, sth, linux-block,
	martin.petersen, johannes, roger.pau

On Mon, 18 Apr 2022 06:53:03 +0200, Christoph Hellwig wrote:
> the somewhat confusing name of the discard_alignment queue limit, that
> really is an offset for the discard granularity mislead a lot of driver
> authors to set it to an incorrect value.  This series tries to fix up
> all these cases.
> 
> Diffstat:
>  arch/um/drivers/ubd_kern.c         |    1 -
>  drivers/block/loop.c               |    1 -
>  drivers/block/nbd.c                |    3 ---
>  drivers/block/null_blk/main.c      |    1 -
>  drivers/block/rnbd/rnbd-srv-dev.h  |    2 +-
>  drivers/block/virtio_blk.c         |    7 ++++---
>  drivers/block/xen-blkback/xenbus.c |    4 ++--
>  drivers/md/dm-zoned-target.c       |    2 +-
>  drivers/md/raid5.c                 |    1 -
>  drivers/nvme/host/core.c           |    1 -
>  drivers/s390/block/dasd_fba.c      |    1 -
>  11 files changed, 8 insertions(+), 16 deletions(-)
> 
> [...]

Applied, thanks!

[01/11] ubd: don't set the discard_alignment queue limit
        commit: 07c6e92a8478770a7302f7dde72f03a5465901bd
[02/11] nbd: don't set the discard_alignment queue limit
        commit: 4a04d517c56e0616c6f69afc226ee2691e543712
[03/11] null_blk: don't set the discard_alignment queue limit
        commit: fb749a87f4536d2fa86ea135ae4eff1072903438
[04/11] virtio_blk: fix the discard_granularity and discard_alignment queue limits
        commit: 62952cc5bccd89b76d710de1d0b43244af0f2903
[05/11] dm-zoned: don't set the discard_alignment queue limit
        commit: 44d583702f4429763c558624fac763650a1f05bf
[06/11] raid5: don't set the discard_alignment queue limit
        commit: 3d50d368c92ade2f98a3d0d28b842a57c35284e9
[07/11] dasd: don't set the discard_alignment queue limit
        commit: c3f765299632727fa5ea5a0acf118665227a4f1a
[08/11] loop: remove a spurious clear of discard_alignment
        commit: 4418bfd8fb9602d9cd8747c3ad52fdbaa02e2ffd
[09/11] nvme: remove a spurious clear of discard_alignment
        commit: 4e7f0ece41e1be8f876f320a0972a715daec0a50
[10/11] rnbd-srv: use bdev_discard_alignment
        commit: 18292faa89d2bff3bdd33ab9c065f45fb6710e47
[11/11] xen-blkback: use bdev_discard_alignment
        commit: c899b23533866910c90ef4386b501af50270d320

Best regards,
-- 
Jens Axboe


_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] fix and cleanup discard_alignment handling
@ 2022-05-03 16:39   ` Jens Axboe
  0 siblings, 0 replies; 99+ messages in thread
From: Jens Axboe @ 2022-05-03 16:39 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: hoeppner, mst, jasowang, linux-nvme, virtualization, song,
	dm-devel, haris.iqbal, jinpu.wang, linux-s390, richard,
	xen-devel, linux-um, snitzer, josef, nbd, linux-raid, sth,
	linux-block, martin.petersen, johannes, roger.pau

On Mon, 18 Apr 2022 06:53:03 +0200, Christoph Hellwig wrote:
> the somewhat confusing name of the discard_alignment queue limit, that
> really is an offset for the discard granularity mislead a lot of driver
> authors to set it to an incorrect value.  This series tries to fix up
> all these cases.
> 
> Diffstat:
>  arch/um/drivers/ubd_kern.c         |    1 -
>  drivers/block/loop.c               |    1 -
>  drivers/block/nbd.c                |    3 ---
>  drivers/block/null_blk/main.c      |    1 -
>  drivers/block/rnbd/rnbd-srv-dev.h  |    2 +-
>  drivers/block/virtio_blk.c         |    7 ++++---
>  drivers/block/xen-blkback/xenbus.c |    4 ++--
>  drivers/md/dm-zoned-target.c       |    2 +-
>  drivers/md/raid5.c                 |    1 -
>  drivers/nvme/host/core.c           |    1 -
>  drivers/s390/block/dasd_fba.c      |    1 -
>  11 files changed, 8 insertions(+), 16 deletions(-)
> 
> [...]

Applied, thanks!

[01/11] ubd: don't set the discard_alignment queue limit
        commit: 07c6e92a8478770a7302f7dde72f03a5465901bd
[02/11] nbd: don't set the discard_alignment queue limit
        commit: 4a04d517c56e0616c6f69afc226ee2691e543712
[03/11] null_blk: don't set the discard_alignment queue limit
        commit: fb749a87f4536d2fa86ea135ae4eff1072903438
[04/11] virtio_blk: fix the discard_granularity and discard_alignment queue limits
        commit: 62952cc5bccd89b76d710de1d0b43244af0f2903
[05/11] dm-zoned: don't set the discard_alignment queue limit
        commit: 44d583702f4429763c558624fac763650a1f05bf
[06/11] raid5: don't set the discard_alignment queue limit
        commit: 3d50d368c92ade2f98a3d0d28b842a57c35284e9
[07/11] dasd: don't set the discard_alignment queue limit
        commit: c3f765299632727fa5ea5a0acf118665227a4f1a
[08/11] loop: remove a spurious clear of discard_alignment
        commit: 4418bfd8fb9602d9cd8747c3ad52fdbaa02e2ffd
[09/11] nvme: remove a spurious clear of discard_alignment
        commit: 4e7f0ece41e1be8f876f320a0972a715daec0a50
[10/11] rnbd-srv: use bdev_discard_alignment
        commit: 18292faa89d2bff3bdd33ab9c065f45fb6710e47
[11/11] xen-blkback: use bdev_discard_alignment
        commit: c899b23533866910c90ef4386b501af50270d320

Best regards,
-- 
Jens Axboe


--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: fix and cleanup discard_alignment handling
@ 2022-05-03 16:39   ` Jens Axboe
  0 siblings, 0 replies; 99+ messages in thread
From: Jens Axboe @ 2022-05-03 16:39 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: mst, linux-s390, sth, martin.petersen, dm-devel, hoeppner,
	linux-nvme, richard, josef, virtualization, snitzer, roger.pau,
	linux-um, linux-block, song, nbd, linux-raid, johannes,
	haris.iqbal, xen-devel, jasowang, jinpu.wang

On Mon, 18 Apr 2022 06:53:03 +0200, Christoph Hellwig wrote:
> the somewhat confusing name of the discard_alignment queue limit, that
> really is an offset for the discard granularity mislead a lot of driver
> authors to set it to an incorrect value.  This series tries to fix up
> all these cases.
> 
> Diffstat:
>  arch/um/drivers/ubd_kern.c         |    1 -
>  drivers/block/loop.c               |    1 -
>  drivers/block/nbd.c                |    3 ---
>  drivers/block/null_blk/main.c      |    1 -
>  drivers/block/rnbd/rnbd-srv-dev.h  |    2 +-
>  drivers/block/virtio_blk.c         |    7 ++++---
>  drivers/block/xen-blkback/xenbus.c |    4 ++--
>  drivers/md/dm-zoned-target.c       |    2 +-
>  drivers/md/raid5.c                 |    1 -
>  drivers/nvme/host/core.c           |    1 -
>  drivers/s390/block/dasd_fba.c      |    1 -
>  11 files changed, 8 insertions(+), 16 deletions(-)
> 
> [...]

Applied, thanks!

[01/11] ubd: don't set the discard_alignment queue limit
        commit: 07c6e92a8478770a7302f7dde72f03a5465901bd
[02/11] nbd: don't set the discard_alignment queue limit
        commit: 4a04d517c56e0616c6f69afc226ee2691e543712
[03/11] null_blk: don't set the discard_alignment queue limit
        commit: fb749a87f4536d2fa86ea135ae4eff1072903438
[04/11] virtio_blk: fix the discard_granularity and discard_alignment queue limits
        commit: 62952cc5bccd89b76d710de1d0b43244af0f2903
[05/11] dm-zoned: don't set the discard_alignment queue limit
        commit: 44d583702f4429763c558624fac763650a1f05bf
[06/11] raid5: don't set the discard_alignment queue limit
        commit: 3d50d368c92ade2f98a3d0d28b842a57c35284e9
[07/11] dasd: don't set the discard_alignment queue limit
        commit: c3f765299632727fa5ea5a0acf118665227a4f1a
[08/11] loop: remove a spurious clear of discard_alignment
        commit: 4418bfd8fb9602d9cd8747c3ad52fdbaa02e2ffd
[09/11] nvme: remove a spurious clear of discard_alignment
        commit: 4e7f0ece41e1be8f876f320a0972a715daec0a50
[10/11] rnbd-srv: use bdev_discard_alignment
        commit: 18292faa89d2bff3bdd33ab9c065f45fb6710e47
[11/11] xen-blkback: use bdev_discard_alignment
        commit: c899b23533866910c90ef4386b501af50270d320

Best regards,
-- 
Jens Axboe



_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [PATCH 07/11] dasd: don't set the discard_alignment queue limit
  2022-04-18  4:53   ` Christoph Hellwig
  (?)
@ 2022-05-06 12:56     ` Jan Höppner
  -1 siblings, 0 replies; 99+ messages in thread
From: Jan Höppner @ 2022-05-06 12:56 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Martin K. Petersen,
	linux-um, linux-block, nbd, virtualization, xen-devel,
	linux-raid, linux-nvme, linux-s390, dm-devel

On 18/04/2022 06:53, Christoph Hellwig wrote:
> The discard_alignment queue limit is named a bit misleading means the
> offset into the block device at which the discard granularity starts.
> Setting it to PAGE_SIZE while the discard granularity is the block size
> that is smaller or the same as PAGE_SIZE as done by dasd is mostly
> harmless but also useless.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Jan Höppner <hoeppner@linux.ibm.com>

Sorry for a rather late answer. I saw that Jens already applied
the patches so it's fine when the Ack isn't added anymore.
Wanted to send it anyway so that you know we're aware of it.

> ---
>  drivers/s390/block/dasd_fba.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
> index 8bd5665db9198..60be7f7bf2d16 100644
> --- a/drivers/s390/block/dasd_fba.c
> +++ b/drivers/s390/block/dasd_fba.c
> @@ -782,7 +782,6 @@ static void dasd_fba_setup_blk_queue(struct dasd_block *block)
>  	blk_queue_segment_boundary(q, PAGE_SIZE - 1);
>  
>  	q->limits.discard_granularity = logical_block_size;
> -	q->limits.discard_alignment = PAGE_SIZE;
>  
>  	/* Calculate max_discard_sectors and make it PAGE aligned */
>  	max_bytes = USHRT_MAX * logical_block_size;


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [dm-devel] [PATCH 07/11] dasd: don't set the discard_alignment queue limit
@ 2022-05-06 12:56     ` Jan Höppner
  0 siblings, 0 replies; 99+ messages in thread
From: Jan Höppner @ 2022-05-06 12:56 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: linux-block, linux-s390, linux-raid, Martin K. Petersen,
	Michael S. Tsirkin, Richard Weinberger, Jason Wang, Mike Snitzer,
	Josef Bacik, linux-nvme, nbd, linux-um, Song Liu, dm-devel,
	Md. Haris Iqbal, Stefan Haberland, xen-devel, Johannes Berg,
	virtualization, Jack Wang, Roger Pau Monné

On 18/04/2022 06:53, Christoph Hellwig wrote:
> The discard_alignment queue limit is named a bit misleading means the
> offset into the block device at which the discard granularity starts.
> Setting it to PAGE_SIZE while the discard granularity is the block size
> that is smaller or the same as PAGE_SIZE as done by dasd is mostly
> harmless but also useless.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Jan Höppner <hoeppner@linux.ibm.com>

Sorry for a rather late answer. I saw that Jens already applied
the patches so it's fine when the Ack isn't added anymore.
Wanted to send it anyway so that you know we're aware of it.

> ---
>  drivers/s390/block/dasd_fba.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
> index 8bd5665db9198..60be7f7bf2d16 100644
> --- a/drivers/s390/block/dasd_fba.c
> +++ b/drivers/s390/block/dasd_fba.c
> @@ -782,7 +782,6 @@ static void dasd_fba_setup_blk_queue(struct dasd_block *block)
>  	blk_queue_segment_boundary(q, PAGE_SIZE - 1);
>  
>  	q->limits.discard_granularity = logical_block_size;
> -	q->limits.discard_alignment = PAGE_SIZE;
>  
>  	/* Calculate max_discard_sectors and make it PAGE aligned */
>  	max_bytes = USHRT_MAX * logical_block_size;

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [PATCH 07/11] dasd: don't set the discard_alignment queue limit
@ 2022-05-06 12:56     ` Jan Höppner
  0 siblings, 0 replies; 99+ messages in thread
From: Jan Höppner @ 2022-05-06 12:56 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Richard Weinberger, Johannes Berg, Josef Bacik, Md. Haris Iqbal,
	Jack Wang, Michael S. Tsirkin, Jason Wang, Roger Pau Monné,
	Mike Snitzer, Song Liu, Stefan Haberland, Martin K. Petersen,
	linux-um, linux-block, nbd, virtualization, xen-devel,
	linux-raid, linux-nvme, linux-s390, dm-devel

On 18/04/2022 06:53, Christoph Hellwig wrote:
> The discard_alignment queue limit is named a bit misleading means the
> offset into the block device at which the discard granularity starts.
> Setting it to PAGE_SIZE while the discard granularity is the block size
> that is smaller or the same as PAGE_SIZE as done by dasd is mostly
> harmless but also useless.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Jan Höppner <hoeppner@linux.ibm.com>

Sorry for a rather late answer. I saw that Jens already applied
the patches so it's fine when the Ack isn't added anymore.
Wanted to send it anyway so that you know we're aware of it.

> ---
>  drivers/s390/block/dasd_fba.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
> index 8bd5665db9198..60be7f7bf2d16 100644
> --- a/drivers/s390/block/dasd_fba.c
> +++ b/drivers/s390/block/dasd_fba.c
> @@ -782,7 +782,6 @@ static void dasd_fba_setup_blk_queue(struct dasd_block *block)
>  	blk_queue_segment_boundary(q, PAGE_SIZE - 1);
>  
>  	q->limits.discard_granularity = logical_block_size;
> -	q->limits.discard_alignment = PAGE_SIZE;
>  
>  	/* Calculate max_discard_sectors and make it PAGE aligned */
>  	max_bytes = USHRT_MAX * logical_block_size;


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

^ permalink raw reply	[flat|nested] 99+ messages in thread

end of thread, other threads:[~2022-05-09  7:53 UTC | newest]

Thread overview: 99+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18  4:53 fix and cleanup discard_alignment handling Christoph Hellwig
2022-04-18  4:53 ` Christoph Hellwig
2022-04-18  4:53 ` [dm-devel] " Christoph Hellwig
2022-04-18  4:53 ` Christoph Hellwig
2022-04-18  4:53 ` [PATCH 01/11] ubd: don't set the discard_alignment queue limit Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  4:53   ` [dm-devel] " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  4:53 ` [PATCH 02/11] nbd: " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  4:53   ` [dm-devel] " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  4:53 ` [PATCH 03/11] null_blk: " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  4:53   ` [dm-devel] " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  8:01   ` [dm-devel] " Damien Le Moal
2022-04-18  8:01     ` Damien Le Moal
2022-04-18  8:01     ` Damien Le Moal
2022-04-18 21:22   ` Chaitanya Kulkarni
2022-04-18 21:22     ` Chaitanya Kulkarni
2022-04-18 21:22     ` [dm-devel] " Chaitanya Kulkarni
2022-04-18  4:53 ` [PATCH 04/11] virtio_blk: fix the discard_granularity and discard_alignment queue limits Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  4:53   ` [dm-devel] " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  4:53 ` [PATCH 05/11] dm-zoned: don't set the discard_alignment queue limit Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  4:53   ` [dm-devel] " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  8:00   ` [dm-devel] " Damien Le Moal
2022-04-18  8:00     ` Damien Le Moal
2022-04-18  8:00     ` Damien Le Moal
2022-04-18  4:53 ` [PATCH 06/11] raid5: " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  4:53   ` [dm-devel] " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-25 21:08   ` Song Liu
2022-04-25 21:08     ` Song Liu
2022-04-25 21:08     ` [dm-devel] " Song Liu
2022-04-18  4:53 ` [PATCH 07/11] dasd: " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  4:53   ` [dm-devel] " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-05-06 12:56   ` Jan Höppner
2022-05-06 12:56     ` Jan Höppner
2022-05-06 12:56     ` [dm-devel] " Jan Höppner
2022-04-18  4:53 ` [PATCH 08/11] loop: remove a spurious clear of discard_alignment Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  4:53   ` [dm-devel] " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  8:04   ` [dm-devel] " Damien Le Moal
2022-04-18  8:04     ` Damien Le Moal
2022-04-18  8:04     ` Damien Le Moal
2022-04-18 21:21   ` Chaitanya Kulkarni
2022-04-18 21:21     ` Chaitanya Kulkarni
2022-04-18 21:21     ` [dm-devel] " Chaitanya Kulkarni
2022-04-18  4:53 ` [PATCH 09/11] nvme: " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  4:53   ` [dm-devel] " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  8:02   ` [dm-devel] " Damien Le Moal
2022-04-18  8:02     ` Damien Le Moal
2022-04-18  8:02     ` Damien Le Moal
2022-04-18 21:23   ` Chaitanya Kulkarni
2022-04-18 21:23     ` Chaitanya Kulkarni
2022-04-18 21:23     ` [dm-devel] " Chaitanya Kulkarni
2022-04-26 14:25   ` Sagi Grimberg
2022-04-26 14:25     ` Sagi Grimberg
2022-04-26 14:25     ` [dm-devel] " Sagi Grimberg
2022-04-18  4:53 ` [PATCH 10/11] rnbd-srv: use bdev_discard_alignment Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  4:53   ` [dm-devel] " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  8:02   ` [dm-devel] " Damien Le Moal
2022-04-18  8:02     ` Damien Le Moal
2022-04-18  8:02     ` Damien Le Moal
2022-04-19  4:51   ` Jinpu Wang
2022-04-19  4:51     ` Jinpu Wang
2022-04-19  4:51     ` [dm-devel] " Jinpu Wang
2022-04-18  4:53 ` [PATCH 11/11] xen-blkback: " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  4:53   ` [dm-devel] " Christoph Hellwig
2022-04-18  4:53   ` Christoph Hellwig
2022-04-18  8:03   ` [dm-devel] " Damien Le Moal
2022-04-18  8:03     ` Damien Le Moal
2022-04-18  8:03     ` Damien Le Moal
2022-04-26  4:16 ` fix and cleanup discard_alignment handling Martin K. Petersen
2022-04-26  4:16   ` Martin K. Petersen
2022-04-26  4:16   ` [dm-devel] " Martin K. Petersen
2022-04-26  4:16   ` Martin K. Petersen
2022-05-02 16:46 ` Christoph Hellwig
2022-05-02 16:46   ` Christoph Hellwig
2022-05-02 16:46   ` [dm-devel] " Christoph Hellwig
2022-05-02 16:46   ` Christoph Hellwig
2022-05-03 16:39 ` Jens Axboe
2022-05-03 16:39   ` Jens Axboe
2022-05-03 16:39   ` [dm-devel] " Jens Axboe
2022-05-03 16:39   ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.