diff mbox series

[RFC,1/6] genhd: update docs for GENHD_FL_UP

Message ID 20210715202341.2016612-2-mcgrof@kernel.org (mailing list archive)
State New, archived
Headers show
Series block: enhance use of GENHD_FL_UP | expand

Commit Message

Luis Chamberlain July 15, 2021, 8:23 p.m. UTC
The GENHD_FL_UP is used internally so we can know when we can add and
remove partitions, so just clarify that. Right now it has this 1980's
description comparing it to network drivers "ifconfig up" idea, and
that can easily lead to invalid uses.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 include/linux/genhd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hannes Reinecke July 16, 2021, 5:50 a.m. UTC | #1
On 7/15/21 10:23 PM, Luis Chamberlain wrote:
> The GENHD_FL_UP is used internally so we can know when we can add and
> remove partitions, so just clarify that. Right now it has this 1980's
> description comparing it to network drivers "ifconfig up" idea, and
> that can easily lead to invalid uses.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> ---
>   include/linux/genhd.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/genhd.h b/include/linux/genhd.h
> index 51f27b9b38b5..dc07a957c9e1 100644
> --- a/include/linux/genhd.h
> +++ b/include/linux/genhd.h
> @@ -61,7 +61,7 @@ struct partition_meta_info {
>    * Affects responses to the ``CDROM_GET_CAPABILITY`` ioctl.
>    *
>    * ``GENHD_FL_UP`` (0x0010): indicates that the block device is "up",
> - * with a similar meaning to network interfaces.
> + * and we can add / remove partitions.
>    *
>    * ``GENHD_FL_SUPPRESS_PARTITION_INFO`` (0x0020): don't include
>    * partition information in ``/proc/partitions`` or in the output of
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
Christoph Hellwig July 19, 2021, 9:52 a.m. UTC | #2
On Thu, Jul 15, 2021 at 01:23:36PM -0700, Luis Chamberlain wrote:
> The GENHD_FL_UP is used internally so we can know when we can add and
> remove partitions, so just clarify that. Right now it has this 1980's
> description comparing it to network drivers "ifconfig up" idea, and
> that can easily lead to invalid uses.

GENHD_FL_UP actually is pretty horrible - it uses a value used for
something that should be mostly read only at device runtime for
state an does so badly.  I actually have a patch to kill it, as we can
just check if the inode for the whole device blockdev is hashed instead.
diff mbox series

Patch

diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 51f27b9b38b5..dc07a957c9e1 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -61,7 +61,7 @@  struct partition_meta_info {
  * Affects responses to the ``CDROM_GET_CAPABILITY`` ioctl.
  *
  * ``GENHD_FL_UP`` (0x0010): indicates that the block device is "up",
- * with a similar meaning to network interfaces.
+ * and we can add / remove partitions.
  *
  * ``GENHD_FL_SUPPRESS_PARTITION_INFO`` (0x0020): don't include
  * partition information in ``/proc/partitions`` or in the output of