summaryrefslogtreecommitdiffstats
path: root/include/linux/genhd.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-08-23 14:01:04 -0400
committerJens Axboe <jaxboe@fusionio.com>2011-08-23 14:01:04 -0400
commitd27769ec3df1a8de9ca450d2dcd72d1ab259ba32 (patch)
treef17c064e0d8ac26fa80c1c72dccaca053bb55e94 /include/linux/genhd.h
parent322a8b034003c0d46d39af85bf24fee27b902f48 (diff)
block: add GENHD_FL_NO_PART_SCAN
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_NO_PART_SCAN which suppresses partition scan regardless of the number of possible partitions. disk_partitionable() is renamed to disk_part_scan_enabled() as suppressing partition scan doesn't imply the device can't be partitioned using BLKPG_ADD/DEL_PARTITION calls from userland. show_partition() now directly tests disk_max_parts() to maintain backward-compatibility. -v2: Updated to make it clear that only partition scan is suppressed not partitioning itself as suggested by Kay Sievers. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'include/linux/genhd.h')
-rw-r--r--include/linux/genhd.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 02fa4697a0e5..6d18f3531f18 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -128,6 +128,7 @@ struct hd_struct {
128#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ 128#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */
129#define GENHD_FL_NATIVE_CAPACITY 128 129#define GENHD_FL_NATIVE_CAPACITY 128
130#define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 256 130#define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 256
131#define GENHD_FL_NO_PART_SCAN 512
131 132
132enum { 133enum {
133 DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */ 134 DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */
@@ -234,9 +235,10 @@ static inline int disk_max_parts(struct gendisk *disk)
234 return disk->minors; 235 return disk->minors;
235} 236}
236 237
237static inline bool disk_partitionable(struct gendisk *disk) 238static inline bool disk_part_scan_enabled(struct gendisk *disk)
238{ 239{
239 return disk_max_parts(disk) > 1; 240 return disk_max_parts(disk) > 1 &&
241 !(disk->flags & GENHD_FL_NO_PART_SCAN);
240} 242}
241 243
242static inline dev_t disk_devt(struct gendisk *disk) 244static inline dev_t disk_devt(struct gendisk *disk)