lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220407124244.2014497-1-shaun.tancheff@hpe.com>
Date:   Thu,  7 Apr 2022 19:42:44 +0700
From:   Shaun Tancheff <shaun.tancheff@....com>
To:     shaun@...cheff.com, "Theodore Ts'o" <tytso@....edu>,
        Andreas Dilger <adilger.kernel@...ger.ca>,
        linux-ext4@...r.kernel.org (open list:EXT4 FILE SYSTEM),
        linux-kernel@...r.kernel.org (open list)
Cc:     Shaun Tancheff <shaun.tancheff@....com>
Subject: [PATCH] Shrink fast commit buffer when not used

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@....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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ