Skip to contentSkip to conversation

block: don't call should_fail_request() for !CONFIG_FAIL_MAKE_REQUEST

PATCH In review Jens Axboe 2 participants 3 messages Oct 5, 2021 Block layer

lore
Share & tools
lore

Jens Axboe

author maintainer
#0 lore raw

PATCH 1/1 block: don't call should_fail_request() for !CONFIG_FAIL_MAKE_REQUEST

Unnecessary function call, if we don't have that specific configuration option enabled.

---

block/blk-core.c +2 -0
index 5454db2fa263..a267f11f55cb 100644
@@ -697,8 +697,10 @@ static inline bool bio_check_ro(struct bio *bio)
 
 static noinline int should_fail_bio(struct bio *bio)
 {
+#ifdef CONFIG_FAIL_MAKE_REQUEST
 	if (should_fail_request(bdev_whole(bio->bi_bdev), bio->bi_iter.bi_size))
 		return -EIO;
+#endif
 	return 0;
 }
 ALLOW_ERROR_INJECTION(should_fail_bio, ERRNO);
Signature · 1 line
Jens Axboe
#1 lore raw
Quoted 12 lines · Jens Axboe

Unnecessary function call, if we don't have that specific configuration option enabled.

---

block/blk-core.c +0 -0
index 5454db2fa263..a267f11f55cb 100644

block/blk-core.c static inline bool bio_check_ro(struct bio *bio) · line 706

Quoted 10 lines
block/blk-core.c +2 -0
@@ -697,8 +697,10 @@ static inline bool bio_check_ro(struct bio *bio)
 
  static noinline int should_fail_bio(struct bio *bio)
  {
+#ifdef CONFIG_FAIL_MAKE_REQUEST
  	if (should_fail_request(bdev_whole(bio->bi_bdev), bio->bi_iter.bi_size))
  		return -EIO;
+#endif
  	return 0;
  }
  ALLOW_ERROR_INJECTION(should_fail_bio, ERRNO);

Has the performance impact of this patch been measured? I'm asking because I found the following in blk-core.c:

#ifdef CONFIG_FAIL_MAKE_REQUEST
[ ... ]
#else /* CONFIG_FAIL_MAKE_REQUEST */
static inline bool should_fail_request(struct block_device *part,
unsigned int bytes)

{
	return false;
}

#endif /* CONFIG_FAIL_MAKE_REQUEST */

Thanks,

Bart.

author maintainer
#2 lore raw
Quoted 32 lines · Bart Van Assche
Quoted 12 lines · Jens Axboe

Unnecessary function call, if we don't have that specific configuration option enabled.

---

block/blk-core.c +0 -0
index 5454db2fa263..a267f11f55cb 100644

block/blk-core.c static inline bool bio_check_ro(struct bio *bio) · line 706

Quoted 10 lines
block/blk-core.c +2 -0
@@ -697,8 +697,10 @@ static inline bool bio_check_ro(struct bio *bio)
 
  static noinline int should_fail_bio(struct bio *bio)
  {
+#ifdef CONFIG_FAIL_MAKE_REQUEST
  	if (should_fail_request(bdev_whole(bio->bi_bdev), bio->bi_iter.bi_size))
  		return -EIO;
+#endif
  	return 0;
  }
  ALLOW_ERROR_INJECTION(should_fail_bio, ERRNO);

Has the performance impact of this patch been measured? I'm asking because I found the following in blk-core.c:

#ifdef CONFIG_FAIL_MAKE_REQUEST
[ ... ]
#else /* CONFIG_FAIL_MAKE_REQUEST */
static inline bool should_fail_request(struct block_device *part,
unsigned int bytes)

Quoted 4 lines
{
	return false;
}

#endif /* CONFIG_FAIL_MAKE_REQUEST */

True, might be a leftover from some other experimentation. Looks like we can just ignore that patch.

Signature · 1 line
Jens Axboe