Re: [PATCH 2/3] exfat: don't print error log in normal case

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

 



2023-02-21 16:34 GMT+09:00, Yuezhang.Mo@xxxxxxxx <Yuezhang.Mo@xxxxxxxx>:
> When allocating a new cluster, exFAT first allocates from the
> next cluster of the last cluster of the file. If the last cluster
> of the file is the last cluster of the volume, allocate from the
> first cluster. This is a normal case, but the following error log
> will be printed. It makes users confused, so this commit removes
> the error log.
>
> [1960905.181545] exFAT-fs (sdb1): hint_cluster is invalid (262130)
>
> Signed-off-by: Yuezhang Mo <Yuezhang.Mo@xxxxxxxx>
> Reviewed-by: Andy Wu <Andy.Wu@xxxxxxxx>
> ---
>  fs/exfat/fatent.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c
> index 65a8c9fb072c..b4ca533acaa9 100644
> --- a/fs/exfat/fatent.c
> +++ b/fs/exfat/fatent.c
> @@ -342,14 +342,18 @@ int exfat_alloc_cluster(struct inode *inode, unsigned
> int num_alloc,
>  		}
>  	}
>
> -	/* check cluster validation */
> -	if (!is_valid_cluster(sbi, hint_clu)) {
> -		exfat_err(sb, "hint_cluster is invalid (%u)",
> -			hint_clu);
> +	if (hint_clu == sbi->num_clusters) {
>  		hint_clu = EXFAT_FIRST_CLUSTER;
>  		p_chain->flags = ALLOC_FAT_CHAIN;
>  	}
>
> +	/* check cluster validation */
> +	if (!is_valid_cluster(sbi, hint_clu)) {
> +		exfat_err(sb, "hint_cluster is invalid (%u)", hint_clu);
> +		ret = -EIO;
There is no problem with allocation when invalid hint clu.
It is right to handle it as before instead returning -EIO.
In other words, after change exfat_err() to exfat_warn(),
It would be better to update print to avoid misunderstanding.
i.e. it will rewind to the first cluster rather than simply hint clu
invalid.

Thanks.
> +		goto unlock;
> +	}
> +
>  	p_chain->dir = EXFAT_EOF_CLUSTER;
>
>  	while ((new_clu = exfat_find_free_bitmap(sb, hint_clu)) !=
> --
> 2.25.1
>
>



[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