Commit b309e993 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: move make_it_fail to struct block_device

Move the make_it_fail flag to struct block_device an turn it into a bool
in preparation of killing struct hd_struct.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 1bdd5ae0
...@@ -668,7 +668,8 @@ __setup("fail_make_request=", setup_fail_make_request); ...@@ -668,7 +668,8 @@ __setup("fail_make_request=", setup_fail_make_request);
static bool should_fail_request(struct hd_struct *part, unsigned int bytes) static bool should_fail_request(struct hd_struct *part, unsigned int bytes)
{ {
return part->make_it_fail && should_fail(&fail_make_request, bytes); return part->bdev->bd_make_it_fail &&
should_fail(&fail_make_request, bytes);
} }
static int __init fail_make_request_debugfs(void) static int __init fail_make_request_debugfs(void)
......
...@@ -1292,7 +1292,7 @@ ssize_t part_fail_show(struct device *dev, ...@@ -1292,7 +1292,7 @@ ssize_t part_fail_show(struct device *dev,
{ {
struct hd_struct *p = dev_to_part(dev); struct hd_struct *p = dev_to_part(dev);
return sprintf(buf, "%d\n", p->make_it_fail); return sprintf(buf, "%d\n", p->bdev->bd_make_it_fail);
} }
ssize_t part_fail_store(struct device *dev, ssize_t part_fail_store(struct device *dev,
...@@ -1303,7 +1303,7 @@ ssize_t part_fail_store(struct device *dev, ...@@ -1303,7 +1303,7 @@ ssize_t part_fail_store(struct device *dev,
int i; int i;
if (count > 0 && sscanf(buf, "%d", &i) > 0) if (count > 0 && sscanf(buf, "%d", &i) > 0)
p->make_it_fail = (i == 0) ? 0 : 1; p->bdev->bd_make_it_fail = i;
return count; return count;
} }
......
...@@ -52,6 +52,9 @@ struct block_device { ...@@ -52,6 +52,9 @@ struct block_device {
struct super_block *bd_fsfreeze_sb; struct super_block *bd_fsfreeze_sb;
struct partition_meta_info *bd_meta_info; struct partition_meta_info *bd_meta_info;
#ifdef CONFIG_FAIL_MAKE_REQUEST
bool bd_make_it_fail;
#endif
} __randomize_layout; } __randomize_layout;
#define bdev_whole(_bdev) \ #define bdev_whole(_bdev) \
......
...@@ -56,9 +56,6 @@ struct hd_struct { ...@@ -56,9 +56,6 @@ struct hd_struct {
struct block_device *bdev; struct block_device *bdev;
struct device __dev; struct device __dev;
int policy, partno; int policy, partno;
#ifdef CONFIG_FAIL_MAKE_REQUEST
int make_it_fail;
#endif
struct rcu_work rcu_work; struct rcu_work rcu_work;
}; };
......
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