From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Namjae Jeon <linkinjeon@kernel.org>,
Christoph Hellwig <hch@lst.de>,
"Darrick J. Wong" <djwong@kernel.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 7.1.y 3/5] exfat: add data_start_bytes and exfat_cluster_to_phys_bytes() helper
Date: Tue, 21 Jul 2026 07:46:54 -0400 [thread overview]
Message-ID: <20260721114656.3687966-3-sashal@kernel.org> (raw)
In-Reply-To: <20260721114656.3687966-1-sashal@kernel.org>
From: Namjae Jeon <linkinjeon@kernel.org>
[ Upstream commit 3b9450beeb961c7ddf4cccddba37fcfa6d1fcb7a ]
This caches the data area start offset in bytes (data_start_bytes)
and introduces a helper function exfat_cluster_to_phys_bytes() to compute
the physical byte position of a given cluster.
Acked-by: Christoph Hellwig <hch@lst.de>
Acked-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Stable-dep-of: 044472d5ee7d ("iomap: consolidate bio submission")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/exfat/exfat_fs.h | 8 ++++++++
fs/exfat/super.c | 1 +
2 files changed, 9 insertions(+)
diff --git a/fs/exfat/exfat_fs.h b/fs/exfat/exfat_fs.h
index 6ec480b53fe6dc..d2eec3a0bbc070 100644
--- a/fs/exfat/exfat_fs.h
+++ b/fs/exfat/exfat_fs.h
@@ -227,6 +227,7 @@ struct exfat_sb_info {
unsigned long long FAT1_start_sector; /* FAT1 start sector */
unsigned long long FAT2_start_sector; /* FAT2 start sector */
unsigned long long data_start_sector; /* data area start sector */
+ unsigned long long data_start_bytes;
unsigned int num_FAT_sectors; /* num of FAT sectors */
unsigned int root_dir; /* root dir cluster */
unsigned int dentries_per_clu; /* num of dentries per cluster */
@@ -400,6 +401,13 @@ static inline loff_t exfat_ondisk_size(const struct inode *inode)
return ((loff_t)inode->i_blocks) << 9;
}
+static inline loff_t exfat_cluster_to_phys_bytes(struct exfat_sb_info *sbi,
+ unsigned int clus)
+{
+ return ((loff_t)(clus - EXFAT_RESERVED_CLUSTERS) << sbi->cluster_size_bits) +
+ sbi->data_start_bytes;
+}
+
/*
* helpers for cluster size to byte conversion.
*/
diff --git a/fs/exfat/super.c b/fs/exfat/super.c
index cb2f8eefff9957..388db271c6bf53 100644
--- a/fs/exfat/super.c
+++ b/fs/exfat/super.c
@@ -499,6 +499,7 @@ static int exfat_read_boot_sector(struct super_block *sb)
if (p_boot->num_fats == 2)
sbi->FAT2_start_sector += sbi->num_FAT_sectors;
sbi->data_start_sector = le32_to_cpu(p_boot->clu_offset);
+ sbi->data_start_bytes = sbi->data_start_sector << p_boot->sect_size_bits;
sbi->num_sectors = le64_to_cpu(p_boot->vol_length);
/* because the cluster index starts with 2 */
sbi->num_clusters = le32_to_cpu(p_boot->clu_count) +
--
2.53.0
next prev parent reply other threads:[~2026-07-21 11:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 14:40 FAILED: patch "[PATCH] iomap: consolidate bio submission" failed to apply to 7.1-stable tree gregkh
2026-07-21 11:46 ` [PATCH 7.1.y 1/5] exfat: replace unsafe macros with static inline functions Sasha Levin
2026-07-21 11:46 ` [PATCH 7.1.y 2/5] exfat: add balloc parameter to exfat_map_cluster() for iomap support Sasha Levin
2026-07-21 11:46 ` Sasha Levin [this message]
2026-07-21 11:46 ` [PATCH 7.1.y 4/5] exfat: fix implicit declaration of brelse() Sasha Levin
2026-07-21 11:46 ` [PATCH 7.1.y 5/5] iomap: consolidate bio submission Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260721114656.3687966-3-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=djwong@kernel.org \
--cc=hch@lst.de \
--cc=linkinjeon@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox