mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shaun Tancheff <shaun.tancheff@hpe.com>
To: shaun@tancheff.com, "Theodore Ts'o" <tytso@mit.edu>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	linux-ext4@vger.kernel.org (open list:EXT4 FILE SYSTEM),
	linux-kernel@vger.kernel.org (open list)
Cc: Shaun Tancheff <shaun.tancheff@hpe.com>
Subject: [PATCH] Shrink fast commit buffer when not used
Date: Thu,  7 Apr 2022 19:42:44 +0700	[thread overview]
Message-ID: <20220407124244.2014497-1-shaun.tancheff@hpe.com> (raw)

Shrink the fast-commit buffer when the feature is not
enabled. By default the fast-commit buffer will allocate 256
blocks if s_num_fc_blks is 0. Set s_num_fc_blks to a smaller
value (> 0) to avoid allocating a large unused buffer, this
also makes more journal credits available when fast commit
is not used.

Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
---
 fs/ext4/super.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 81749eaddf4c..d2df10dc7cc3 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4222,6 +4222,14 @@ static int count_overhead(struct super_block *sb, ext4_group_t grp,
 		ext4_count_free(buf, EXT4_CLUSTERS_PER_GROUP(sb) / 8);
 }
 
+static void strink_journal_fc_buffer(struct super_block *ext4_sb)
+{
+	journal_t *journal = EXT4_SB(ext4_sb)->s_journal;
+	journal_superblock_t *sb = journal->j_superblock;
+
+	sb->s_num_fc_blks = cpu_to_be32(8);
+}
+
 /*
  * Compute the overhead and stash it in sbi->s_overhead
  */
@@ -5189,6 +5197,13 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
 		goto failed_mount_wq;
 	}
 
+	/* Since fast-commit is disabled, shrink it's dedicated memory
+	 * and it's share of the journal space so we can use the extra
+	 * credits
+	 */
+	if (!test_opt2(sb, JOURNAL_FAST_COMMIT))
+		strink_journal_fc_buffer(sb);
+
 	if (!set_journal_csum_feature_set(sb)) {
 		ext4_msg(sb, KERN_ERR, "Failed to set journal checksum "
 			 "feature set");
-- 
2.32.0


             reply	other threads:[~2022-04-07 12:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 12:42 Shaun Tancheff [this message]
2022-05-11 16:33 ` Theodore Ts'o

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=20220407124244.2014497-1-shaun.tancheff@hpe.com \
    --to=shaun.tancheff@hpe.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shaun@tancheff.com \
    --cc=tytso@mit.edu \
    /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

all inboxes | Powered by JetHome®