|
|
Log in / Subscribe / Register

exfat: unify FAT chain walking helpers

From:  Chi Zhiling <chizhiling-AT-163.com>
To:  Namjae Jeon <linkinjeon-AT-kernel.org>, Sungjong Seo <sj1557.seo-AT-samsung.com>, Yuezhang Mo <yuezhang.mo-AT-sony.com>
Subject:  [PATCH v1 0/6] exfat: unify FAT chain walking helpers
Date:  Tue, 31 Mar 2026 17:11:07 +0800
Message-ID:  <20260331091113.20882-1-chizhiling@163.com>
Cc:  linux-fsdevel-AT-vger.kernel.org, linux-kernel-AT-vger.kernel.org, Chi Zhiling <chizhiling-AT-kylinos.cn>
Archive-link:  Article

From: Chi Zhiling <chizhiling@kylinos.cn>

This series introduces and uses two new helpers to simplify FAT chain
walking logic across the exfat driver:

1. exfat_fat_walk - walks FAT chain by a given step, handling both
   ALLOC_NO_FAT_CHAIN and ALLOC_FAT_CHAIN modes

2. exfat_chain_advance - walks an exfat_chain structure by a given step,
   updating both ->dir and ->size fields atomically with proper boundary
   checking

These helpers replace open-coded cluster walking logic in dir.c, namei.c
and inode.c, improving code readability and ensuring consistent error
handling for corrupted FAT chains.

Also includes a fix for incorrect directory checksum when renaming a
file to a shorter name.

The base commit is exfat/dev without iomap changes


Chi Zhiling (6):
  exfat: fix incorrect directory checksum after rename to shorter name
  exfat: introduce exfat_fat_walk helper
  exfat: use exfat_fat_walk helper to simplify fat entry walking
  exfat: remove NULL cache pointer case in exfat_ent_get
  exfat: introduce exfat_chain_advance helper
  exfat: use exfat_chain_advance helper

 fs/exfat/dir.c      | 111 +++++++++-----------------------------------
 fs/exfat/exfat_fs.h |  49 ++++++++++++++++++-
 fs/exfat/fatent.c   |  23 ++++-----
 fs/exfat/inode.c    |  11 +----
 fs/exfat/namei.c    |  29 +++---------
 5 files changed, 88 insertions(+), 135 deletions(-)

-- 
2.43.0




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds