Skip to contentSkip to conversation

block: remove bio_check_ro

RFC PATCH New Liu Song 1 participant 1 message Aug 30, 2022 Block layer

lore
Share & tools
lore

Liu Song

author
#0 lore raw

RFC PATCH 1/1 block: remove bio_check_ro

From: Liu Song <[email protected]>

Partially revert make "bio_check_ro" only return false, and may generate at most one warning print.

From the commit log of a32e236eb9, it has been stated that it is compatible with the old lvm tool, so there is a high probability that this alarm will not really be noticed, so it is better to remove it directly.

---
 block/blk-core.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
block/blk-core.c +1 -16
index a0d1104..811c2dc 100644
@@ -487,20 +487,6 @@ static int __init fail_make_request_debugfs(void)
 late_initcall(fail_make_request_debugfs);
 #endif /* CONFIG_FAIL_MAKE_REQUEST */
 
-static inline bool bio_check_ro(struct bio *bio)
-{
-	if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev)) {
-		if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))
-			return false;
-		pr_warn("Trying to write to read-only block-device %pg\n",
-			bio->bi_bdev);
-		/* Older lvm-tools actually trigger this */
-		return false;
-	}
-
-	return false;
-}
-
 static noinline int should_fail_bio(struct bio *bio)
 {
 	if (should_fail_request(bdev_whole(bio->bi_bdev), bio->bi_iter.bi_size))
@@ -722,8 +708,7 @@ void submit_bio_noacct(struct bio *bio)
 
 	if (should_fail_bio(bio))
 		goto end_io;
-	if (unlikely(bio_check_ro(bio)))
-		goto end_io;
+
 	if (!bio_flagged(bio, BIO_REMAPPED)) {
 		if (unlikely(bio_check_eod(bio)))
 			goto end_io;
Signature · 1 line
1.8.3.1