aboutsummaryrefslogtreecommitdiffstats
path: root/fs/partitions/check.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/partitions/check.c')
-rw-r--r--fs/partitions/check.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 7b685e10cbad..e238ab23a9e7 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -16,6 +16,7 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/slab.h>
19#include <linux/kmod.h> 20#include <linux/kmod.h>
20#include <linux/ctype.h> 21#include <linux/ctype.h>
21#include <linux/genhd.h> 22#include <linux/genhd.h>
@@ -226,6 +227,13 @@ ssize_t part_alignment_offset_show(struct device *dev,
226 return sprintf(buf, "%llu\n", (unsigned long long)p->alignment_offset); 227 return sprintf(buf, "%llu\n", (unsigned long long)p->alignment_offset);
227} 228}
228 229
230ssize_t part_discard_alignment_show(struct device *dev,
231 struct device_attribute *attr, char *buf)
232{
233 struct hd_struct *p = dev_to_part(dev);
234 return sprintf(buf, "%u\n", p->discard_alignment);
235}
236
229ssize_t part_stat_show(struct device *dev, 237ssize_t part_stat_show(struct device *dev,
230 struct device_attribute *attr, char *buf) 238 struct device_attribute *attr, char *buf)
231{ 239{
@@ -288,6 +296,8 @@ static DEVICE_ATTR(partition, S_IRUGO, part_partition_show, NULL);
288static DEVICE_ATTR(start, S_IRUGO, part_start_show, NULL); 296static DEVICE_ATTR(start, S_IRUGO, part_start_show, NULL);
289static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL); 297static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL);
290static DEVICE_ATTR(alignment_offset, S_IRUGO, part_alignment_offset_show, NULL); 298static DEVICE_ATTR(alignment_offset, S_IRUGO, part_alignment_offset_show, NULL);
299static DEVICE_ATTR(discard_alignment, S_IRUGO, part_discard_alignment_show,
300 NULL);
291static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL); 301static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL);
292static DEVICE_ATTR(inflight, S_IRUGO, part_inflight_show, NULL); 302static DEVICE_ATTR(inflight, S_IRUGO, part_inflight_show, NULL);
293#ifdef CONFIG_FAIL_MAKE_REQUEST 303#ifdef CONFIG_FAIL_MAKE_REQUEST
@@ -300,6 +310,7 @@ static struct attribute *part_attrs[] = {
300 &dev_attr_start.attr, 310 &dev_attr_start.attr,
301 &dev_attr_size.attr, 311 &dev_attr_size.attr,
302 &dev_attr_alignment_offset.attr, 312 &dev_attr_alignment_offset.attr,
313 &dev_attr_discard_alignment.attr,
303 &dev_attr_stat.attr, 314 &dev_attr_stat.attr,
304 &dev_attr_inflight.attr, 315 &dev_attr_inflight.attr,
305#ifdef CONFIG_FAIL_MAKE_REQUEST 316#ifdef CONFIG_FAIL_MAKE_REQUEST
@@ -402,7 +413,10 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno,
402 pdev = part_to_dev(p); 413 pdev = part_to_dev(p);
403 414
404 p->start_sect = start; 415 p->start_sect = start;
405 p->alignment_offset = queue_sector_alignment_offset(disk->queue, start); 416 p->alignment_offset =
417 queue_limit_alignment_offset(&disk->queue->limits, start);
418 p->discard_alignment =
419 queue_limit_discard_alignment(&disk->queue->limits, start);
406 p->nr_sects = len; 420 p->nr_sects = len;
407 p->partno = partno; 421 p->partno = partno;
408 p->policy = get_disk_ro(disk); 422 p->policy = get_disk_ro(disk);