linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
To: linux-ext4@vger.kernel.org
Cc: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Subject: [PATCH v5 05/20] jbd2: disable fast commits if journal is empty
Date: Mon,  9 Mar 2020 00:05:11 -0700	[thread overview]
Message-ID: <20200309070526.218202-5-harshadshirwadkar@gmail.com> (raw)
In-Reply-To: <20200309070526.218202-1-harshadshirwadkar@gmail.com>

If journal is empty, clear the fast commit flag from the on disk
superblock. With this optimization, chances of running into backward
compatibility issues are reduced.

Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
---
 fs/jbd2/journal.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 79f015f7bf54..f8f55d0814ea 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1482,6 +1482,7 @@ int jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid,
 static void jbd2_mark_journal_empty(journal_t *journal, int write_op)
 {
 	journal_superblock_t *sb = journal->j_superblock;
+	bool had_fast_commit = false;
 
 	BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
 	lock_buffer(journal->j_sb_buffer);
@@ -1495,9 +1496,20 @@ static void jbd2_mark_journal_empty(journal_t *journal, int write_op)
 
 	sb->s_sequence = cpu_to_be32(journal->j_tail_sequence);
 	sb->s_start    = cpu_to_be32(0);
+	if (jbd2_has_feature_fast_commit(journal)) {
+		/*
+		 * When journal is clean, no need to commit fast commit flag and
+		 * make file system incompatible with older kernels.
+		 */
+		jbd2_clear_feature_fast_commit(journal);
+		had_fast_commit = true;
+	}
 
 	jbd2_write_superblock(journal, write_op);
 
+	if (had_fast_commit)
+		jbd2_set_feature_fast_commit(journal);
+
 	/* Log is no longer empty */
 	write_lock(&journal->j_state_lock);
 	journal->j_flags |= JBD2_FLUSHED;
-- 
2.25.1.481.gfbce0eb801-goog


  parent reply	other threads:[~2020-03-09  7:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <tytso@mit.edu>
2020-03-09  7:05 ` [PATCH v5 01/20] ext4: update docs for fast commit feature Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 02/20] ext4: add handling for extended mount options Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 03/20] ext4, jbd2: add fast commit initialization routines Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 04/20] jbd2: add fast commit block tracker variables Harshad Shirwadkar
2020-03-09  7:05   ` Harshad Shirwadkar [this message]
2020-03-09  7:05   ` [PATCH v5 06/20] jbd2: fast commit main commit path changes Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 07/20] ext4: add generic diff tracking routines and range tracking Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 08/20] ext4: add directory entry tracking routines Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 09/20] ext4: add inode tracking and ineligible marking routines Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 10/20] ext4: break ext4_unlink() and ext4_link() Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 11/20] ext4: add fast commit track points Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 12/20] ext4: add fast commit on-disk format structs Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 13/20] jbd2: add new APIs for commit path of fast commits Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 14/20] ext4: main commit routine for " Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 15/20] jbd2: add fast commit recovery path support Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 16/20] ext4: fast commit recovery path preparation Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 17/20] ext4: add idempotent helpers to manipulate bitmaps Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 18/20] ext4: disable certain features in replay path Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 19/20] ext4: add fast commit " Harshad Shirwadkar
2020-03-09  7:05   ` [PATCH v5 20/20] ext4: add debug mount option to test fast commit replay Harshad Shirwadkar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200309070526.218202-5-harshadshirwadkar@gmail.com \
    --to=harshadshirwadkar@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).