[<prev] [next>] [day] [month] [year] [list]
Message-Id: <6A331F39-D25C-4970-9A6D-229B24E25D37@dilger.ca>
Date: Mon, 27 Jan 2020 14:44:24 -0700
From: Andreas Dilger <adilger@...ger.ca>
To: Liu Song <fishland@...yun.com>
Cc: "Theodore Y. Ts'o" <tytso@....edu>,
linux-ext4 <linux-ext4@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
liu.song11@....com.cn
Subject: Re: [RFC PATCH] ext4: remove code that does not perform much
optimization in find_group_orlov
On Jan 27, 2020, at 3:13 AM, Liu Song <fishland@...yun.com> wrote:
>
> From: Liu Song <liu.song11@....com.cn>
>
> Even if "best_ndir" has already taken the final value, it still
> needs to traverse all the block groups. It is better to simplify
> the code and increase readability.
>
> Signed-off-by: Liu Song <liu.song11@....com.cn>
> ---
> fs/ext4/ialloc.c | 15 +++------------
> 1 file changed, 3 insertions(+), 12 deletions(-)
>
> @@ -447,17 +447,8 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent,
> int best_ndir = inodes_per_group;
> int ret = -1;
>
> - if (qstr) {
> - hinfo.hash_version = DX_HASH_HALF_MD4;
> - hinfo.seed = sbi->s_hash_seed;
> - ext4fs_dirhash(parent, qstr->name, qstr->len, &hinfo);
> - grp = hinfo.hash;
> - } else
> - grp = prandom_u32();
> - parent_group = (unsigned)grp % ngroups;
> for (i = 0; i < ngroups; i++) {
> - g = (parent_group + i) % ngroups;
> - get_orlov_stats(sb, g, flex_size, &stats);
> + get_orlov_stats(sb, i, flex_size, &stats);
It isn't clear to me that this is an improvement? This means that *all*
new group allocations will start searching at group = 0, which will
increase contention on the early block groups. With the current code,
the starting block group is distributed across the filesystem, as it
is possible that there are multiple groups that have the same score.
We might consider to improve the group selection for non-rotational storage,
since we don't care as much about groups on the inner vs. outer tracks.
Cheers, Andreas
Download attachment "signature.asc" of type "application/pgp-signature" (874 bytes)
Powered by blists - more mailing lists