Commit 7b8917f5 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: remove the alignment_offset field from struct hd_struct

The alignment offset is only used in slow path callers, so just calculate
it on the fly.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e44a6a23
...@@ -199,7 +199,10 @@ static ssize_t part_alignment_offset_show(struct device *dev, ...@@ -199,7 +199,10 @@ static ssize_t part_alignment_offset_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct hd_struct *p = dev_to_part(dev); struct hd_struct *p = dev_to_part(dev);
return sprintf(buf, "%llu\n", (unsigned long long)p->alignment_offset);
return sprintf(buf, "%u\n",
queue_limit_alignment_offset(&part_to_disk(p)->queue->limits,
p->start_sect));
} }
static ssize_t part_discard_alignment_show(struct device *dev, static ssize_t part_discard_alignment_show(struct device *dev,
...@@ -405,8 +408,6 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno, ...@@ -405,8 +408,6 @@ static struct hd_struct *add_partition(struct gendisk *disk, int partno,
pdev = part_to_dev(p); pdev = part_to_dev(p);
p->start_sect = start; p->start_sect = start;
p->alignment_offset =
queue_limit_alignment_offset(&disk->queue->limits, start);
p->discard_alignment = p->discard_alignment =
queue_limit_discard_alignment(&disk->queue->limits, start); queue_limit_discard_alignment(&disk->queue->limits, start);
p->nr_sects = len; p->nr_sects = len;
......
...@@ -1456,10 +1456,9 @@ static inline int bdev_alignment_offset(struct block_device *bdev) ...@@ -1456,10 +1456,9 @@ static inline int bdev_alignment_offset(struct block_device *bdev)
if (q->limits.misaligned) if (q->limits.misaligned)
return -1; return -1;
if (bdev != bdev->bd_contains) if (bdev != bdev->bd_contains)
return bdev->bd_part->alignment_offset; return queue_limit_alignment_offset(&q->limits,
bdev->bd_part->start_sect);
return q->limits.alignment_offset; return q->limits.alignment_offset;
} }
......
...@@ -65,7 +65,6 @@ struct hd_struct { ...@@ -65,7 +65,6 @@ struct hd_struct {
struct disk_stats __percpu *dkstats; struct disk_stats __percpu *dkstats;
struct percpu_ref ref; struct percpu_ref ref;
sector_t alignment_offset;
unsigned int discard_alignment; unsigned int discard_alignment;
struct device __dev; struct device __dev;
struct kobject *holder_dir; struct kobject *holder_dir;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment