linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Sungjong Seo" <sj1557.seo@samsung.com>
To: "'Hyeongseok Kim'" <hyeongseok@gmail.com>, <namjae.jeon@samsung.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>,
	<sj1557.seo@samsung.com>
Subject: RE: [PATCH] exfat: speed up iterate/lookup by fixing start point of traversing fat chain
Date: Thu, 18 Mar 2021 01:07:21 +0900	[thread overview]
Message-ID: <a64901d71b47$9cacb070$d6061150$@samsung.com> (raw)
In-Reply-To: <20210315043316.54508-1-hyeongseok@gmail.com>

> When directory iterate and lookup is called, there is a buggy rewinding of
> start point for traversing fat chain to the directory entry's first
> cluster. This caused repeated fat chain traversing from the first entry of
> the directory that would show worse performance if huge amounts of files
> exist under single directory.
> Fix not to rewind, make continue from currently referenced cluster and dir
> entry.
> 
> Tested with 50,000 files under single directory / 256GB sdcard, with
> command "time ls -l > /dev/null",
> Before :     0m08.69s real     0m00.27s user     0m05.91s system
> After  :     0m07.01s real     0m00.25s user     0m04.34s system
> 
> Signed-off-by: Hyeongseok Kim <hyeongseok@gmail.com>
> ---
>  fs/exfat/dir.c | 42 +++++++++++++++++++++++++++++++++---------
>  1 file changed, 33 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index
> e1d5536de948..59d12eaa0649 100644
> --- a/fs/exfat/dir.c
> +++ b/fs/exfat/dir.c
> @@ -147,7 +147,7 @@ static int exfat_readdir(struct inode *inode, loff_t
> *cpos, struct exfat_dir_ent
>  					0);
> 
>  			*uni_name.name = 0x0;
> -			exfat_get_uniname_from_ext_entry(sb, &dir, dentry,
> +			exfat_get_uniname_from_ext_entry(sb, &clu, i,
>  				uni_name.name);

Looks good. Old code looks like a bug as you said.

>  			exfat_utf16_to_nls(sb, &uni_name,
>  				dir_entry->namebuf.lfn,
> @@ -911,10 +911,15 @@ enum {
>  };
> 
>  /*
> - * return values:
> - *   >= 0	: return dir entiry position with the name in dir
> - *   -ENOENT	: entry with the name does not exist
> - *   -EIO	: I/O error
> + * @ei:         inode info of directory
> + * @p_dir:      input as directory structure in which we search name
> + *              if found, output as a cluster dir where the name exists
> + *              if not found, not changed from input
> + * @num_entries entry size of p_uniname
> + * @return:
> + *   >= 0:      dir entry position from output p_dir.dir
> + *   -ENOENT:   entry with the name does not exist
> + *   -EIO:      I/O error
>   */
>  int exfat_find_dir_entry(struct super_block *sb, struct exfat_inode_info
> *ei,
>  		struct exfat_chain *p_dir, struct exfat_uni_name *p_uniname,
> @@ -925,14 +930,16 @@ int exfat_find_dir_entry(struct super_block *sb,
> struct exfat_inode_info *ei,
[snip]
  			hint_stat->clu = p_dir->dir;
>  			hint_stat->eidx = 0;
> -			return (dentry - num_ext);
> +
> +			exfat_chain_dup(p_dir, &tmp_clu);
> +			return dentry_in_cluster;
>  		}
>  	}
> 
>  	hint_stat->clu = clu.dir;
>  	hint_stat->eidx = dentry + 1;
> -	return dentry - num_ext;
> +
> +	exfat_chain_dup(p_dir, &tmp_clu);
> +	return dentry_in_cluster;
>  }

Changing the functionality of exfat find_dir_entry() will affect
exfat_find() and exfat_lookup(), breaking the concept of ei->dir.dir
which should have the starting cluster of its parent directory.

Well, is there any missing patch related to exfat_find()?
It would be nice to modify the caller of this function, exfat_find(),
so that this change in functionality doesn't affect other functions.

Thanks.

> 
>  int exfat_count_ext_entries(struct super_block *sb, struct exfat_chain
> *p_dir,
> --
> 2.27.0.83.g0313f36



  reply	other threads:[~2021-03-17 16:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210315043335epcas1p2bf257806e9ba1c2a492739a6424a2b44@epcas1p2.samsung.com>
2021-03-15  4:33 ` [PATCH] exfat: speed up iterate/lookup by fixing start point of traversing fat chain Hyeongseok Kim
2021-03-17 16:07   ` Sungjong Seo [this message]
2021-03-18  1:02     ` Hyeongseok Kim

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='a64901d71b47$9cacb070$d6061150$@samsung.com' \
    --to=sj1557.seo@samsung.com \
    --cc=hyeongseok@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namjae.jeon@samsung.com \
    /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).