Skip to contentSkip to conversation

mtd_blkdevs: don't scan partitions for plain mtdblock

PATCH Applied Christoph Hellwig 3 participants 7 messages Dec 6, 2021 – Dec 13, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd_blkdevs: don't scan partitions for plain mtdblock

mtdblock / mtdblock_ro set part_bits to 0 and thus nevever scanned partitions. Restore that behavior by setting the GENHD_FL_NO_PART flag.

Fixes 1ebe2e5f9d68e94c ("block: remove GENHD_FL_EXT_DEVT")
---
 drivers/mtd/mtd_blkdevs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mtd/mtd_blkdevs.c +4 -2
index 113f86df76038..243f28a3206b4 100644
@@ -346,7 +346,7 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
 	gd->minors = 1 << tr->part_bits;
 	gd->fops = &mtd_block_ops;
 
-	if (tr->part_bits)
+	if (tr->part_bits) {
 		if (new->devnum < 26)
 			snprintf(gd->disk_name, sizeof(gd->disk_name),
 				 "%s%c", tr->name, 'a' + new->devnum);
@@ -355,9 +355,11 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
 				 "%s%c%c", tr->name,
 				 'a' - 1 + new->devnum / 26,
 				 'a' + new->devnum % 26);
-	else
+	} else {
 		snprintf(gd->disk_name, sizeof(gd->disk_name),
 			 "%s%d", tr->name, new->devnum);
+		gd->flags |= GENHD_FL_NO_PART;
+	}
 
 	set_capacity(gd, ((u64)new->size * tr->blksize) >> 9);
 
Signature · 1 line
2.30.2
maintainer Applied
#1 lore raw
Quoted 4 lines · Christoph Hellwig

mtdblock / mtdblock_ro set part_bits to 0 and thus nevever scanned partitions. Restore that behavior by setting the GENHD_FL_NO_PART flag.

Applied, thanks!

[1/1] mtd_blkdevs: don't scan partitions for plain mtdblock

      commit: 776b54e97a7d993ba23696e032426d5dea5bbe70

Best regards,

Signature · 1 line
Jens Axboe
maintainer
#2 lore raw
In reply to Christoph Hellwig
Quoted 26 lines · Christoph Hellwig

mtdblock / mtdblock_ro set part_bits to 0 and thus nevever scanned partitions. Restore that behavior by setting the GENHD_FL_NO_PART flag.

Fixes 1ebe2e5f9d68e94c ("block: remove GENHD_FL_EXT_DEVT")
---
 drivers/mtd/mtd_blkdevs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mtd/mtd_blkdevs.c +1 -1
index 113f86df76038..243f28a3206b4 100644
@@ -346,7 +346,7 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
        gd->minors = 1 << tr->part_bits;
        gd->fops = &mtd_block_ops;
 
-       if (tr->part_bits)
+       if (tr->part_bits) {
                if (new->devnum < 26)
                        snprintf(gd->disk_name, sizeof(gd->disk_name),
                                 "%s%c", tr->name, 'a' + new->devnum);

drivers/mtd/mtd_blkdevs.c int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) · line 362

Quoted 9 lines
drivers/mtd/mtd_blkdevs.c +3 -1
@@ -355,9 +355,11 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
                                 "%s%c%c", tr->name,
                                 'a' - 1 + new->devnum / 26,
                                 'a' + new->devnum % 26);
-       else
+       } else {
                snprintf(gd->disk_name, sizeof(gd->disk_name),
                         "%s%d", tr->name, new->devnum);
+               gd->flags |= GENHD_FL_NO_PART;
+       }

Not sure why I didn't spot this until now, but:

drivers/mtd/mtd_blkdevs.c: In function ‘add_mtd_blktrans_dev’:
drivers/mtd/mtd_blkdevs.c:362:30: error: ‘GENHD_FL_NO_PART’ undeclared (first use in this function); did you mean ‘GENHD_FL_NO_PART_SCAN’?

  362 |                 gd->flags |= GENHD_FL_NO_PART;
      |                              ^~~~~~~~~~~~~~~~
      |                              GENHD_FL_NO_PART_SCAN

drivers/mtd/mtd_blkdevs.c:362:30: note: each undeclared identifier is reported only once for each function it appears in

Hmm?

I'm going to revert this one for now, not sure how it could've been tested in this form.

Signature · 1 line
Jens Axboe
#3 lore raw

Hi Jens,

Quoted 27 lines · Jens Axboe
Quoted 9 lines · Christoph Hellwig

mtdblock / mtdblock_ro set part_bits to 0 and thus nevever scanned partitions. Restore that behavior by setting the GENHD_FL_NO_PART flag.

Fixes 1ebe2e5f9d68e94c ("block: remove GENHD_FL_EXT_DEVT")

drivers/mtd/mtd_blkdevs.c int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) · line 362

Quoted 9 lines
drivers/mtd/mtd_blkdevs.c +3 -1
@@ -355,9 +355,11 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
                                 "%s%c%c", tr->name,
                                 'a' - 1 + new->devnum / 26,
                                 'a' + new->devnum % 26);
-       else
+       } else {
                snprintf(gd->disk_name, sizeof(gd->disk_name),
                         "%s%d", tr->name, new->devnum);
+               gd->flags |= GENHD_FL_NO_PART;
+       }

Not sure why I didn't spot this until now, but:

drivers/mtd/mtd_blkdevs.c: In function ‘add_mtd_blktrans_dev’:
drivers/mtd/mtd_blkdevs.c:362:30: error: ‘GENHD_FL_NO_PART’ undeclared (first use in this function); did you mean ‘GENHD_FL_NO_PART_SCAN’?

  362 |                 gd->flags |= GENHD_FL_NO_PART;
      |                              ^~~~~~~~~~~~~~~~
      |                              GENHD_FL_NO_PART_SCAN
Quoted 6 lines

drivers/mtd/mtd_blkdevs.c:362:30: note: each undeclared identifier is reported only once for each function it appears in

Hmm?

I'm going to revert this one for now, not sure how it could've been tested in this form.

Because next-20211130 and later have commit 46e7eac647b34ed4 ("block:
rename GENHD_FL_NO_PART_SCAN to GENHD_FL_NO_PART").

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

maintainer
#4 lore raw
Quoted 32 lines · Geert Uytterhoeven

Hi Jens,

Quoted 29 lines · Jens Axboe
Quoted 9 lines · Christoph Hellwig

mtdblock / mtdblock_ro set part_bits to 0 and thus nevever scanned partitions. Restore that behavior by setting the GENHD_FL_NO_PART flag.

Fixes 1ebe2e5f9d68e94c ("block: remove GENHD_FL_EXT_DEVT")

drivers/mtd/mtd_blkdevs.c int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) · line 362

Quoted 9 lines
drivers/mtd/mtd_blkdevs.c +3 -1
@@ -355,9 +355,11 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
                                 "%s%c%c", tr->name,
                                 'a' - 1 + new->devnum / 26,
                                 'a' + new->devnum % 26);
-       else
+       } else {
                snprintf(gd->disk_name, sizeof(gd->disk_name),
                         "%s%d", tr->name, new->devnum);
+               gd->flags |= GENHD_FL_NO_PART;
+       }

Not sure why I didn't spot this until now, but:

drivers/mtd/mtd_blkdevs.c: In function ‘add_mtd_blktrans_dev’:
drivers/mtd/mtd_blkdevs.c:362:30: error: ‘GENHD_FL_NO_PART’ undeclared (first use in this function); did you mean ‘GENHD_FL_NO_PART_SCAN’?

  362 |                 gd->flags |= GENHD_FL_NO_PART;
      |                              ^~~~~~~~~~~~~~~~
      |                              GENHD_FL_NO_PART_SCAN

drivers/mtd/mtd_blkdevs.c:362:30: note: each undeclared identifier is reported only once for each function it appears in

Quoted 7 lines
Quoted 4 lines

Hmm?

I'm going to revert this one for now, not sure how it could've been tested in this form.

Because next-20211130 and later have commit 46e7eac647b34ed4 ("block:
rename GENHD_FL_NO_PART_SCAN to GENHD_FL_NO_PART").

I guess that explains it, it ended up in the wrong branch...

Signature · 1 line
Jens Axboe
#5 lore raw
In reply to Jens Axboe
Quoted 12 lines · Jens Axboe
Quoted 4 lines
Fixes 1ebe2e5f9d68e94c ("block: remove GENHD_FL_EXT_DEVT")

Not sure why I didn't spot this until now, but:

drivers/mtd/mtd_blkdevs.c: In function ‘add_mtd_blktrans_dev’:
drivers/mtd/mtd_blkdevs.c:362:30: error: ‘GENHD_FL_NO_PART’ undeclared (first use in this function); did you mean ‘GENHD_FL_NO_PART_SCAN’?

  362 |                 gd->flags |= GENHD_FL_NO_PART;
      |                              ^~~~~~~~~~~~~~~~
      |                              GENHD_FL_NO_PART_SCAN
Quoted 6 lines

drivers/mtd/mtd_blkdevs.c:362:30: note: each undeclared identifier is reported only once for each function it appears in

Hmm?

I'm going to revert this one for now, not sure how it could've been tested in this form.

It was tested in a tree that also contains the commit identified by the Fixed tag, which is in the for-next tree but not the block-5.16 one.

maintainer Applied
#6 lore raw
In reply to Christoph Hellwig
Quoted 4 lines · Christoph Hellwig

mtdblock / mtdblock_ro set part_bits to 0 and thus nevever scanned partitions. Restore that behavior by setting the GENHD_FL_NO_PART flag.

Applied, thanks!

[1/1] mtd_blkdevs: don't scan partitions for plain mtdblock

      commit: 17f81f9d4b41d57e474975c3a5ca2a2c4c01e2ec

Best regards,

Signature · 1 line
Jens Axboe