From nobody Sat Feb 7 08:28:05 2026 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.3]) (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 BC0CA800; Fri, 26 Dec 2025 09:45:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766742338; cv=none; b=DvTTM46mf5zobHaDlcdK+WFTZQnzYjd6FkcJnCSJypD1NUyPthl8o2SMjq/cdtLaG0i4LqJ/XgNH31AnxUslxNE9Mfg5bw3HMr8X5C7hPBss9rGaoFHoMdH+x+fq6adJ/ZD1joDha/qQ1NAzOUrqSLPJFwT9jQOLaMBWV9vIL0Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766742338; c=relaxed/simple; bh=7XQnh/VA/KqJu+7+aA4dxxn6OFQ3awzG6+iIQKJDZXQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aAqFqE9VT+N3VGjBYpFFp/0ZoY8ZQLjPsyLhsqFm3vt7U4+jkllNRFPmMEMnwKyvFMH4ymkAIDQ7pAa0Squ9ikHejNfFH2M+GRRqFx2xRDLrdmo6JuPm/+jSPKBpiKIk3V5yno5mZ5ycJGL+e4epqFYSeAGXvLG9bl2/hRUiOn4= 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=nSDOlbKe; arc=none smtp.client-ip=220.197.31.3 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="nSDOlbKe" 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=Hw hjI8LrnsS3V0SFfDxImoH+MP8b9nINkDRWIGH0XPQ=; b=nSDOlbKeebsa/WSXv3 XOpkJZiPaDaYaXhY9wyhP7lOK2wAxqtsKshSdDu2EM/ikuVrkD/5XTG+JFpwl8Wa /xZsJmWEza68+9vwAISZm5CxYDr95EqUPrNDR3aWqaeD/nWVr8sCjanrMFbeqoXd LwufFWphAXWElOY3Mxr9d5hSI= Received: from chi-Redmi-Book.. (unknown []) by gzsmtp5 (Coremail) with SMTP id QCgvCgCnlXIPWU5p9JFCJA--.53S8; Fri, 26 Dec 2025 17:44:52 +0800 (CST) From: Chi Zhiling To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Namjae Jeon , Sungjong Seo , Yuezhang Mo , Alexander Viro , Christian Brauner , Jan Kara , Matthew Wilcox , Chi Zhiling Subject: [PATCH v1 6/9] exfat: remove unused parameters from exfat_get_cluster Date: Fri, 26 Dec 2025 17:44:37 +0800 Message-ID: <20251226094440.455563-7-chizhiling@163.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251226094440.455563-1-chizhiling@163.com> References: <20251226094440.455563-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: QCgvCgCnlXIPWU5p9JFCJA--.53S8 X-Coremail-Antispam: 1Uf129KBjvJXoWxCr18try7XF4rKF4kXF1fWFg_yoWruw47pr ZrKa4rt3y3Xayv9w48tFs5Za4fK3Z7GFWUJw43AryYkr90yr1F9FnFkr9Iya48Gw4kuayj 9F15Kw1j9rnxGw7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jnCzZUUUUU= X-CM-SenderInfo: hfkl6xxlol0wi6rwjhhfrp/xtbC+BRJ5mlOWRSBVAAA38 Content-Type: text/plain; charset="utf-8" From: Chi Zhiling Remove the unused fclus and allow_eof parameters from exfat_get_cluster. The fclus parameter is changed to a local variable as it is not needed to be returned. The allow_eof parameter was always 1, so remove it and the associated error handling. This simplifies the function and its callers, no logical changes. Signed-off-by: Chi Zhiling --- fs/exfat/cache.c | 31 +++++++++++-------------------- fs/exfat/exfat_fs.h | 3 +-- fs/exfat/inode.c | 12 +++++------- 3 files changed, 17 insertions(+), 29 deletions(-) diff --git a/fs/exfat/cache.c b/fs/exfat/cache.c index 4161b983b6af..43a6aa87c55d 100644 --- a/fs/exfat/cache.c +++ b/fs/exfat/cache.c @@ -234,8 +234,7 @@ static inline void cache_init(struct exfat_cache_id *ci= d, } =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_sb_info *sbi =3D EXFAT_SB(sb); @@ -243,7 +242,7 @@ int exfat_get_cluster(struct inode *inode, unsigned int= cluster, struct exfat_inode_info *ei =3D EXFAT_I(inode); struct buffer_head *bh =3D NULL; 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, @@ -252,7 +251,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 @@ -264,7 +263,7 @@ int exfat_get_cluster(struct inode *inode, unsigned int= cluster, =20 cache_init(&cid, EXFAT_EOF_CLUSTER, EXFAT_EOF_CLUSTER); =20 - if (exfat_cache_lookup(inode, cluster, &cid, fclus, dclus) =3D=3D + if (exfat_cache_lookup(inode, cluster, &cid, &fclus, dclus) =3D=3D EXFAT_EOF_CLUSTER) { /* * dummy, always not contiguous @@ -276,15 +275,15 @@ int exfat_get_cluster(struct inode *inode, unsigned i= nt cluster, cid.nr_contig !=3D 0); } =20 - if (*fclus =3D=3D cluster) + if (fclus =3D=3D cluster) return 0; =20 - while (*fclus < cluster) { + while (fclus < cluster) { /* prevent the infinite loop of cluster chain */ - if (*fclus > limit) { + if (fclus > limit) { exfat_fs_error(sb, "detected the cluster chain loop (i_pos %u)", - (*fclus)); + fclus); goto err; } =20 @@ -293,21 +292,13 @@ int exfat_get_cluster(struct inode *inode, unsigned i= nt cluster, =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)); - goto err; - } + 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 brelse(bh); 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..1062ce470cb1 100644 --- a/fs/exfat/inode.c +++ b/fs/exfat/inode.c @@ -157,28 +157,26 @@ 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 { + unsigned int fclus =3D 0; /* hint information */ if (clu_offset > 0 && ei->hint_bmap.off !=3D EXFAT_EOF_CLUSTER && ei->hint_bmap.off > 0 && clu_offset >=3D ei->hint_bmap.off) { - clu_offset -=3D ei->hint_bmap.off; /* hint_bmap.clu should be valid */ WARN_ON(ei->hint_bmap.clu < 2); + fclus =3D ei->hint_bmap.off; *clu =3D ei->hint_bmap.clu; } =20 - while (clu_offset > 0 && *clu !=3D EXFAT_EOF_CLUSTER) { + while (fclus < clu_offset && *clu !=3D EXFAT_EOF_CLUSTER) { last_clu =3D *clu; if (exfat_get_next_cluster(sb, clu)) return -EIO; - clu_offset--; + fclus++; } } =20 --=20 2.43.0