Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp112654pxk; Thu, 24 Sep 2020 00:33:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz009PwjWXMsMGCbmrDgIGNYHonR5NAxqqFFMM9l1N6e3Mv9zxQU+oUUIyIsvV+m5vln0l+ X-Received: by 2002:a50:8524:: with SMTP id 33mr3319554edr.123.1600932818451; Thu, 24 Sep 2020 00:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600932818; cv=none; d=google.com; s=arc-20160816; b=mrhvRugED/gAog2GkPobgSrp4QLY13DQINaBhLz4UsEq+hBK+2ChKYMbe0wiyfiErJ dJX1u2dY4EJdVxT4yxhdics1/H05CPMFkHll8cY0RBvjwrNwxQh5wuXmVgiW5mbAUueK XOIirOo0exq6hfIhAtgXGt7nlujCGrCLIk2uBWl8LYH2h5Dla7qJQU8bg1AU1MhVngw9 F80qpAo8zF6OAegUiK8YDGNeMh3/hAu0kMX60N3c4QrOeADeCxsG3ePrc9S4cBygXtSA iqCwmSr60GuyV1Mw2a2c2bZ7ham67R3Cw9++6qBuk0dT0Vepb3lknVUs6uHNDwCdtYJv aNXA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=f97TYg4cQfE5XbqePzYtNA2KQXlSY200EVj78MdMsoU=; b=VS5tFyBrkNif0jBIGJT1VQSodn2dXC/oV5gCYpVgXrUteLp43i8Pu5NlFjHn5oqNHi tSeXNpIuOQsqYI4i4KGM+Gtq/u9cwmy5Uamc95AbCvv1tlLnVVnEFckM00h5wqLqXetI HhyuHnv+HMulhb/QLh9yr9q2eqQm28q5K+bqR8cuRq7H4qnP9tR5Dj9jlwiYvb7vLq4T E1lFiU/J8x7P5yMHik9gNnX9wZyqSfUCwsUJXqu8Mq6MCIMpDVgXYzrkMMtaKBZSmPp8 IGAL5LtrEjLMeeTO6erLvdYrxfeJT6GcNxcHFu6X8Y1IdOReozyaukNuWc9itcy6OTFn mHhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o60si1428431edd.426.2020.09.24.00.33.15; Thu, 24 Sep 2020 00:33:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727120AbgIXHcx (ORCPT + 99 others); Thu, 24 Sep 2020 03:32:53 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:14224 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727145AbgIXHcv (ORCPT ); Thu, 24 Sep 2020 03:32:51 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 66FBF3692371284CC3C3; Thu, 24 Sep 2020 15:32:47 +0800 (CST) Received: from huawei.com (10.175.127.227) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Thu, 24 Sep 2020 15:32:39 +0800 From: "zhangyi (F)" To: CC: , , , Subject: [PATCH v2 5/7] ext4: introduce ext4_sb_breadahead_unmovable() to replace sb_breadahead_unmovable() Date: Thu, 24 Sep 2020 15:33:35 +0800 Message-ID: <20200924073337.861472-6-yi.zhang@huawei.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200924073337.861472-1-yi.zhang@huawei.com> References: <20200924073337.861472-1-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org If we readahead inode tables in __ext4_get_inode_loc(), it may bypass buffer_write_io_error() check, so introduce ext4_sb_breadahead_unmovable() to handle this special case. This patch also replace sb_breadahead_unmovable() in ext4_fill_super() for the sake of unification. Signed-off-by: zhangyi (F) --- fs/ext4/ext4.h | 1 + fs/ext4/inode.c | 2 +- fs/ext4/super.c | 12 +++++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 75b46300a65c..6da1419f6ee7 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -2829,6 +2829,7 @@ extern void ext4_read_bh_nowait(struct buffer_head *bh, int op_flags, extern int ext4_read_bh(struct buffer_head *bh, int op_flags, bh_end_io_t *end_io); extern int ext4_read_bh_lock(struct buffer_head *bh, int op_flags, bool wait); +extern void ext4_sb_breadahead_unmovable(struct super_block *sb, sector_t block); extern int ext4_seq_options_show(struct seq_file *seq, void *offset); extern int ext4_calculate_overhead(struct super_block *sb); extern void ext4_superblock_csum_set(struct super_block *sb); diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 171df289ef7e..e106d03e4b77 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4358,7 +4358,7 @@ static int __ext4_get_inode_loc(struct inode *inode, if (end > table) end = table; while (b <= end) - sb_breadahead_unmovable(sb, b++); + ext4_sb_breadahead_unmovable(sb, b++); } /* diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 0adba4871f57..b24e68eff48d 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -229,6 +229,16 @@ ext4_sb_bread(struct super_block *sb, sector_t block, int op_flags) return bh; } +void ext4_sb_breadahead_unmovable(struct super_block *sb, sector_t block) +{ + struct buffer_head *bh = sb_getblk_gfp(sb, block, 0); + + if (likely(bh)) { + ext4_read_bh_lock(bh, REQ_RAHEAD, false); + brelse(bh); + } +} + static int ext4_verify_csum_type(struct super_block *sb, struct ext4_super_block *es) { @@ -4545,7 +4555,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) /* Pre-read the descriptors into the buffer cache */ for (i = 0; i < db_count; i++) { block = descriptor_loc(sb, logical_sb_block, i); - sb_breadahead_unmovable(sb, block); + ext4_sb_breadahead_unmovable(sb, block); } for (i = 0; i < db_count; i++) { -- 2.25.4