Re: [PATCH 1/5] ext4: Make mballoc try target group first even with mb_optimize_scan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed 21-09-22 22:52:34, Theodore Ts'o wrote:
> On Thu, 8 Sep 2022 11:21:24 +0200, Jan Kara wrote:
> > One of the side-effects of mb_optimize_scan was that the optimized
> > functions to select next group to try were called even before we tried
> > the goal group. As a result we no longer allocate files close to
> > corresponding inodes as well as we don't try to expand currently
> > allocated extent in the same group. This results in reaim regression
> > with workfile.disk workload of upto 8% with many clients on my test
> > machine:
> > 
> > [...]
> 
> Applied, thanks!
> 
> [1/5] ext4: Make mballoc try target group first even with mb_optimize_scan
>       commit: 4fca50d440cc5d4dc570ad5484cc0b70b381bc2a
> [2/5] ext4: Avoid unnecessary spreading of allocations among groups
>       commit: 1940265ede6683f6317cba0d428ce6505eaca944
> [3/5] ext4: Make directory inode spreading reflect flexbg size
>       commit: 613c5a85898d1cd44e68f28d65eccf64a8ace9cf
> [4/5] ext4: Use locality group preallocation for small closed files
>       commit: a9f2a2931d0e197ab28c6007966053fdababd53f
> [5/5] ext4: Use buckets for cr 1 block scan instead of rbtree
>       commit: 83e80a6e3543f37f74c8e48a5f305b054b65ce2a

Thanks Ted! I just have locally a small fixup to the series that was reported
by Smatch. It is attached, either fold it into the last patch or just merge
it as a separate patch. Thanks!

								Honza
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR
>From 8885b11fb253e08ecfa90a28beffb01719af84f5 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@xxxxxxx>
Date: Thu, 22 Sep 2022 11:09:29 +0200
Subject: [PATCH] ext4: Fixup possible uninitialized variable access in
 ext4_mb_choose_next_group_cr1()

Variable 'grp' may be left uninitialized if there's no group with
suitable average fragment size (or larger). Fix the problem by
initializing it earlier.

Fixes: 83e80a6e3543 ("ext4: use buckets for cr 1 block scan instead of rbtree")
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Signed-off-by: Jan Kara <jack@xxxxxxx>
---
 fs/ext4/mballoc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 71f5b67d7f28..9dad93059945 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -910,7 +910,7 @@ static void ext4_mb_choose_next_group_cr1(struct ext4_allocation_context *ac,
 		int *new_cr, ext4_group_t *group, ext4_group_t ngroups)
 {
 	struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
-	struct ext4_group_info *grp, *iter;
+	struct ext4_group_info *grp = NULL, *iter;
 	int i;
 
 	if (unlikely(ac->ac_flags & EXT4_MB_CR1_OPTIMIZED)) {
@@ -927,7 +927,6 @@ static void ext4_mb_choose_next_group_cr1(struct ext4_allocation_context *ac,
 			read_unlock(&sbi->s_mb_avg_fragment_size_locks[i]);
 			continue;
 		}
-		grp = NULL;
 		list_for_each_entry(iter, &sbi->s_mb_avg_fragment_size[i],
 				    bb_avg_fragment_size_node) {
 			if (sbi->s_mb_stats)
-- 
2.35.3


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux