From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C2F21DDFC for ; Thu, 9 Nov 2023 13:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bwRicAMo" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1B542D65 for ; Thu, 9 Nov 2023 05:56:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699538172; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=GBKXQXdWCQSxpfyjkGdZqTa17OKF2eWiu4DGtcY18AI=; b=bwRicAMoO1j289dvaiUalDk9QDf6d59HI4vugtOD86FUPAuCrqVyxghSkVriKxwROXuyiq 9NEsHqKnZ/z30ZOkJt79fwwe6devBThqIue21oP8c2cxV1QIbrJ43NSmtrDgEjtkpeX/X3 WVdnx3evHhRHxnBRHeC+YPnj6Mxwlos= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-624-OB4whbXaNJujgmgHF6W0AQ-1; Thu, 09 Nov 2023 08:56:06 -0500 X-MC-Unique: OB4whbXaNJujgmgHF6W0AQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4CCA982DFA2; Thu, 9 Nov 2023 13:56:06 +0000 (UTC) Received: from bfoster (unknown [10.22.8.140]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0D287492BE7; Thu, 9 Nov 2023 13:56:06 +0000 (UTC) Date: Thu, 9 Nov 2023 08:56:45 -0500 From: Brian Foster To: Jiapeng Chong Cc: kent.overstreet@linux.dev, linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org, Abaci Robot Subject: Re: [PATCH] bcachefs: clean up some inconsistent indenting Message-ID: References: <20231109074815.117232-1-jiapeng.chong@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-bcachefs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231109074815.117232-1-jiapeng.chong@linux.alibaba.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 On Thu, Nov 09, 2023 at 03:48:15PM +0800, Jiapeng Chong wrote: > No functional modification involved. > > fs/bcachefs/journal_io.c:1832 bch2_journal_write_pick_flush() warn: inconsistent indenting. > What does inconsistent indenting mean? Is this complaining about the conditional logic or the w->noflush assignment? > Reported-by: Abaci Robot > Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7207 > Signed-off-by: Jiapeng Chong > --- > fs/bcachefs/journal_io.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) > > diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c > index f4bc2cdbfdd7..72b0f3972170 100644 > --- a/fs/bcachefs/journal_io.c > +++ b/fs/bcachefs/journal_io.c > @@ -1823,16 +1823,13 @@ static int bch2_journal_write_pick_flush(struct journal *j, struct journal_buf * > if (error && test_bit(JOURNAL_NEED_FLUSH_WRITE, &j->flags)) > return -EIO; > > - if (error || > - w->noflush || > - (!w->must_flush && > - (jiffies - j->last_flush_write) < msecs_to_jiffies(c->opts.journal_flush_delay) && > - test_bit(JOURNAL_MAY_SKIP_FLUSH, &j->flags))) { > - w->noflush = true; > + if (error || w->noflush || (!w->must_flush && > + (jiffies - j->last_flush_write) < msecs_to_jiffies(c->opts.journal_flush_delay) && > + test_bit(JOURNAL_MAY_SKIP_FLUSH, &j->flags))) { > + w->noflush = true; This line does look whitespace damaged (and I prefer the style with the first two branches of the if statement on the same line (i.e. 'if (error || w->noflush ||'), but breaking up the third bit looks wrong to me. The purpose of the indentation of the third part of the if statement is to highlight the compound nature of it. I.e., explicitly starting on a newline with the same indentation level as the previous statements, followed by further indentation on the subsequent lines that are sub-components of that statement helps highlight the logic and make the code more readable at a glance. So IOW, I suspect this could look something like: if (error || w->noflush || (!w->must_flush && (jiffies - j->last_flush_write) < msecs_to_jiffies(c->opts.journal_flush_delay) && test_bit(JOURNAL_MAY_SKIP_FLUSH, &j->flags))) { w->noflush = true; ... } else { ... Hm? Brian > SET_JSET_NO_FLUSH(w->data, true); > w->data->last_seq = 0; > w->last_seq = 0; > - > j->nr_noflush_writes++; > } else { > j->last_flush_write = jiffies; > -- > 2.20.1.7.g153144c > >