Skip to contentSkip to conversation

bcachefs: clean up some inconsistent indenting

PATCH In review Jiapeng Chong 2 participants 2 messages Nov 9, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcachefs: clean up some inconsistent indenting

No functional modification involved.

fs/bcachefs/journal_io.c:1832 bch2_journal_write_pick_flush() warn: inconsistent indenting.

---
 fs/bcachefs/journal_io.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
fs/bcachefs/journal_io.c +4 -7
index f4bc2cdbfdd7..72b0f3972170 100644
@@ -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;
Signature · 1 line
2.20.1.7.g153144c
#1 lore raw
Quoted 4 lines · Jiapeng Chong

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?

Quoted 15 lines
---
 fs/bcachefs/journal_io.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
fs/bcachefs/journal_io.c +0 -0
index f4bc2cdbfdd7..72b0f3972170 100644
@@ -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;
 

fs/bcachefs/journal_io.c static int bch2_journal_write_pick_flush(struct journal *j, struct journal_buf * · line 1829

Quoted 10 lines
fs/bcachefs/journal_io.c +4 -6
-	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

Quoted 11 lines
fs/bcachefs/journal_io.c +0 -1
 		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;
Signature · 1 line
2.20.1.7.g153144c