linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Chengguang Xu <cgxu519@zoho.com.cn>
Cc: jack@suse.com, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext2: start from parent blockgroup when trying linear search for a free inode
Date: Mon, 3 Jun 2019 12:05:45 +0200	[thread overview]
Message-ID: <20190603100545.GC27933@quack2.suse.cz> (raw)
In-Reply-To: <20190601084941.22792-1-cgxu519@zoho.com.cn>

On Sat 01-06-19 16:49:41, Chengguang Xu wrote:
> Start from parent blockgroup when trying linear search
> for a free indoe because for non directory inode it's
> better to keep in same blockgroup with parent.
> 
> Signed-off-by: Chengguang Xu <cgxu519@zoho.com.cn>

Thanks for the patch! As much as I agree that incrementing group before
calling ext2_get_group_desc() was probably an oversight I don't think that
changing that at this point is good. For ext2 driver we don't really care
about performance too much anymore and also existing filesystems have
inodes for files in a directory allocated in parent_group + 1 and this
change would spread them also to parent_group effectively worsening the
situation.

								Honza

> ---
>  fs/ext2/ialloc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
> index fda7d3f5b4be..435463a255e6 100644
> --- a/fs/ext2/ialloc.c
> +++ b/fs/ext2/ialloc.c
> @@ -411,11 +411,11 @@ static int find_group_other(struct super_block *sb, struct inode *parent)
>  	 */
>  	group = parent_group;
>  	for (i = 0; i < ngroups; i++) {
> -		if (++group >= ngroups)
> -			group = 0;
>  		desc = ext2_get_group_desc (sb, group, NULL);
>  		if (desc && le16_to_cpu(desc->bg_free_inodes_count))
>  			goto found;
> +		if (++group >= ngroups)
> +			group = 0;
>  	}
>  
>  	return -1;
> -- 
> 2.17.2
> 
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

      reply	other threads:[~2019-06-03 10:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-01  8:49 [PATCH] ext2: start from parent blockgroup when trying linear search for a free inode Chengguang Xu
2019-06-03 10:05 ` Jan Kara [this message]

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=20190603100545.GC27933@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=cgxu519@zoho.com.cn \
    --cc=jack@suse.com \
    --cc=linux-ext4@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).