From: Keshav Verma <iganschel@gmail.com>
To: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>, Mateusz Guzik <mjguzik@gmail.com>,
Chuck Lever <chuck.lever@oracle.com>,
Jeff Layton <jlayton@kernel.org>,
Keshav Verma <iganschel@gmail.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] efs: fix direct extent lookup for indirect extents
Date: Fri, 19 Jun 2026 01:00:05 +0530 [thread overview]
Message-ID: <20260618193005.3162-1-iganschel@gmail.com> (raw)
The loop that finds the direct extent containing an indirect extent used
cur < ibase as its condition. Since ibase starts at zero, the loop never
advances for normal non-negative cur values, so only the first direct
extent is considered.
Iterate over the direct extents and stop when cur falls within the range
covered by the current direct extent.
Signed-off-by: Keshav Verma <iganschel@gmail.com>
---
fs/efs/inode.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/fs/efs/inode.c b/fs/efs/inode.c
index 4b132729e638..16b5ee10e323 100644
--- a/fs/efs/inode.c
+++ b/fs/efs/inode.c
@@ -254,9 +254,14 @@ efs_block_t efs_map_block(struct inode *inode, efs_block_t block) {
*
*/
ibase = 0;
- for(dirext = 0; cur < ibase && dirext < direxts; dirext++) {
- ibase += in->extents[dirext].cooked.ex_length *
+ for (dirext = 0; dirext < direxts; dirext++) {
+ int entries = in->extents[dirext].cooked.ex_length *
(EFS_BLOCKSIZE / sizeof(efs_extent));
+
+ if (cur < ibase + entries)
+ break;
+
+ ibase += entries;
}
if (dirext == direxts) {
--
2.39.5
next reply other threads:[~2026-06-18 19:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-18 19:30 Keshav Verma [this message]
2026-06-18 21:19 ` [PATCH] efs: fix direct extent lookup for indirect extents Matthew Wilcox
2026-06-18 21:27 ` Keshav Verma
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=20260618193005.3162-1-iganschel@gmail.com \
--to=iganschel@gmail.com \
--cc=brauner@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mjguzik@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.