* extended dev_t tidyups
@ 2021-08-24 7:52 Christoph Hellwig
2021-08-24 7:52 ` [PATCH 1/2] block: remove a pointless call to MINOR() in device_add_disk Christoph Hellwig
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Christoph Hellwig @ 2021-08-24 7:52 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block
Hi Jens,
two small tidyups for the extended dev_t code. One removes
a not necessary maksing of a variable that already contains
the minor number, and the other removes some long obsolete
debugging code.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] block: remove a pointless call to MINOR() in device_add_disk
2021-08-24 7:52 extended dev_t tidyups Christoph Hellwig
@ 2021-08-24 7:52 ` Christoph Hellwig
2021-08-24 7:52 ` [PATCH 2/2] block: remove CONFIG_DEBUG_BLOCK_EXT_DEVT Christoph Hellwig
2021-08-24 12:43 ` extended dev_t tidyups Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2021-08-24 7:52 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block
blk_alloc_ext_minor already returns just a minor number, so no need to
mask the high bits.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/genhd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/genhd.c b/block/genhd.c
index a4817e42f3a3..3ee031c97f22 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -515,7 +515,7 @@ static void __device_add_disk(struct device *parent, struct gendisk *disk,
return;
}
disk->major = BLOCK_EXT_MAJOR;
- disk->first_minor = MINOR(ret);
+ disk->first_minor = ret;
disk->flags |= GENHD_FL_EXT_DEVT;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] block: remove CONFIG_DEBUG_BLOCK_EXT_DEVT
2021-08-24 7:52 extended dev_t tidyups Christoph Hellwig
2021-08-24 7:52 ` [PATCH 1/2] block: remove a pointless call to MINOR() in device_add_disk Christoph Hellwig
@ 2021-08-24 7:52 ` Christoph Hellwig
2021-08-24 12:43 ` extended dev_t tidyups Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2021-08-24 7:52 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block
This might have been a neat debug aid when the extended dev_t was
added, but that time is long gone.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/riscv/configs/defconfig | 1 -
arch/riscv/configs/rv32_defconfig | 1 -
block/genhd.c | 43 +++----------------------------
init/do_mounts.c | 4 ---
lib/Kconfig.debug | 27 -------------------
5 files changed, 4 insertions(+), 72 deletions(-)
diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig
index 1f2be234b11c..bc68231a8fb7 100644
--- a/arch/riscv/configs/defconfig
+++ b/arch/riscv/configs/defconfig
@@ -132,7 +132,6 @@ CONFIG_DEBUG_PLIST=y
CONFIG_DEBUG_SG=y
# CONFIG_RCU_TRACE is not set
CONFIG_RCU_EQS_DEBUG=y
-CONFIG_DEBUG_BLOCK_EXT_DEVT=y
# CONFIG_FTRACE is not set
# CONFIG_RUNTIME_TESTING_MENU is not set
CONFIG_MEMTEST=y
diff --git a/arch/riscv/configs/rv32_defconfig b/arch/riscv/configs/rv32_defconfig
index 8dd02b842fef..434ef5b64599 100644
--- a/arch/riscv/configs/rv32_defconfig
+++ b/arch/riscv/configs/rv32_defconfig
@@ -127,7 +127,6 @@ CONFIG_DEBUG_PLIST=y
CONFIG_DEBUG_SG=y
# CONFIG_RCU_TRACE is not set
CONFIG_RCU_EQS_DEBUG=y
-CONFIG_DEBUG_BLOCK_EXT_DEVT=y
# CONFIG_FTRACE is not set
# CONFIG_RUNTIME_TESTING_MENU is not set
CONFIG_MEMTEST=y
diff --git a/block/genhd.c b/block/genhd.c
index 3ee031c97f22..716c5b04e5b1 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -312,54 +312,19 @@ void unregister_blkdev(unsigned int major, const char *name)
EXPORT_SYMBOL(unregister_blkdev);
-/**
- * blk_mangle_minor - scatter minor numbers apart
- * @minor: minor number to mangle
- *
- * Scatter consecutively allocated @minor number apart if MANGLE_DEVT
- * is enabled. Mangling twice gives the original value.
- *
- * RETURNS:
- * Mangled value.
- *
- * CONTEXT:
- * Don't care.
- */
-static int blk_mangle_minor(int minor)
-{
-#ifdef CONFIG_DEBUG_BLOCK_EXT_DEVT
- int i;
-
- for (i = 0; i < MINORBITS / 2; i++) {
- int low = minor & (1 << i);
- int high = minor & (1 << (MINORBITS - 1 - i));
- int distance = MINORBITS - 1 - 2 * i;
-
- minor ^= low | high; /* clear both bits */
- low <<= distance; /* swap the positions */
- high >>= distance;
- minor |= low | high; /* and set */
- }
-#endif
- return minor;
-}
-
int blk_alloc_ext_minor(void)
{
int idx;
idx = ida_alloc_range(&ext_devt_ida, 0, NR_EXT_DEVT, GFP_KERNEL);
- if (idx < 0) {
- if (idx == -ENOSPC)
- return -EBUSY;
- return idx;
- }
- return blk_mangle_minor(idx);
+ if (idx == -ENOSPC)
+ return -EBUSY;
+ return idx;
}
void blk_free_ext_minor(unsigned int minor)
{
- ida_free(&ext_devt_ida, blk_mangle_minor(minor));
+ ida_free(&ext_devt_ida, minor);
}
static char *bdevt_str(dev_t devt, char *buf)
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 74aede860de7..b691d6891e51 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -432,10 +432,6 @@ void __init mount_block_root(char *name, int flags)
printk("Please append a correct \"root=\" boot option; here are the available partitions:\n");
printk_all_partitions();
-#ifdef CONFIG_DEBUG_BLOCK_EXT_DEVT
- printk("DEBUG_BLOCK_EXT_DEVT is enabled, you need to specify "
- "explicit textual name for \"root=\" boot option.\n");
-#endif
panic("VFS: Unable to mount root fs on %s", b);
}
if (!(flags & SB_RDONLY)) {
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 5ddd575159fb..22a4aa51bd58 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1679,33 +1679,6 @@ config DEBUG_WQ_FORCE_RR_CPU
feature by default. When enabled, memory and cache locality will
be impacted.
-config DEBUG_BLOCK_EXT_DEVT
- bool "Force extended block device numbers and spread them"
- depends on DEBUG_KERNEL
- depends on BLOCK
- default n
- help
- BIG FAT WARNING: ENABLING THIS OPTION MIGHT BREAK BOOTING ON
- SOME DISTRIBUTIONS. DO NOT ENABLE THIS UNLESS YOU KNOW WHAT
- YOU ARE DOING. Distros, please enable this and fix whatever
- is broken.
-
- Conventionally, block device numbers are allocated from
- predetermined contiguous area. However, extended block area
- may introduce non-contiguous block device numbers. This
- option forces most block device numbers to be allocated from
- the extended space and spreads them to discover kernel or
- userland code paths which assume predetermined contiguous
- device number allocation.
-
- Note that turning on this debug option shuffles all the
- device numbers for all IDE and SCSI devices including libata
- ones, so root partition specified using device number
- directly (via rdev or root=MAJ:MIN) won't work anymore.
- Textual device names (root=/dev/sdXn) will continue to work.
-
- Say N if you are unsure.
-
config CPU_HOTPLUG_STATE_CONTROL
bool "Enable CPU hotplug state control"
depends on DEBUG_KERNEL
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: extended dev_t tidyups
2021-08-24 7:52 extended dev_t tidyups Christoph Hellwig
2021-08-24 7:52 ` [PATCH 1/2] block: remove a pointless call to MINOR() in device_add_disk Christoph Hellwig
2021-08-24 7:52 ` [PATCH 2/2] block: remove CONFIG_DEBUG_BLOCK_EXT_DEVT Christoph Hellwig
@ 2021-08-24 12:43 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2021-08-24 12:43 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-block
On 8/24/21 1:52 AM, Christoph Hellwig wrote:
> Hi Jens,
>
> two small tidyups for the extended dev_t code. One removes
> a not necessary maksing of a variable that already contains
> the minor number, and the other removes some long obsolete
> debugging code.
Applied - did 1/2 manually, doesn't seem to sit after the
add_disk() error handling changes.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-08-24 12:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24 7:52 extended dev_t tidyups Christoph Hellwig
2021-08-24 7:52 ` [PATCH 1/2] block: remove a pointless call to MINOR() in device_add_disk Christoph Hellwig
2021-08-24 7:52 ` [PATCH 2/2] block: remove CONFIG_DEBUG_BLOCK_EXT_DEVT Christoph Hellwig
2021-08-24 12:43 ` extended dev_t tidyups Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).