summaryrefslogtreecommitdiffstats
path: root/include/linux/genhd.h
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2015-10-21 13:19:49 -0400
committerJens Axboe <axboe@fb.com>2015-10-21 16:42:42 -0400
commit25520d55cdb6ee289abc68f553d364d22478ff54 (patch)
tree84e447f762e7f60095d0c4d24fdf2d9440f4b06d /include/linux/genhd.h
parent4c241d08dbfcbdc7a949b91d72707a289d464954 (diff)
block: Inline blk_integrity in struct gendisk
Up until now the_integrity profile has been dynamically allocated and attached to struct gendisk after the disk has been made active. This causes problems because NVMe devices need to register the profile prior to the partition table being read due to a mandatory metadata buffer requirement. In addition, DM goes through hoops to deal with preallocating, but not initializing integrity profiles. Since the integrity profile is small (4 bytes + a pointer), Christoph suggested moving it to struct gendisk proper. This requires several changes: - Moving the blk_integrity definition to genhd.h. - Inlining blk_integrity in struct gendisk. - Removing the dynamic allocation code. - Adding helper functions which allow gendisk to set up and tear down the integrity sysfs dir when a disk is added/deleted. - Adding a blk_integrity_revalidate() callback for updating the stable pages bdi setting. - The calls that depend on whether a device has an integrity profile or not now key off of the bi->profile pointer. - Simplifying the integrity support routines in DM (Mike Snitzer). Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Reported-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Cc: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/linux/genhd.h')
-rw-r--r--include/linux/genhd.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 9e6e0dfa97ad..82f4911e0ad8 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -163,6 +163,18 @@ struct disk_part_tbl {
163 163
164struct disk_events; 164struct disk_events;
165 165
166#if defined(CONFIG_BLK_DEV_INTEGRITY)
167
168struct blk_integrity {
169 struct blk_integrity_profile *profile;
170 unsigned char flags;
171 unsigned char tuple_size;
172 unsigned char interval_exp;
173 unsigned char tag_size;
174};
175
176#endif /* CONFIG_BLK_DEV_INTEGRITY */
177
166struct gendisk { 178struct gendisk {
167 /* major, first_minor and minors are input parameters only, 179 /* major, first_minor and minors are input parameters only,
168 * don't use directly. Use disk_devt() and disk_max_parts(). 180 * don't use directly. Use disk_devt() and disk_max_parts().
@@ -198,9 +210,9 @@ struct gendisk {
198 atomic_t sync_io; /* RAID */ 210 atomic_t sync_io; /* RAID */
199 struct disk_events *ev; 211 struct disk_events *ev;
200#ifdef CONFIG_BLK_DEV_INTEGRITY 212#ifdef CONFIG_BLK_DEV_INTEGRITY
201 struct blk_integrity *integrity; 213 struct blk_integrity integrity;
202 struct kobject integrity_kobj; 214 struct kobject integrity_kobj;
203#endif 215#endif /* CONFIG_BLK_DEV_INTEGRITY */
204 int node_id; 216 int node_id;
205}; 217};
206 218
@@ -728,6 +740,16 @@ static inline void part_nr_sects_write(struct hd_struct *part, sector_t size)
728#endif 740#endif
729} 741}
730 742
743#if defined(CONFIG_BLK_DEV_INTEGRITY)
744extern void blk_integrity_add(struct gendisk *);
745extern void blk_integrity_del(struct gendisk *);
746extern void blk_integrity_revalidate(struct gendisk *);
747#else /* CONFIG_BLK_DEV_INTEGRITY */
748static inline void blk_integrity_add(struct gendisk *disk) { }
749static inline void blk_integrity_del(struct gendisk *disk) { }
750static inline void blk_integrity_revalidate(struct gendisk *disk) { }
751#endif /* CONFIG_BLK_DEV_INTEGRITY */
752
731#else /* CONFIG_BLOCK */ 753#else /* CONFIG_BLOCK */
732 754
733static inline void printk_all_partitions(void) { } 755static inline void printk_all_partitions(void) { }