aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-08-25 06:56:15 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 02:56:08 -0400
commit540eed5637b766bb1e881ef744c42617760b4815 (patch)
tree8bdf54967a8290f780216f767291623e67ee7e9b /include/linux
parent074a7aca7afa6f230104e8e65eba3420263714a5 (diff)
block: make partition array dynamic
disk->__part used to be statically allocated to the maximum possible number of partitions. This patch makes partition array allocation dynamic. The added overhead is minimal as only real change is one memory dereference changed to RCU one. This saves both a bit of memory and cpu cycles iterating through unoccupied slots and makes increasing partition limit easier. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/genhd.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index c90e1b4fbe5a..ecf649c3deed 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -113,6 +113,21 @@ struct hd_struct {
113#define GENHD_FL_UP 16 113#define GENHD_FL_UP 16
114#define GENHD_FL_SUPPRESS_PARTITION_INFO 32 114#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
115 115
116#define BLK_SCSI_MAX_CMDS (256)
117#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8))
118
119struct blk_scsi_cmd_filter {
120 unsigned long read_ok[BLK_SCSI_CMD_PER_LONG];
121 unsigned long write_ok[BLK_SCSI_CMD_PER_LONG];
122 struct kobject kobj;
123};
124
125struct disk_part_tbl {
126 struct rcu_head rcu_head;
127 int len;
128 struct hd_struct *part[];
129};
130
116struct gendisk { 131struct gendisk {
117 /* major, first_minor, minors and ext_minors are input 132 /* major, first_minor, minors and ext_minors are input
118 * parameters only, don't use directly. Use disk_devt() and 133 * parameters only, don't use directly. Use disk_devt() and
@@ -131,7 +146,7 @@ struct gendisk {
131 * non-critical accesses use RCU. Always access through 146 * non-critical accesses use RCU. Always access through
132 * helpers. 147 * helpers.
133 */ 148 */
134 struct hd_struct **__part; 149 struct disk_part_tbl *part_tbl;
135 struct hd_struct part0; 150 struct hd_struct part0;
136 151
137 struct block_device_operations *fops; 152 struct block_device_operations *fops;
@@ -149,6 +164,7 @@ struct gendisk {
149#ifdef CONFIG_BLK_DEV_INTEGRITY 164#ifdef CONFIG_BLK_DEV_INTEGRITY
150 struct blk_integrity *integrity; 165 struct blk_integrity *integrity;
151#endif 166#endif
167 int node_id;
152}; 168};
153 169
154static inline struct gendisk *part_to_disk(struct hd_struct *part) 170static inline struct gendisk *part_to_disk(struct hd_struct *part)
@@ -503,6 +519,7 @@ extern void blk_free_devt(dev_t devt);
503extern dev_t blk_lookup_devt(const char *name, int partno); 519extern dev_t blk_lookup_devt(const char *name, int partno);
504extern char *disk_name (struct gendisk *hd, int partno, char *buf); 520extern char *disk_name (struct gendisk *hd, int partno, char *buf);
505 521
522extern int disk_expand_part_tbl(struct gendisk *disk, int target);
506extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); 523extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
507extern int __must_check add_partition(struct gendisk *, int, sector_t, sector_t, int); 524extern int __must_check add_partition(struct gendisk *, int, sector_t, sector_t, int);
508extern void delete_partition(struct gendisk *, int); 525extern void delete_partition(struct gendisk *, int);