diff options
author | Tejun Heo <tj@kernel.org> | 2008-08-25 06:56:13 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-10-09 02:56:08 -0400 |
commit | eddb2e26b5ee3c5da68ba4bf1921ba20e2097bff (patch) | |
tree | 7a24f3f3cb577f344491dc57ea441060fac9d9a9 /block | |
parent | 0762b8bde9729f10f8e6249809660ff2ec3ad735 (diff) |
block: kill GENHD_FL_FAIL and use part0->make_it_fail
GENHD_FL_FAIL for disk is what make_it_fail is for parts. Kill it and
use part0->make_it_fail. Sysfs node handling is unified too.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-core.c | 5 | ||||
-rw-r--r-- | block/genhd.c | 30 |
2 files changed, 4 insertions, 31 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index a4a7c08d2f20..505ec61067df 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -1273,8 +1273,9 @@ __setup("fail_make_request=", setup_fail_make_request); | |||
1273 | 1273 | ||
1274 | static int should_fail_request(struct bio *bio) | 1274 | static int should_fail_request(struct bio *bio) |
1275 | { | 1275 | { |
1276 | if ((bio->bi_bdev->bd_disk->flags & GENHD_FL_FAIL) || | 1276 | struct hd_struct *part = bio->bi_bdev->bd_part; |
1277 | bio->bi_bdev->bd_part->make_it_fail) | 1277 | |
1278 | if (part_to_disk(part)->part0.make_it_fail || part->make_it_fail) | ||
1278 | return should_fail(&fail_make_request, bio->bi_size); | 1279 | return should_fail(&fail_make_request, bio->bi_size); |
1279 | 1280 | ||
1280 | return 0; | 1281 | return 0; |
diff --git a/block/genhd.c b/block/genhd.c index 70358f3c7423..06a252f2b967 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -795,34 +795,6 @@ static ssize_t disk_stat_show(struct device *dev, | |||
795 | jiffies_to_msecs(disk_stat_read(disk, time_in_queue))); | 795 | jiffies_to_msecs(disk_stat_read(disk, time_in_queue))); |
796 | } | 796 | } |
797 | 797 | ||
798 | #ifdef CONFIG_FAIL_MAKE_REQUEST | ||
799 | static ssize_t disk_fail_show(struct device *dev, | ||
800 | struct device_attribute *attr, char *buf) | ||
801 | { | ||
802 | struct gendisk *disk = dev_to_disk(dev); | ||
803 | |||
804 | return sprintf(buf, "%d\n", disk->flags & GENHD_FL_FAIL ? 1 : 0); | ||
805 | } | ||
806 | |||
807 | static ssize_t disk_fail_store(struct device *dev, | ||
808 | struct device_attribute *attr, | ||
809 | const char *buf, size_t count) | ||
810 | { | ||
811 | struct gendisk *disk = dev_to_disk(dev); | ||
812 | int i; | ||
813 | |||
814 | if (count > 0 && sscanf(buf, "%d", &i) > 0) { | ||
815 | if (i == 0) | ||
816 | disk->flags &= ~GENHD_FL_FAIL; | ||
817 | else | ||
818 | disk->flags |= GENHD_FL_FAIL; | ||
819 | } | ||
820 | |||
821 | return count; | ||
822 | } | ||
823 | |||
824 | #endif | ||
825 | |||
826 | static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL); | 798 | static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL); |
827 | static DEVICE_ATTR(ext_range, S_IRUGO, disk_ext_range_show, NULL); | 799 | static DEVICE_ATTR(ext_range, S_IRUGO, disk_ext_range_show, NULL); |
828 | static DEVICE_ATTR(removable, S_IRUGO, disk_removable_show, NULL); | 800 | static DEVICE_ATTR(removable, S_IRUGO, disk_removable_show, NULL); |
@@ -832,7 +804,7 @@ static DEVICE_ATTR(capability, S_IRUGO, disk_capability_show, NULL); | |||
832 | static DEVICE_ATTR(stat, S_IRUGO, disk_stat_show, NULL); | 804 | static DEVICE_ATTR(stat, S_IRUGO, disk_stat_show, NULL); |
833 | #ifdef CONFIG_FAIL_MAKE_REQUEST | 805 | #ifdef CONFIG_FAIL_MAKE_REQUEST |
834 | static struct device_attribute dev_attr_fail = | 806 | static struct device_attribute dev_attr_fail = |
835 | __ATTR(make-it-fail, S_IRUGO|S_IWUSR, disk_fail_show, disk_fail_store); | 807 | __ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store); |
836 | #endif | 808 | #endif |
837 | 809 | ||
838 | static struct attribute *disk_attrs[] = { | 810 | static struct attribute *disk_attrs[] = { |