Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp696107rwe; Thu, 1 Sep 2022 06:25:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR5tFnidCrb5b8VqKkfFaJIQOGXNKWZjDSj6vC8xKfwhyBk+XVxHPJQ5HCUbTLTW1YO+GAUr X-Received: by 2002:a17:907:a07c:b0:73d:dc49:e8e7 with SMTP id ia28-20020a170907a07c00b0073ddc49e8e7mr22357327ejc.393.1662038705856; Thu, 01 Sep 2022 06:25:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662038705; cv=none; d=google.com; s=arc-20160816; b=kzPWb5ZFbpqay4XX65/VIcW91mq9rFNQkLaqvmlABUt9Ec5A3cMuMZIjF0y5/IBSO8 k8POTu5VssWLy+d+/e0s3O23NWKamXtbFAxG/HGTwvTCeNaXPeiTGVVCEQF6zSUfzFkx 4rOihiw5cthXExHH4kJNL8go9T8kIa/K/z2DEqHhft+JRvUrzpvyXV04efQMwvkZsTRb We6AdrylES9xsP2Nn+w+PNl4nHkxOOdT7GNfPrRo0cHlord5p29ZkaGUM/KbHXsf/duW 9QKvyOhqf4ARDm+x7C9ktqIK+KKWhBqmPWzAzISwmjUyNSZVCe6hg1nn0XYA+2GUxl3i QABA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=5Q8KFiHSGMocJg0MM44StQx9k+FaFrIGkf2J3i+80PU=; b=MnI7b/fRi8BeSk/q7AburV3Zc8zlrygqCqlOo8dlh9UVkxFfY+/a12FMvZwgkrec/l 9MuxfXeAsjhBKk4Nqoj8fdWEoxsZhg0+8y2jfbTMbopG+GNJsIdRBpHpvEyf9BVjgwTj ffTnes7exTCFkiQA+XM5AbJ7Yhx7gli83ptfAtlU8QnBVrr7yfkmy0xTX722E+4u3RuC Hd/89ZByPOpb8kicJJ2MlYowGVsVGmqG4llNHjauOvtk0hprHmD5a+Q7nZyf2zPptLsU 5VrF/4XkjPGaYXuIw7OLJKDjUlQpYnvU2oPR1dGi8cwRLiVN//3Ivlv5r6fmZg650mGA ORdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz17-20020a1709077d9100b0073da5c8de1asi14025671ejc.178.2022.09.01.06.24.40; Thu, 01 Sep 2022 06:25:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234222AbiIANYQ (ORCPT + 99 others); Thu, 1 Sep 2022 09:24:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234228AbiIANYJ (ORCPT ); Thu, 1 Sep 2022 09:24:09 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29B3D1CB3A; Thu, 1 Sep 2022 06:23:59 -0700 (PDT) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MJMBd4yCxznTkK; Thu, 1 Sep 2022 21:21:29 +0800 (CST) Received: from huawei.com (10.175.127.227) by canpemm500005.china.huawei.com (7.192.104.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 1 Sep 2022 21:23:56 +0800 From: Zhang Yi To: , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH v2 00/14] fs/buffer: remove ll_rw_block() Date: Thu, 1 Sep 2022 21:34:51 +0800 Message-ID: <20220901133505.2510834-1-yi.zhang@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500005.china.huawei.com (7.192.104.229) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-ext4@vger.kernel.org Changes since v1: - Remove redundant uptodate check in __bh_read(), use bh_uptodate_or_lock() in bh_read() and bh_read_nowait(). - Improve the lock order in __bh_read_batch(). - Add return value 1 to bh_read(), indicate the buffer has been already uptodate and no need to submit read IO, ext2 code in patch 13 need to know this case. - Remove bh_read_locked() helper. - Exchange the parameter sequence of bhs[] array and it's number in bh_read[*]_batch() helpers. v1: https://lore.kernel.org/linux-fsdevel/20220831072111.3569680-1-yi.zhang@huawei.com/T/#t Thanks, Yi. ll_rw_block() will skip locked buffer before submitting IO, it assumes that locked buffer means it is under IO. This assumption is not always true because we cannot guarantee every buffer lock path would submit IO. After commit 88dbcbb3a484 ("blkdev: avoid migration stalls for blkdev pages"), buffer_migrate_folio_norefs() becomes one exceptional case, and there may be others. So ll_rw_block() is not safe on the sync read path, we could get false positive EIO return value when filesystem reading metadata. It seems that it could be only used on the readahead path. Unfortunately, many filesystem misuse the ll_rw_block() on the sync read path. This patch set just remove ll_rw_block() and add new friendly helpers, which could prevent false positive EIO on the read metadata path. Thanks for the suggestion from Jan, the original discussion is at [1]. patch 1: remove unused helpers in fs/buffer.c patch 2: add new bh_read_[*] helpers patch 3-11: remove all ll_rw_block() calls in filesystems patch 12-14: do some leftover cleanups. [1]. https://lore.kernel.org/linux-mm/20220825080146.2021641-1-chengzhihao1@huawei.com/ Zhang Yi (14): fs/buffer: remove __breadahead_gfp() fs/buffer: add some new buffer read helpers fs/buffer: replace ll_rw_block() gfs2: replace ll_rw_block() isofs: replace ll_rw_block() jbd2: replace ll_rw_block() ntfs3: replace ll_rw_block() ocfs2: replace ll_rw_block() reiserfs: replace ll_rw_block() udf: replace ll_rw_block() ufs: replace ll_rw_block() fs/buffer: remove ll_rw_block() helper ext2: replace bh_submit_read() helper with bh_read_locked() fs/buffer: remove bh_submit_read() helper fs/buffer.c | 154 +++++++++++++++--------------------- fs/ext2/balloc.c | 7 +- fs/gfs2/meta_io.c | 7 +- fs/gfs2/quota.c | 8 +- fs/isofs/compress.c | 2 +- fs/jbd2/journal.c | 15 ++-- fs/jbd2/recovery.c | 16 ++-- fs/ntfs3/inode.c | 7 +- fs/ocfs2/aops.c | 2 +- fs/ocfs2/super.c | 4 +- fs/reiserfs/journal.c | 11 +-- fs/reiserfs/stree.c | 4 +- fs/reiserfs/super.c | 4 +- fs/udf/dir.c | 2 +- fs/udf/directory.c | 2 +- fs/udf/inode.c | 8 +- fs/ufs/balloc.c | 12 +-- include/linux/buffer_head.h | 48 ++++++++--- 18 files changed, 146 insertions(+), 167 deletions(-) -- 2.31.1