All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: remove the "detected capacity change" message
@ 2021-03-17 10:46 ` Mikulas Patocka
  0 siblings, 0 replies; 6+ messages in thread
From: Mikulas Patocka @ 2021-03-17 10:46 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, dm-devel, Zdenek Kabelac, ming.lei

Every time a new device mapper device is created, a message "detected
capacity change from 0 to 2097152" is reported. This message is useless,
so this patch removes it.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 block/genhd.c |    3 ---
 1 file changed, 3 deletions(-)

Index: linux-2.6/block/genhd.c
===================================================================
--- linux-2.6.orig/block/genhd.c	2021-03-17 11:03:52.000000000 +0100
+++ linux-2.6/block/genhd.c	2021-03-17 11:04:27.000000000 +0100
@@ -72,9 +72,6 @@ bool set_capacity_and_notify(struct gend
 	    (disk->flags & (GENHD_FL_UP | GENHD_FL_HIDDEN)) != GENHD_FL_UP)
 		return false;
 
-	pr_info("%s: detected capacity change from %lld to %lld\n",
-		disk->disk_name, capacity, size);
-
 	/*
 	 * Historically we did not send a uevent for changes to/from an empty
 	 * device.


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

* [dm-devel] [PATCH] block: remove the "detected capacity change" message
@ 2021-03-17 10:46 ` Mikulas Patocka
  0 siblings, 0 replies; 6+ messages in thread
From: Mikulas Patocka @ 2021-03-17 10:46 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, dm-devel, ming.lei, Zdenek Kabelac

Every time a new device mapper device is created, a message "detected
capacity change from 0 to 2097152" is reported. This message is useless,
so this patch removes it.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 block/genhd.c |    3 ---
 1 file changed, 3 deletions(-)

Index: linux-2.6/block/genhd.c
===================================================================
--- linux-2.6.orig/block/genhd.c	2021-03-17 11:03:52.000000000 +0100
+++ linux-2.6/block/genhd.c	2021-03-17 11:04:27.000000000 +0100
@@ -72,9 +72,6 @@ bool set_capacity_and_notify(struct gend
 	    (disk->flags & (GENHD_FL_UP | GENHD_FL_HIDDEN)) != GENHD_FL_UP)
 		return false;
 
-	pr_info("%s: detected capacity change from %lld to %lld\n",
-		disk->disk_name, capacity, size);
-
 	/*
 	 * Historically we did not send a uevent for changes to/from an empty
 	 * device.

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


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

* Re: [PATCH] block: remove the "detected capacity change" message
  2021-03-17 10:46 ` [dm-devel] " Mikulas Patocka
@ 2021-03-17 13:47   ` Christoph Hellwig
  -1 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2021-03-17 13:47 UTC (permalink / raw)
  To: Mikulas Patocka
  Cc: Jens Axboe, linux-block, dm-devel, Zdenek Kabelac, ming.lei

No, it is everything but useless.  It is not needed during device
creation, but that is something that the GENHD_FL_UP check should catch.

You should probably audit the device mapper code why it sets the initial
capacity when the gendisk is up already, as that can cause all kinds of
problems.  If the setting of the initial capacity after add_disk is
indeed intentional you can switch to set_capacity(), but you should
probably document the rationale in a detailed comment.

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

* Re: [dm-devel] [PATCH] block: remove the "detected capacity change" message
@ 2021-03-17 13:47   ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2021-03-17 13:47 UTC (permalink / raw)
  To: Mikulas Patocka
  Cc: Jens Axboe, linux-block, dm-devel, ming.lei, Zdenek Kabelac

No, it is everything but useless.  It is not needed during device
creation, but that is something that the GENHD_FL_UP check should catch.

You should probably audit the device mapper code why it sets the initial
capacity when the gendisk is up already, as that can cause all kinds of
problems.  If the setting of the initial capacity after add_disk is
indeed intentional you can switch to set_capacity(), but you should
probably document the rationale in a detailed comment.

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


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

* Re: [PATCH] block: remove the "detected capacity change" message
  2021-03-17 13:47   ` [dm-devel] " Christoph Hellwig
@ 2021-03-17 15:34     ` Mikulas Patocka
  -1 siblings, 0 replies; 6+ messages in thread
From: Mikulas Patocka @ 2021-03-17 15:34 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, linux-block, dm-devel, Zdenek Kabelac, ming.lei



On Wed, 17 Mar 2021, Christoph Hellwig wrote:

> No, it is everything but useless.  It is not needed during device
> creation, but that is something that the GENHD_FL_UP check should catch.
> 
> You should probably audit the device mapper code why it sets the initial
> capacity when the gendisk is up already, as that can cause all kinds of
> problems.  If the setting of the initial capacity after add_disk is
> indeed intentional you can switch to set_capacity(), but you should
> probably document the rationale in a detailed comment.

BTW. the loop device has the same problem as device mapper - it also 
prints "loop0: detected capacity change from 0 to 2097152" when it is 
being activated.

Would you accept this patch?

Or do you think that we should change device mapper and the loopback 
driver to call "set_capacity" on the initial device creation?

Mikulas

---
 block/genhd.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6/block/genhd.c
===================================================================
--- linux-2.6.orig/block/genhd.c	2021-03-17 16:26:11.000000000 +0100
+++ linux-2.6/block/genhd.c	2021-03-17 16:26:42.000000000 +0100
@@ -71,16 +71,16 @@ bool set_capacity_and_notify(struct gend
 	if (size == capacity ||
 	    (disk->flags & (GENHD_FL_UP | GENHD_FL_HIDDEN)) != GENHD_FL_UP)
 		return false;
-
-	pr_info("%s: detected capacity change from %lld to %lld\n",
-		disk->disk_name, capacity, size);
-
 	/*
 	 * Historically we did not send a uevent for changes to/from an empty
 	 * device.
 	 */
 	if (!capacity || !size)
 		return false;
+
+	pr_info("%s: detected capacity change from %lld to %lld\n",
+		disk->disk_name, capacity, size);
+
 	kobject_uevent_env(&disk_to_dev(disk)->kobj, KOBJ_CHANGE, envp);
 	return true;
 }


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

* Re: [dm-devel] [PATCH] block: remove the "detected capacity change" message
@ 2021-03-17 15:34     ` Mikulas Patocka
  0 siblings, 0 replies; 6+ messages in thread
From: Mikulas Patocka @ 2021-03-17 15:34 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, linux-block, dm-devel, ming.lei, Zdenek Kabelac



On Wed, 17 Mar 2021, Christoph Hellwig wrote:

> No, it is everything but useless.  It is not needed during device
> creation, but that is something that the GENHD_FL_UP check should catch.
> 
> You should probably audit the device mapper code why it sets the initial
> capacity when the gendisk is up already, as that can cause all kinds of
> problems.  If the setting of the initial capacity after add_disk is
> indeed intentional you can switch to set_capacity(), but you should
> probably document the rationale in a detailed comment.

BTW. the loop device has the same problem as device mapper - it also 
prints "loop0: detected capacity change from 0 to 2097152" when it is 
being activated.

Would you accept this patch?

Or do you think that we should change device mapper and the loopback 
driver to call "set_capacity" on the initial device creation?

Mikulas

---
 block/genhd.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6/block/genhd.c
===================================================================
--- linux-2.6.orig/block/genhd.c	2021-03-17 16:26:11.000000000 +0100
+++ linux-2.6/block/genhd.c	2021-03-17 16:26:42.000000000 +0100
@@ -71,16 +71,16 @@ bool set_capacity_and_notify(struct gend
 	if (size == capacity ||
 	    (disk->flags & (GENHD_FL_UP | GENHD_FL_HIDDEN)) != GENHD_FL_UP)
 		return false;
-
-	pr_info("%s: detected capacity change from %lld to %lld\n",
-		disk->disk_name, capacity, size);
-
 	/*
 	 * Historically we did not send a uevent for changes to/from an empty
 	 * device.
 	 */
 	if (!capacity || !size)
 		return false;
+
+	pr_info("%s: detected capacity change from %lld to %lld\n",
+		disk->disk_name, capacity, size);
+
 	kobject_uevent_env(&disk_to_dev(disk)->kobj, KOBJ_CHANGE, envp);
 	return true;
 }

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


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

end of thread, other threads:[~2021-03-17 15:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-17 10:46 [PATCH] block: remove the "detected capacity change" message Mikulas Patocka
2021-03-17 10:46 ` [dm-devel] " Mikulas Patocka
2021-03-17 13:47 ` Christoph Hellwig
2021-03-17 13:47   ` [dm-devel] " Christoph Hellwig
2021-03-17 15:34   ` Mikulas Patocka
2021-03-17 15:34     ` [dm-devel] " Mikulas Patocka

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.