From nobody Mon Feb 9 03:45:52 2026 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE0A037C0F7; Thu, 8 Jan 2026 07:50:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767858645; cv=none; b=RYI5yK6OLl43iqkQuztaw0tQJLWy1Nj56vOjyEcEVxUICrzsIyuNVuqs/yUdP2mOiveOpM5Yi6G/Uc1OyIb7DYSEVLTBicztjJjWk7GqG9c7o92Bv94lK96NbOKAFKEDAdB5bn36g9cLbQx6oTjtPGjoRB7spwBIuc3zqLaItUQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767858645; c=relaxed/simple; bh=HE6V/0UOeMQBZ0hAssNLXUXr473VmjRYbRgFeXZFWKs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LMeJcY2vB0fBzT+0ueiA+iEqnhV4j7EaqJc37oV+0wFDFc8CE/c+L2D5W3CbwaxgAuBmy9zXpnScGKHs4Pld8se95H0MLAnYJFrsZXmy+8sBmjNN/wcC9Dx5qeHGR7Jv9zSpz2yAIJ1YG0DPf6A1akvkuMIyCPC/bfRzjDoLlsg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=kK/T/Aik; arc=none smtp.client-ip=220.197.31.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="kK/T/Aik" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=Ja 9ucSkOs+cj53nJ8yIQf/xYVaM4E7I6IgI47koblVM=; b=kK/T/AikOzw31aeK9v sQe4e6GP3m6Y6vPmbA6eMklw/roeLqwyRX+Lx1wDXRwtvChI+KM0wUDHkgwR7rLi dNRxfIO9Kqwv3Cb4Tp+CF5hvpDyRfGsTWT0wZw9QUxCjMWXz21MClqNNCqc00tiy XDJxTF7/9HsBfekFit10v9Liw= Received: from czl-ubuntu-pc.. (unknown []) by gzga-smtp-mtada-g1-2 (Coremail) with SMTP id _____wBH6+WpYV9pdSx_Eg--.889S9; Thu, 08 Jan 2026 15:50:08 +0800 (CST) From: Chi Zhiling To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Namjae Jeon , Sungjong Seo , Yuezhang Mo , Chi Zhiling Subject: [PATCH v2 07/13] exfat: reduce the number of parameters for exfat_get_cluster() Date: Thu, 8 Jan 2026 15:49:23 +0800 Message-ID: <20260108074929.356683-8-chizhiling@163.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260108074929.356683-1-chizhiling@163.com> References: <20260108074929.356683-1-chizhiling@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wBH6+WpYV9pdSx_Eg--.889S9 X-Coremail-Antispam: 1Uf129KBjvJXoWxAFy5AryrGr45Jr1UKr1Dtrb_yoW5tFW3pr ZrKa48tay3Zayv9w48tr4kZa4S93Z7GayUJ3y3Aryqkr90yr409F1qyr9IyFyrGw4kua1j 9FyYgw1j9rsrGaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j2uWdUUUUU= X-CM-SenderInfo: hfkl6xxlol0wi6rwjhhfrp/xtbC9xC2VGlfYbBtdgAA35 Content-Type: text/plain; charset="utf-8" From: Chi Zhiling Remove parameter 'fclus' and 'allow_eof': - The fclus parameter is changed to a local variable as it is not needed to be returned. - The passed allow_eof parameter was always 1, remove it and the associated error handling. Signed-off-by: Chi Zhiling --- fs/exfat/cache.c | 27 +++++++++------------------ fs/exfat/exfat_fs.h | 3 +-- fs/exfat/inode.c | 5 +---- 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/fs/exfat/cache.c b/fs/exfat/cache.c index d51737498ee4..b806e7f5b00f 100644 --- a/fs/exfat/cache.c +++ b/fs/exfat/cache.c @@ -234,13 +234,12 @@ static inline void cache_init(struct exfat_cache_id *= cid, } =20 int exfat_get_cluster(struct inode *inode, unsigned int cluster, - unsigned int *fclus, unsigned int *dclus, - unsigned int *last_dclus, int allow_eof) + unsigned int *dclus, unsigned int *last_dclus) { struct super_block *sb =3D inode->i_sb; struct exfat_inode_info *ei =3D EXFAT_I(inode); struct exfat_cache_id cid; - unsigned int content; + unsigned int content, fclus; =20 if (ei->start_clu =3D=3D EXFAT_FREE_CLUSTER) { exfat_fs_error(sb, @@ -249,7 +248,7 @@ int exfat_get_cluster(struct inode *inode, unsigned int= cluster, return -EIO; } =20 - *fclus =3D 0; + fclus =3D 0; *dclus =3D ei->start_clu; *last_dclus =3D *dclus; =20 @@ -260,32 +259,24 @@ int exfat_get_cluster(struct inode *inode, unsigned i= nt cluster, return 0; =20 cache_init(&cid, EXFAT_EOF_CLUSTER, EXFAT_EOF_CLUSTER); - exfat_cache_lookup(inode, cluster, &cid, fclus, dclus); + exfat_cache_lookup(inode, cluster, &cid, &fclus, dclus); =20 - if (*fclus =3D=3D cluster) + if (fclus =3D=3D cluster) return 0; =20 - while (*fclus < cluster) { + while (fclus < cluster) { if (exfat_ent_get(sb, *dclus, &content, NULL)) return -EIO; =20 *last_dclus =3D *dclus; *dclus =3D content; - (*fclus)++; - - if (content =3D=3D EXFAT_EOF_CLUSTER) { - if (!allow_eof) { - exfat_fs_error(sb, - "invalid cluster chain (i_pos %u, last_clus 0x%08x is EOF)", - *fclus, (*last_dclus)); - return -EIO; - } + fclus++; =20 + if (content =3D=3D EXFAT_EOF_CLUSTER) break; - } =20 if (!cache_contiguous(&cid, *dclus)) - cache_init(&cid, *fclus, *dclus); + cache_init(&cid, fclus, *dclus); } =20 exfat_cache_add(inode, &cid); diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h index f7f25e0600c7..e58d8eed5495 100644 --- a/fs/exfat/exfat_fs.h +++ b/fs/exfat/exfat_fs.h @@ -486,8 +486,7 @@ int exfat_cache_init(void); void exfat_cache_shutdown(void); void exfat_cache_inval_inode(struct inode *inode); int exfat_get_cluster(struct inode *inode, unsigned int cluster, - unsigned int *fclus, unsigned int *dclus, - unsigned int *last_dclus, int allow_eof); + unsigned int *dclus, unsigned int *last_dclus); =20 /* dir.c */ extern const struct inode_operations exfat_dir_inode_operations; diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c index f9501c3a3666..55984585526e 100644 --- a/fs/exfat/inode.c +++ b/fs/exfat/inode.c @@ -157,13 +157,10 @@ static int exfat_map_cluster(struct inode *inode, uns= igned int clu_offset, *clu +=3D clu_offset; } } else if (ei->type =3D=3D TYPE_FILE) { - unsigned int fclus =3D 0; int err =3D exfat_get_cluster(inode, clu_offset, - &fclus, clu, &last_clu, 1); + clu, &last_clu); if (err) return -EIO; - - clu_offset -=3D fclus; } else { /* hint information */ if (clu_offset > 0 && ei->hint_bmap.off !=3D EXFAT_EOF_CLUSTER && --=20 2.43.0