Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp302230pxy; Wed, 21 Apr 2021 03:28:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFyEA+1wEsX+Vt430E9XFpNJSQqwGuaVbbsOAHuwgURCFkN1RZ4PGA9qbx3QXHPWDnQidd X-Received: by 2002:aa7:c7cc:: with SMTP id o12mr38220224eds.291.1619000893101; Wed, 21 Apr 2021 03:28:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619000893; cv=none; d=google.com; s=arc-20160816; b=Z3KIzqjh3ptTByK1P5wCB9iifye5QboHpoekBz6FELXMuudTJFyoDW3DYt8HjUWh0i fAK3CtjO6tlm6y3vm5QI3Wd7R8Jv7KlFjn0TmomAgQOWo+w1zoGp3j4lg9Gk9tcaEY52 F5xwSKYeDG0HGN7au5yu9BUFmfHCMfVwAC0dEBq5Lau7A4CyDrb2h4RCRD9Jj60jEd64 44EwFR6xratkl7BLVeUG2HhqU0f7fbV0n8aWaKxfNr/pZmlETevAUTYfneJHSi57SQlQ NnMaWfQmkfGzXUKM/aglSEIdjj/TnxUrtK1LoqfIH85ygv24hqTqzZSgYDu/uoNHIbOp ocsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=JpaTbeqROJryva6FF89yukZFGppLyeH8bs8MuEgqNLs=; b=l2q3qEYUjPITV5imx3nagH8fZcLVlq6sm6+lU+zOYS43Lxq5A9hY5rJlCPjSGGE4k8 rUpGODUBqn6EzYd0YULPoFG2mGKpBO15GZOJXgZzYzsW12NYgSW/7TNys0ufR2RsmH0c /g0UDgKf6xYyb3A5UDLH/NyAQRbVKebe/T0Pzc1w7fb+XKPfe31VTRauNrJcg147Kywy 9Cu0GxtTfHKfWEGJJ0MSogaQUMLQTdSPXeN/DVvmR9DjfCUJTDj2QBwBFAPl8VoXSjT9 bjcKwmSMV0BYZsGa0V9vb1KT17wmekbB/Qtt/4p6yvKovEyzz8CoYSh+Gc1B9YsxDbfT sLrg== 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 r26si1451726ejc.505.2021.04.21.03.27.45; Wed, 21 Apr 2021 03:28:13 -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 S236936AbhDUKC2 (ORCPT + 99 others); Wed, 21 Apr 2021 06:02:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:43666 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232442AbhDUKC1 (ORCPT ); Wed, 21 Apr 2021 06:02:27 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id BC2BEB304; Wed, 21 Apr 2021 10:01:53 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 548CB1F2B69; Wed, 21 Apr 2021 12:01:53 +0200 (CEST) Date: Wed, 21 Apr 2021 12:01:53 +0200 From: Jan Kara To: Zhang Yi Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, yukuai3@huawei.com Subject: Re: [RFC PATCH v2 1/7] jbd2: remove the out label in __jbd2_journal_remove_checkpoint() Message-ID: <20210421100153.GQ8706@quack2.suse.cz> References: <20210414134737.2366971-1-yi.zhang@huawei.com> <20210414134737.2366971-2-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210414134737.2366971-2-yi.zhang@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed 14-04-21 21:47:31, Zhang Yi wrote: > The 'out' lable just return the 'ret' value and seems not required, so > remove this label and switch to return appropriate value immediately. > This patch also do some minor cleanup, no logical change. > > Signed-off-by: Zhang Yi Looks good. Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/jbd2/checkpoint.c | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > > diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c > index 63b526d44886..bf5511d19ac5 100644 > --- a/fs/jbd2/checkpoint.c > +++ b/fs/jbd2/checkpoint.c > @@ -564,13 +564,13 @@ int __jbd2_journal_remove_checkpoint(struct journal_head *jh) > struct transaction_chp_stats_s *stats; > transaction_t *transaction; > journal_t *journal; > - int ret = 0; > > JBUFFER_TRACE(jh, "entry"); > > - if ((transaction = jh->b_cp_transaction) == NULL) { > + transaction = jh->b_cp_transaction; > + if (!transaction) { > JBUFFER_TRACE(jh, "not on transaction"); > - goto out; > + return 0; > } > journal = transaction->t_journal; > > @@ -579,9 +579,9 @@ int __jbd2_journal_remove_checkpoint(struct journal_head *jh) > jh->b_cp_transaction = NULL; > jbd2_journal_put_journal_head(jh); > > - if (transaction->t_checkpoint_list != NULL || > - transaction->t_checkpoint_io_list != NULL) > - goto out; > + /* Is this transaction empty? */ > + if (transaction->t_checkpoint_list || transaction->t_checkpoint_io_list) > + return 0; > > /* > * There is one special case to worry about: if we have just pulled the > @@ -593,10 +593,12 @@ int __jbd2_journal_remove_checkpoint(struct journal_head *jh) > * See the comment at the end of jbd2_journal_commit_transaction(). > */ > if (transaction->t_state != T_FINISHED) > - goto out; > + return 0; > > - /* OK, that was the last buffer for the transaction: we can now > - safely remove this transaction from the log */ > + /* > + * OK, that was the last buffer for the transaction, we can now > + * safely remove this transaction from the log. > + */ > stats = &transaction->t_chp_stats; > if (stats->cs_chp_time) > stats->cs_chp_time = jbd2_time_diff(stats->cs_chp_time, > @@ -606,9 +608,7 @@ int __jbd2_journal_remove_checkpoint(struct journal_head *jh) > > __jbd2_journal_drop_transaction(journal, transaction); > jbd2_journal_free_transaction(transaction); > - ret = 1; > -out: > - return ret; > + return 1; > } > > /* > -- > 2.25.4 > -- Jan Kara SUSE Labs, CR