From: Theodore Tso <tytso@mit.edu>
To: Eric Sandeen <sandeen@redhat.com>
Cc: ext4 development <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH e2fsprogs] delete unused nodes in ext2fs_extent_delete
Date: Thu, 29 May 2008 18:24:01 -0400 [thread overview]
Message-ID: <20080529222401.GA19617@mit.edu> (raw)
In-Reply-To: <48333F05.6080608@redhat.com>
On Tue, May 20, 2008 at 04:13:41PM -0500, Eric Sandeen wrote:
> This patch causes ext2fs_extent_delete to remove an
> extent node if the last record in it has been deleted.
I needed to apply this fix on top of your patch; otherwise, when
deleting the last extent in the root node, the current extent pointer
is left pointing at an invalid extent.
- Ted
diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c
index c3863b5..19d7feb 100644
--- a/lib/ext2fs/extent.c
+++ b/lib/ext2fs/extent.c
@@ -1225,11 +1225,11 @@ errcode_t ext2fs_extent_delete(ext2_extent_handle_t handle, int flags)
ix--;
path->curr = ix;
}
- path->entries--;
- /* if non-root node has no entries left, remove it & parent ptr to it */
- if (path->entries == 0 && handle->level) {
+ if (--path->entries == 0)
path->curr = 0;
+ /* if non-root node has no entries left, remove it & parent ptr to it */
+ if (path->entries == 0 && handle->level) {
if (!(flags & EXT2_EXTENT_DELETE_KEEP_EMPTY)) {
struct ext2fs_extent extent;
@@ -1251,7 +1251,6 @@ errcode_t ext2fs_extent_delete(ext2_extent_handle_t handle, int flags)
retval = update_path(handle);
}
next prev parent reply other threads:[~2008-05-29 22:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-20 21:13 [PATCH e2fsprogs] delete unused nodes in ext2fs_extent_delete Eric Sandeen
2008-05-29 22:24 ` Theodore Tso [this message]
2008-05-30 1:11 ` Eric Sandeen
2008-05-31 4:19 ` Theodore Tso
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=20080529222401.GA19617@mit.edu \
--to=tytso@mit.edu \
--cc=linux-ext4@vger.kernel.org \
--cc=sandeen@redhat.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.