mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] block: add GENHD_FL_UNPARTITIONABLE
@ 2011-08-13 15:32 Tejun Heo
  2011-08-13 18:54 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tejun Heo @ 2011-08-13 15:32 UTC (permalink / raw)
  To: Jens Axboe, Kay Sievers, lkml

There are cases where suppressing partition scan is useful - e.g. for
lo devices and pseudo SATA devices which advertise to be a disk but
get upset on partition scan (some port multiplier control devices show
such behavior).

This patch adds GENHD_FL_UNPARTITIONABLE which suppresses partition
scan regardless of the number of possible partitions.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
---
 include/linux/genhd.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 02fa469..a6f9329 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -128,6 +128,7 @@ struct hd_struct {
 #define GENHD_FL_EXT_DEVT			64 /* allow extended devt */
 #define GENHD_FL_NATIVE_CAPACITY		128
 #define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE	256
+#define GENHD_FL_UNPARTITIONABLE		512
 
 enum {
 	DISK_EVENT_MEDIA_CHANGE			= 1 << 0, /* media changed */
@@ -236,7 +237,8 @@ static inline int disk_max_parts(struct gendisk *disk)
 
 static inline bool disk_partitionable(struct gendisk *disk)
 {
-	return disk_max_parts(disk) > 1;
+	return disk_max_parts(disk) > 1 &&
+		!(disk->flags & GENHD_FL_UNPARTITIONABLE);
 }
 
 static inline dev_t disk_devt(struct gendisk *disk)

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

end of thread, other threads:[~2011-08-15 12:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-13 15:32 [PATCH] block: add GENHD_FL_UNPARTITIONABLE Tejun Heo
2011-08-13 18:54 ` Christoph Hellwig
2011-08-13 19:04   ` Tejun Heo
2011-08-14  8:41 ` Bruno Prémont
2011-08-15 12:12 ` [PATCH UPDATED] block: add GENHD_FL_NO_PART_SCAN Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®