lkml.org 
[lkml]   [2026]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 2/6] exfat: introduce exfat_fat_walk helper
From
On 4/3/26 10:34 AM, Yuezhang.Mo@sony.com wrote:
>> From: Chi Zhiling <chizhiling@kylinos.cn>
>>
>> Introduce exfat_fat_walk() to walk the FAT chain by a given step,
>> handling both ALLOC_NO_FAT_CHAIN and ALLOC_FAT_CHAIN modes. Also
>> redefine exfat_get_next_cluster as a thin wrapper around it for
>> backward compatibility.
>>
>> Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn>
>> ---
>> fs/exfat/exfat_fs.h | 23 ++++++++++++++++++++++-
>> 1 file changed, 22 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h
>> index 9fed9fb33cae..530459ab9acc 100644
>> --- a/fs/exfat/exfat_fs.h
>> +++ b/fs/exfat/exfat_fs.h
>> @@ -437,7 +437,8 @@ int exfat_set_volume_dirty(struct super_block *sb);
>> int exfat_clear_volume_dirty(struct super_block *sb);
>>
>> /* fatent.c */
>> -#define exfat_get_next_cluster(sb, pclu) exfat_ent_get(sb, *(pclu), pclu, NULL)
>> +#define exfat_get_next_cluster(sb, pclu) \
>> + exfat_fat_walk(sb, (pclu), 1, ALLOC_FAT_CHAIN)
>>
>> int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc,
>> struct exfat_chain *p_chain, bool sync_bmap);
>> @@ -456,6 +457,26 @@ int exfat_count_num_clusters(struct super_block *sb,
>> int exfat_blk_readahead(struct super_block *sb, sector_t sec,
>> sector_t *ra, blkcnt_t *ra_cnt, sector_t end);
>>
>> +static inline int
>> +exfat_fat_walk(struct super_block *sb, unsigned int *clu,
>> + unsigned int step, int flags)
>> +{
>> + struct buffer_head *bh = NULL;
>> +
>> + if (flags == ALLOC_NO_FAT_CHAIN) {
>> + (*clu) += step;
>> + return 0;
>> + }
>
> For ALLOC_NO_FAT_CHAIN, since the FAT region is not accessed, it would be
> better to use a more general function name, such as exfat_cluster_walk.

Okay,

>
>> +
>> + while (step--) {
>> + if (exfat_ent_get(sb, *clu, clu, &bh))
>> + return -EIO;
>> + }
>> + brelse(bh);
>> +
>> + return 0;
>> +}
>> +
>> /* balloc.c */
>> int exfat_load_bitmap(struct super_block *sb);
>> void exfat_free_bitmap(struct exfat_sb_info *sbi);
>> --
>> 2.43.0
>
>
>


\
 
 \ /
  Last update: 2026-04-03 04:46    [W:0.067 / U:61.065 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog