From patchwork Mon Feb 6 09:55:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ChenXiaoSong X-Patchwork-Id: 53086 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2123039wrn; Mon, 6 Feb 2023 00:48:06 -0800 (PST) X-Google-Smtp-Source: AK7set8a0YX3xmhM1jJXQburqy2Z07Hz/uCt+WnDbOT5gZ8GCBbTgNlsOrsvvTIko8ZJKxYPM/Pb X-Received: by 2002:a17:902:f2d2:b0:199:15d6:48a6 with SMTP id h18-20020a170902f2d200b0019915d648a6mr2672359plc.55.1675673285964; Mon, 06 Feb 2023 00:48:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675673285; cv=none; d=google.com; s=arc-20160816; b=ICUylgDkMDaviGQq+SDi8yCkV7vyE4Az7PenTI+fgJok2X7H5q2EmeGLT+8TqUPY1A 4Mg9vC1spbPLappEsdU4Z0qCuElbIDMyC5VEHstBhz5LFunAqRVGBI+VYer02THko5dD QCgtfPOqN6+v7s4h2Wt7ifbCJAT4osYR1amIXsKfUDCvgbzMnL9a7hN58HN2hk2V088J C7lSJiqxiYUla1KeAqZj9oRtiMYp8NeFjgkPwCICJMNXEYMWxy4xvoub15CU0kei8nlT cq4p4+3Lx3HGymi/ewWnAOfWgoQdPmQZAKzjOSv4QJCQxGchrsLyWhsO0YyooZ7mP0+L hZ4w== 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=iDSgNqoI8iIveS7HH5zRSNXVaima4Lr4yDwxhMA8xi0=; b=JCarBX6U7UJSMr5sFaNyxQ57WWfxUwkzTXWG5txJpShCP9FWygtFzKXKM6n/GQAVsS tAm2DUMwRLEPGy16dU1JXkJVqCxMxTov7hHz0Pjel7IKJgnMWZoQajpS8CYWnb97wcsh p6C2WI5cHska5jHeGlJH3A9Eg2OdNabE+8dxrARnlNVEybmQ5KEM9613z6xv0Q1yhLg/ BX5R2RmV3ojFFyWc8ytv7g/NAEEKk79kCjkbYy9TWLk7I4Qxk7X7m3CuDhXBnv4z2Uip pCihaVLg8wz4Hik15QsztsXx6W9m/vqJ4094LbaaLJ3GkxIiKB08szV9F1G4oDYedK2m OfIw== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t2-20020a170902e84200b00198f5dab2besi7724033plg.517.2023.02.06.00.47.53; Mon, 06 Feb 2023 00:48:05 -0800 (PST) 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229841AbjBFIrN (ORCPT + 99 others); Mon, 6 Feb 2023 03:47:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjBFIrI (ORCPT ); Mon, 6 Feb 2023 03:47:08 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8B8C113E9 for ; Mon, 6 Feb 2023 00:46:57 -0800 (PST) Received: from kwepemm600015.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4P9KZQ1SMJznW2X; Mon, 6 Feb 2023 16:44:46 +0800 (CST) Received: from huawei.com (10.175.101.6) by kwepemm600015.china.huawei.com (7.193.23.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 6 Feb 2023 16:46:50 +0800 From: ChenXiaoSong To: , CC: , , Subject: [PATCH 1/2] gfs2: factor out __gfs2_ail1_empty() and gfs2_ail1_withdraw() Date: Mon, 6 Feb 2023 17:55:42 +0800 Message-ID: <20230206095543.539186-2-chenxiaosong2@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230206095543.539186-1-chenxiaosong2@huawei.com> References: <20230206095543.539186-1-chenxiaosong2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600015.china.huawei.com (7.193.23.52) 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757070791453116264?= X-GMAIL-MSGID: =?utf-8?q?1757070791453116264?= Factor out __gfs2_ail1_empty() and gfs2_ail1_withdraw() from gfs2_ail1_empty(). No functional change. Signed-off-by: ChenXiaoSong --- fs/gfs2/log.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 61323deb80bc..c62c914702ba 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -347,15 +347,7 @@ static int gfs2_ail1_empty_one(struct gfs2_sbd *sdp, struct gfs2_trans *tr, return active_count; } -/** - * gfs2_ail1_empty - Try to empty the ail1 lists - * @sdp: The superblock - * @max_revokes: If non-zero, add revokes where appropriate - * - * Tries to empty the ail1 lists, starting with the oldest first - */ - -static int gfs2_ail1_empty(struct gfs2_sbd *sdp, int max_revokes) +static int __gfs2_ail1_empty(struct gfs2_sbd *sdp, int max_revokes) { struct gfs2_trans *tr, *s; int oldest_tr = 1; @@ -372,10 +364,31 @@ static int gfs2_ail1_empty(struct gfs2_sbd *sdp, int max_revokes) ret = list_empty(&sdp->sd_ail1_list); spin_unlock(&sdp->sd_ail_lock); + return ret; +} + +static void gfs2_ail1_withdraw(struct gfs2_sbd *sdp) +{ if (test_bit(SDF_WITHDRAWING, &sdp->sd_flags)) { gfs2_lm(sdp, "fatal: I/O error(s)\n"); gfs2_withdraw(sdp); } +} + +/** + * gfs2_ail1_empty - Try to empty the ail1 lists + * @sdp: The superblock + * @max_revokes: If non-zero, add revokes where appropriate + * + * Tries to empty the ail1 lists, starting with the oldest first + */ + +static int gfs2_ail1_empty(struct gfs2_sbd *sdp, int max_revokes) +{ + int ret; + + ret = __gfs2_ail1_empty(sdp, max_revokes); + gfs2_ail1_withdraw(sdp); return ret; }