Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

exfat: introduce exfat_cluster_walk helper

Introduce exfat_cluster_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>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>

authored by

Chi Zhiling and committed by
Namjae Jeon
f5e5177f ff37797b

+22 -1
+22 -1
fs/exfat/exfat_fs.h
··· 437 437 int exfat_clear_volume_dirty(struct super_block *sb); 438 438 439 439 /* fatent.c */ 440 - #define exfat_get_next_cluster(sb, pclu) exfat_ent_get(sb, *(pclu), pclu, NULL) 440 + #define exfat_get_next_cluster(sb, pclu) \ 441 + exfat_cluster_walk(sb, (pclu), 1, ALLOC_FAT_CHAIN) 441 442 442 443 int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc, 443 444 struct exfat_chain *p_chain, bool sync_bmap); ··· 456 455 struct exfat_chain *p_chain, unsigned int *ret_count); 457 456 int exfat_blk_readahead(struct super_block *sb, sector_t sec, 458 457 sector_t *ra, blkcnt_t *ra_cnt, sector_t end); 458 + 459 + static inline int 460 + exfat_cluster_walk(struct super_block *sb, unsigned int *clu, 461 + unsigned int step, int flags) 462 + { 463 + struct buffer_head *bh = NULL; 464 + 465 + if (flags == ALLOC_NO_FAT_CHAIN) { 466 + (*clu) += step; 467 + return 0; 468 + } 469 + 470 + while (step--) { 471 + if (exfat_ent_get(sb, *clu, clu, &bh)) 472 + return -EIO; 473 + } 474 + brelse(bh); 475 + 476 + return 0; 477 + } 459 478 460 479 /* balloc.c */ 461 480 int exfat_load_bitmap(struct super_block *sb);