diff options
author | Jens Axboe <jaxboe@fusionio.com> | 2011-05-30 01:42:51 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2011-05-30 01:42:51 -0400 |
commit | a1706ac4c0201ea0143dc0db0659001b26ceeabb (patch) | |
tree | 51b1fc266708d34e0878eaf1e6435773067379a0 | |
parent | 5988ce239682854d4e632fb58bff000700830394 (diff) |
Revert "block: Remove extra discard_alignment from hd_struct."
It was not a good idea to start dereferencing disk->queue from
the fs sysfs strategy for displaying discard alignment. We ran
into first a NULL pointer deref, and after fixing that we sometimes
see unvalid disk->queue pointer values.
Since discard is the only one of the bunch actually looking into
the queue, just revert the change.
This reverts commit 23ceb5b7719e9276d4fa72a3ecf94dd396755276.
Conflicts:
fs/partitions/check.c
-rw-r--r-- | fs/partitions/check.c | 10 | ||||
-rw-r--r-- | include/linux/genhd.h | 1 |
2 files changed, 4 insertions, 7 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index f82e762eeca2..d545e97d99c3 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -255,13 +255,7 @@ ssize_t part_discard_alignment_show(struct device *dev, | |||
255 | struct device_attribute *attr, char *buf) | 255 | struct device_attribute *attr, char *buf) |
256 | { | 256 | { |
257 | struct hd_struct *p = dev_to_part(dev); | 257 | struct hd_struct *p = dev_to_part(dev); |
258 | struct gendisk *disk = dev_to_disk(dev); | 258 | return sprintf(buf, "%u\n", p->discard_alignment); |
259 | unsigned int alignment = 0; | ||
260 | |||
261 | if (disk->queue) | ||
262 | alignment = queue_limit_discard_alignment(&disk->queue->limits, | ||
263 | p->start_sect); | ||
264 | return sprintf(buf, "%u\n", alignment); | ||
265 | } | 259 | } |
266 | 260 | ||
267 | ssize_t part_stat_show(struct device *dev, | 261 | ssize_t part_stat_show(struct device *dev, |
@@ -455,6 +449,8 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno, | |||
455 | p->start_sect = start; | 449 | p->start_sect = start; |
456 | p->alignment_offset = | 450 | p->alignment_offset = |
457 | queue_limit_alignment_offset(&disk->queue->limits, start); | 451 | queue_limit_alignment_offset(&disk->queue->limits, start); |
452 | p->discard_alignment = | ||
453 | queue_limit_discard_alignment(&disk->queue->limits, start); | ||
458 | p->nr_sects = len; | 454 | p->nr_sects = len; |
459 | p->partno = partno; | 455 | p->partno = partno; |
460 | p->policy = get_disk_ro(disk); | 456 | p->policy = get_disk_ro(disk); |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index b78956b3c2e7..300d7582006e 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -100,6 +100,7 @@ struct hd_struct { | |||
100 | sector_t start_sect; | 100 | sector_t start_sect; |
101 | sector_t nr_sects; | 101 | sector_t nr_sects; |
102 | sector_t alignment_offset; | 102 | sector_t alignment_offset; |
103 | unsigned int discard_alignment; | ||
103 | struct device __dev; | 104 | struct device __dev; |
104 | struct kobject *holder_dir; | 105 | struct kobject *holder_dir; |
105 | int policy, partno; | 106 | int policy, partno; |