Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3959155rwe; Tue, 30 Aug 2022 01:49:46 -0700 (PDT) X-Google-Smtp-Source: AA6agR655eZmmnroqreycPGBY2xKsl9kGt1Ds7ZgVabCkc+6GICDft2h0FHDPJAMBJ5oAIegyYL3 X-Received: by 2002:a05:6402:4301:b0:448:d506:e2e5 with SMTP id m1-20020a056402430100b00448d506e2e5mr1034299edc.153.1661849385896; Tue, 30 Aug 2022 01:49:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661849385; cv=none; d=google.com; s=arc-20160816; b=n5egrWnMKqx/nIy0Z6esgdWByEET9329PfAKc/nqbfvArDNnNSJlVl5pKYJdBhci8I i0NITqwv0lf7GkFxx79zhmgRvtknwi+xxjH1RXDrfrWdEgSUiTpjnbsm890Ta7KM4vn4 3tjJoO9i9F1WSZr9pa0fHQLaPEJ1/6c3yDQqsBAlArQIGwI6y4DydG4Xaccm8d5dILTd T5lDgegDDAY+IJiKSnxR9VHu8YLC00Zw01vgmCKthvh1vLwzojDoOKSpgf1BNQHaH/yO mimQqv6Z27Xp4io7mPEb3cWk2+gkjkOMLPok3OCsTZKf4LD1FCfauwxXK+uPZpC7zb6p wt3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=K/rqpxgE7LWnGQ1imbVELWkOcCIKY2Eq1O/kcoNeTwQ=; b=GvJgRfP0V3FCZ4DlEZp46wDv0bOO+gnEWf+dHCvxkg5x3EHNxdM8gZq1UujDoMpxp3 LMuhIPMWQe14riuTrvFE+hR1TWux4qLScJZPxMASoBS9ZT/9nHQz5qqziB795E6s5o0K Tzav1jwl7DT8kQyHNR5VssjqCjIEmFxDX+Qgl9P1xCvfgiZzFIDkf9nIU/F1OWdkPnLe ZtYb5b9HN2xcxyfNhvKstTi8jKvI2qBW5uFwlqduXA4sKJTnVC4DR5XLedszivPghYu3 rmKP8XPE+0NjhojHMCekfRxxyot+krt6z2wN4VBfIjKHU/9r+ZnwpPZbQh8GBCfdvNIq ZdCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t31-20020a056402241f00b00447ea63026bsi7337786eda.266.2022.08.30.01.49.19; Tue, 30 Aug 2022 01:49:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231348AbiH3H7Z (ORCPT + 99 others); Tue, 30 Aug 2022 03:59:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231338AbiH3H7W (ORCPT ); Tue, 30 Aug 2022 03:59:22 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 973E1D25E7; Tue, 30 Aug 2022 00:59:17 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=liusong@linux.alibaba.com;NM=1;PH=DS;RN=3;SR=0;TI=SMTPD_---0VNk9CQA_1661846328; Received: from localhost(mailfrom:liusong@linux.alibaba.com fp:SMTPD_---0VNk9CQA_1661846328) by smtp.aliyun-inc.com; Tue, 30 Aug 2022 15:59:14 +0800 From: Liu Song To: axboe@kernel.dk Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH] block: remove bio_check_ro Date: Tue, 30 Aug 2022 15:58:48 +0800 Message-Id: <1661846328-107799-1-git-send-email-liusong@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Liu Song 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. Signed-off-by: Liu Song --- block/blk-core.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index a0d1104..811c2dc 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -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; -- 1.8.3.1