linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [RFC PATCH] ext4: remove code that does not perform much optimization in find_group_orlov
       [not found] <20200127101352.35170-1-fishland@aliyun.com>
@ 2020-01-27 21:44 ` Andreas Dilger
  0 siblings, 0 replies; only message in thread
From: Andreas Dilger @ 2020-01-27 21:44 UTC (permalink / raw)
  To: Liu Song
  Cc: Theodore Y. Ts'o, linux-ext4, Linux Kernel Mailing List, liu.song11

[-- Attachment #1: Type: text/plain, Size: 1603 bytes --]

On Jan 27, 2020, at 3:13 AM, Liu Song <fishland@aliyun.com> wrote:
> 
> From: Liu Song <liu.song11@zte.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@zte.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






[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-27 21:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200127101352.35170-1-fishland@aliyun.com>
2020-01-27 21:44 ` [RFC PATCH] ext4: remove code that does not perform much optimization in find_group_orlov Andreas Dilger

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