All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Sungjong Seo" <sj1557.seo@samsung.com>
To: <Yuezhang.Mo@sony.com>, <linkinjeon@kernel.org>
Cc: <linux-fsdevel@vger.kernel.org>, <Andy.Wu@sony.com>,
	<Wataru.Aoyama@sony.com>
Subject: RE: [PATCH v2 02/10] exfat: add exfat_get_empty_dentry_set() helper
Date: Thu, 29 Feb 2024 15:18:51 +0900	[thread overview]
Message-ID: <1296674576.21709188382123.JavaMail.epsvc@epcpadp4> (raw)
In-Reply-To: <PUZPR04MB6316C5AC606AABE0E08AC2A6819EA@PUZPR04MB6316.apcprd04.prod.outlook.com>

> This helper is used to lookup empty dentry set. If there are no enough
> empty dentries at the input location, this helper will return the number
> of dentries that need to be skipped for the next lookup.
> 
> Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
> Reviewed-by: Andy Wu <Andy.Wu@sony.com>
> Reviewed-by: Aoyama Wataru <wataru.aoyama@sony.com>
> ---
>  fs/exfat/dir.c      | 77 +++++++++++++++++++++++++++++++++++++++++++++
>  fs/exfat/exfat_fs.h |  3 ++
>  2 files changed, 80 insertions(+)
> 
> diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index
> cea9231d2fda..a5c8cd19aca6 100644
> --- a/fs/exfat/dir.c
> +++ b/fs/exfat/dir.c
> @@ -950,6 +950,83 @@ int exfat_get_dentry_set(struct exfat_entry_set_cache
> *es,
>  	return -EIO;
>  }
> 
> +static int exfat_validate_empty_dentry_set(struct exfat_entry_set_cache
> +*es) {
> +	struct exfat_dentry *ep;
> +	struct buffer_head *bh;
> +	int i, off;
> +	bool unused_hit = false;
> +
> +	for (i = 0; i < es->num_entries; i++) {
> +		ep = exfat_get_dentry_cached(es, i);
> +		if (ep->type == EXFAT_UNUSED)
> +			unused_hit = true;
> +		else if (IS_EXFAT_DELETED(ep->type)) {

Although it violates the specification for a deleted entry to follow an unused
entry, some exFAT implementations could work like this.

Therefore, to improve compatibility, why don't we allow this?
I believe there will be no functional problem even if this is allowed.

> +			if (unused_hit)
> +				goto out;
> +		} else {
> +			if (unused_hit)
> +				goto out;
Label "out" does not look like an error situation.
Let's use "out_err" instead of "out".

> +
> +			i++;
> +			goto count_skip_entries;
> +		}
> +	}
> +
> +	return 0;



  reply	other threads:[~2024-02-29  6:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20231228065938epcas1p3112d227f22639ca54849441146d9bdbf@epcas1p3.samsung.com>
2023-12-28  6:59 ` [PATCH v2 02/10] exfat: add exfat_get_empty_dentry_set() helper Yuezhang.Mo
2024-02-29  6:18   ` Sungjong Seo [this message]
2024-02-29  9:37     ` Yuezhang.Mo
     [not found] <CGME20231228065938epcas1p3112d227f22639ca54849441146d9bdbf@epcms1p1>
2024-03-04  4:43 ` 서성종
2024-03-04  7:29   ` Yuezhang.Mo
2024-03-04  8:42     ` Sungjong Seo
2024-03-04 11:37       ` Yuezhang.Mo
2024-03-07 11:07         ` Sungjong Seo

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=1296674576.21709188382123.JavaMail.epsvc@epcpadp4 \
    --to=sj1557.seo@samsung.com \
    --cc=Andy.Wu@sony.com \
    --cc=Wataru.Aoyama@sony.com \
    --cc=Yuezhang.Mo@sony.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-fsdevel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.