Skip to content

Commit

Permalink
block: Remove extra discard_alignment from hd_struct.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tao Ma authored and Jens Axboe committed May 7, 2011
1 parent 8af1954 commit 23ceb5b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 6 additions & 3 deletions fs/partitions/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion include/linux/genhd.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ struct hd_struct {
sector_t start_sect;
sector_t nr_sects;
sector_t alignment_offset;
unsigned int discard_alignment;
struct device __dev;
struct kobject *holder_dir;
int policy, partno;
Expand Down

0 comments on commit 23ceb5b

Please sign in to comment.