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_chain_advance helper

Introduce exfat_chain_advance() to walk a exfat_chain structure by a
given step, updating both ->dir and ->size fields atomically. This
helper handles both ALLOC_NO_FAT_CHAIN and ALLOC_FAT_CHAIN modes with
proper boundary checking.

Suggested-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
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
227468fc f764c589

+21
+21
fs/exfat/exfat_fs.h
··· 552 552 int exfat_write_volume_label(struct super_block *sb, 553 553 struct exfat_uni_name *label); 554 554 555 + static inline int exfat_chain_advance(struct super_block *sb, 556 + struct exfat_chain *chain, unsigned int step) 557 + { 558 + unsigned int clu = chain->dir; 559 + 560 + if (unlikely(chain->size < step)) 561 + return -EIO; 562 + 563 + if (exfat_cluster_walk(sb, &clu, step, chain->flags)) 564 + return -EIO; 565 + 566 + chain->size -= step; 567 + 568 + if (chain->size == 0 && chain->flags == ALLOC_NO_FAT_CHAIN) 569 + chain->dir = EXFAT_EOF_CLUSTER; 570 + else 571 + chain->dir = clu; 572 + 573 + return 0; 574 + } 575 + 555 576 /* inode.c */ 556 577 extern const struct inode_operations exfat_file_inode_operations; 557 578 void exfat_sync_inode(struct inode *inode);