[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1207623660-1088-5-git-send-email-sandeen@redhat.com>
Date: Mon, 7 Apr 2008 22:00:59 -0500
From: Eric Sandeen <sandeen@...hat.com>
To: linux-ext4@...r.kernel.org
Cc: tytso@....edu, Eric Sandeen <sandeen@...hat.com>
Subject: [PATCH 4/5] make extent_goto() deterministic when logical block not found
Make sure that extent_goto() leaves us at the last extent
prior to the requested logical block, if the logical block
requested lands in a hole.
Signed-off-by: Eric Sandeen <sandeen@...hat.com>
---
lib/ext2fs/extent.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c
index 9f19e7b..e7b7e85 100644
--- a/lib/ext2fs/extent.c
+++ b/lib/ext2fs/extent.c
@@ -553,6 +553,12 @@ errcode_t ext2fs_extent_free_path(ext2_extent_path_t path)
}
#endif
+/*
+ * Go to the node at leaf_level which contains logical block blk.
+ *
+ * If "blk" has no mapping (hole) then handle is left at last
+ * extent before blk.
+ */
static errcode_t extent_goto(ext2_extent_handle_t handle,
int leaf_level, blk64_t blk)
{
@@ -566,11 +572,16 @@ static errcode_t extent_goto(ext2_extent_handle_t handle,
dbg_print_extent("root", &extent);
while (1) {
if (handle->level - leaf_level == handle->max_depth) {
+ /* block is in this &extent */
if ((blk >= extent.e_lblk) &&
(blk < extent.e_lblk + extent.e_len))
return 0;
- if (blk < extent.e_lblk)
+ if (blk < extent.e_lblk) {
+ retval = ext2fs_extent_get(handle,
+ EXT2_EXTENT_PREV_SIB,
+ &extent);
return EXT2_ET_EXTENT_NOT_FOUND;
+ }
retval = ext2fs_extent_get(handle,
EXT2_EXTENT_NEXT_SIB,
&extent);
--
1.5.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists