Re: [PATCH e2fsprogs] delete unused nodes in ext2fs_extent_delete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
>  }
>  

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux