From patchwork Tue Oct 19 12:39:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "yebin (H)" X-Patchwork-Id: 1543274 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HYY075NxWz9sPB for ; Tue, 19 Oct 2021 23:27:03 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4HYY073Ndnz4xd8 for ; Tue, 19 Oct 2021 23:27:03 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4HYY073MJjz4xd9; Tue, 19 Oct 2021 23:27:03 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4HYY073JTPz4xd8 for ; Tue, 19 Oct 2021 23:27:03 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235573AbhJSM3N (ORCPT ); Tue, 19 Oct 2021 08:29:13 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:25168 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230513AbhJSM3M (ORCPT ); Tue, 19 Oct 2021 08:29:12 -0400 Received: from dggeme754-chm.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4HYXy05gZHz1DH8W; Tue, 19 Oct 2021 20:25:12 +0800 (CST) Received: from huawei.com (10.175.127.227) by dggeme754-chm.china.huawei.com (10.3.19.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.15; Tue, 19 Oct 2021 20:26:57 +0800 From: Ye Bin To: , , CC: , , Ye Bin Subject: [PATCH -next v4 2/3] ext4: remove useless bh_check variable Date: Tue, 19 Oct 2021 20:39:30 +0800 Message-ID: <20211019123931.1545295-3-yebin10@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211019123931.1545295-1-yebin10@huawei.com> References: <20211019123931.1545295-1-yebin10@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggeme754-chm.china.huawei.com (10.3.19.100) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Since we initialize 'bh_check' to NULL and pass it to read_mmp_block(), that function will just call sb_getblk() which will just return the buffer_head we have in 'bh'. So just remove the pointless 'bh_check' variable and use 'bh' directly. Signed-off-by: Ye Bin Reviewed-by: Jan Kara --- fs/ext4/mmp.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c index 97d5a8136eb2..9788c617e593 100644 --- a/fs/ext4/mmp.c +++ b/fs/ext4/mmp.c @@ -195,10 +195,7 @@ static int kmmpd(void *data) */ diff = jiffies - last_update_time; if (diff > mmp_check_interval * HZ) { - struct buffer_head *bh_check = NULL; - struct mmp_struct *mmp_check; - - retval = read_mmp_block(sb, &bh_check, mmp_block); + retval = read_mmp_block(sb, &bh, mmp_block); if (retval) { ext4_error_err(sb, -retval, "error reading MMP data: %d", @@ -206,20 +203,18 @@ static int kmmpd(void *data) goto wait_to_exit; } - mmp_check = (struct mmp_struct *)(bh_check->b_data); - if (seq != mmp_check->mmp_seq || - memcmp(nodename, mmp_check->mmp_nodename, - sizeof(mmp->mmp_nodename))) { - dump_mmp_msg(sb, mmp_check, + mmp = (struct mmp_struct *)(bh->b_data); + if (seq != le32_to_cpu(mmp->mmp_seq) || + memcmp(nodename, mmp->mmp_nodename, + sizeof(nodename))) { + dump_mmp_msg(sb, mmp, "Error while updating MMP info. " "The filesystem seems to have been" " multiply mounted."); ext4_error_err(sb, EBUSY, "abort"); - put_bh(bh_check); retval = -EBUSY; goto wait_to_exit; } - put_bh(bh_check); } /*