| 1 |
|
| 2 | #ifndef _BLK_ERROR_INJECTION_H
|
| 3 | #define _BLK_ERROR_INJECTION_H 1
|
| 4 |
|
| 5 | #include <linux/jump_label.h>
|
| 6 |
|
| 7 | DECLARE_STATIC_KEY_FALSE(blk_error_injection_enabled);
|
| 8 |
|
| 9 | void blk_error_injection_init(struct gendisk *disk);
|
| 10 | void blk_error_injection_exit(struct gendisk *disk);
|
| 11 | bool __blk_error_inject(struct bio *bio);
|
| 12 | static inline bool blk_error_inject(struct bio *bio)
|
| 13 | {
|
| 14 | if (IS_ENABLED(CONFIG_BLK_ERROR_INJECTION) &&
|
| 15 | static_branch_unlikely(&blk_error_injection_enabled) &&
|
| 16 | test_bit(GD_ERROR_INJECT, &bio->bi_bdev->bd_disk->state))
|
| 17 | return __blk_error_inject(bio);
|
| 18 | return false;
|
| 19 | }
|
| 20 |
|
| 21 | #endif
|