summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-11-23 18:28:47 +0300
committerJens Axboe <axboe@kernel.dk>2020-12-02 00:53:40 +0300
commitb309e9936347232c724eaa13f70533128b4864e9 (patch)
tree605597177f339d9934dfdfa7f25a0a947fd356e7
parent1bdd5ae0251d678488dffcf455d4633c2beef1bc (diff)
downloadlinux-b309e9936347232c724eaa13f70533128b4864e9.tar.xz
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: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/blk-core.c3
-rw-r--r--block/genhd.c4
-rw-r--r--include/linux/blk_types.h3
-rw-r--r--include/linux/genhd.h3
4 files changed, 7 insertions, 6 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 9a3793d5ce38..9121390be97a 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -668,7 +668,8 @@ __setup("fail_make_request=", setup_fail_make_request);
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)
diff --git a/block/genhd.c b/block/genhd.c
index 0bd7026cee62..f9c957739d4b 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1292,7 +1292,7 @@ ssize_t part_fail_show(struct device *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,
@@ -1303,7 +1303,7 @@ ssize_t part_fail_store(struct device *dev,
int i;
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;
}
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index c0591e52d7d7..b237f1e40814 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -52,6 +52,9 @@ struct block_device {
struct super_block *bd_fsfreeze_sb;
struct partition_meta_info *bd_meta_info;
+#ifdef CONFIG_FAIL_MAKE_REQUEST
+ bool bd_make_it_fail;
+#endif
} __randomize_layout;
#define bdev_whole(_bdev) \
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index b4a5c05593b9..349cf6403ccd 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -56,9 +56,6 @@ struct hd_struct {
struct block_device *bdev;
struct device __dev;
int policy, partno;
-#ifdef CONFIG_FAIL_MAKE_REQUEST
- int make_it_fail;
-#endif
struct rcu_work rcu_work;
};