RE: [PATCH v2 02/10] exfat: add exfat_get_empty_dentry_set() helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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@xxxxxxxx>
> Reviewed-by: Andy Wu <Andy.Wu@xxxxxxxx>
> Reviewed-by: Aoyama Wataru <wataru.aoyama@xxxxxxxx>
> ---
>  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;







[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux