summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTao Ma <boyu.mt@taobao.com>2011-05-07 03:30:02 +0200
committerJens Axboe <jaxboe@fusionio.com>2011-05-07 03:30:02 +0200
commit23ceb5b7719e9276d4fa72a3ecf94dd396755276 (patch)
treef0613021d10b9e8464a26a78fcabf48e0f0b715b /fs
parentblkdev: Do not return -EOPNOTSUPP if discard is supported (diff)
downloadlinux-23ceb5b7719e9276d4fa72a3ecf94dd396755276.tar.xz
linux-23ceb5b7719e9276d4fa72a3ecf94dd396755276.zip
block: Remove extra discard_alignment from hd_struct.
Currently, hd_struct.discard_alignment is only used when we show /sys/block/sdx/sdx/discard_alignment. So remove it and calculate when it is asked to show. Signed-off-by: Tao Ma <boyu.mt@taobao.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/partitions/check.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index d545e97d99c3..b7e16bccd5e5 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -255,7 +255,12 @@ ssize_t part_discard_alignment_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct hd_struct *p = dev_to_part(dev);
- return sprintf(buf, "%u\n", p->discard_alignment);
+ struct gendisk *disk = dev_to_disk(dev);
+
+ return sprintf(buf, "%u\n",
+ (unsigned long long)queue_limit_discard_alignment(
+ &disk->queue->limits,
+ p->start_sect));
}
ssize_t part_stat_show(struct device *dev,
@@ -449,8 +454,6 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno,
p->start_sect = start;
p->alignment_offset =
queue_limit_alignment_offset(&disk->queue->limits, start);
- p->discard_alignment =
- queue_limit_discard_alignment(&disk->queue->limits, start);
p->nr_sects = len;
p->partno = partno;
p->policy = get_disk_ro(disk);