linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Theodore Tso <tytso@mit.edu>
Cc: ext4 development <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH e2fsprogs] delete unused nodes in ext2fs_extent_delete
Date: Thu, 29 May 2008 20:11:47 -0500	[thread overview]
Message-ID: <483F5453.5060400@redhat.com> (raw)
In-Reply-To: <20080529222401.GA19617@mit.edu>

Theodore Tso wrote:
> 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.

Looks good, sorry for missing that!

-Eric

> 					- 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);
>  	}
> -
>  	return retval;
>  }
>  


  reply	other threads:[~2008-05-30  1:11 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
2008-05-30  1:11   ` Eric Sandeen [this message]
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=483F5453.5060400@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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;
as well as URLs for NNTP newsgroup(s).