* [PATCH] bcachefs: clean up some inconsistent indenting
@ 2023-11-09 7:48 Jiapeng Chong
2023-11-09 13:56 ` Brian Foster
0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2023-11-09 7:48 UTC (permalink / raw)
To: kent.overstreet
Cc: bfoster, linux-bcachefs, linux-kernel, Jiapeng Chong, Abaci Robot
No functional modification involved.
fs/bcachefs/journal_io.c:1832 bch2_journal_write_pick_flush() warn: inconsistent indenting.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7207
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
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;
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] bcachefs: clean up some inconsistent indenting
2023-11-09 7:48 [PATCH] bcachefs: clean up some inconsistent indenting Jiapeng Chong
@ 2023-11-09 13:56 ` Brian Foster
0 siblings, 0 replies; 2+ messages in thread
From: Brian Foster @ 2023-11-09 13:56 UTC (permalink / raw)
To: Jiapeng Chong; +Cc: kent.overstreet, linux-bcachefs, linux-kernel, Abaci Robot
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 <abaci@linux.alibaba.com>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7207
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
> 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
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-09 13:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-09 7:48 [PATCH] bcachefs: clean up some inconsistent indenting Jiapeng Chong
2023-11-09 13:56 ` Brian Foster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox