linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Theodore Tso <tytso@mit.edu>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	"linux-ext4@vger.kernel.org" <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 36/49] ext4: Add EXT4_IOC_MIGRATE ioctl
Date: Sat, 26 Jan 2008 14:12:47 +0530	[thread overview]
Message-ID: <20080126084247.GA6778@skywalker> (raw)
In-Reply-To: <20080126041500.GA28889@mit.edu>

On Fri, Jan 25, 2008 at 11:15:00PM -0500, Theodore Tso wrote:
> On Thu, Jan 24, 2008 at 11:25:32AM +0530, Aneesh Kumar K.V wrote:
> > +static int free_ext_idx(handle_t *handle, struct inode *inode,
> > +					struct ext4_extent_idx *ix)
> > +{
> > +	int i, retval = 0;
> > +	ext4_fsblk_t block;
> > +	struct buffer_head *bh;
> > +	struct ext4_extent_header *eh;
> > +
> > +	block = idx_pblock(ix);
> > +	bh = sb_bread(inode->i_sb, block);
> > +	if (!bh)
> > +		return -EIO;
> > +
> > +	eh = (struct ext4_extent_header *)bh->b_data;
> > +	if (eh->eh_depth == 0) {
> > +		brelse(bh);
> > +		ext4_free_blocks(handle, inode, block, 1);
> > +	} else {
> > +		ix = EXT_FIRST_INDEX(eh);
> > +		for (i = 0; i < le16_to_cpu(eh->eh_entries); i++, ix++) {
> > +			retval = free_ext_idx(handle, inode, ix);
> > +			if (retval)
> > +				return retval;
> > +		}
> > +	}
> > +	return retval;
> > +}
> 
> Aneesh, looks like if eh->eh_depth is != 0, bh gets leaked.  This is
> how I plan to fix it up:
> 
> +static int free_ext_idx(handle_t *handle, struct inode *inode,
> +					struct ext4_extent_idx *ix)
> +{
> +	int i, retval = 0;
> +	ext4_fsblk_t block;
> +	struct buffer_head *bh;
> +	struct ext4_extent_header *eh;
> +
> +	block = idx_pblock(ix);
> +	bh = sb_bread(inode->i_sb, block);
> +	if (!bh)
> +		return -EIO;
> +
> +	eh = (struct ext4_extent_header *)bh->b_data;
> +	if (eh->eh_depth == 0)
> +		ext4_free_blocks(handle, inode, block, 1);
> +	else {
> +		ix = EXT_FIRST_INDEX(eh);
> +		for (i = 0; i < le16_to_cpu(eh->eh_entries); i++, ix++) {
> +			retval = free_ext_idx(handle, inode, ix);
> +			if (retval)
> +				break;
> +		}
> +	}
> +	put_bh(bh);


We need to mark the index block as free.
 via ext4_free_blocks(handle, inode, block, 1);

I remember making this change. May be it was related to dind/tind
blocks. 


-aneesh

  reply	other threads:[~2008-01-26  8:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1200970948-17903-1-git-send-email-tytso@mit.edu>
     [not found] ` <1200970948-17903-2-git-send-email-tytso@mit.edu>
     [not found]   ` <1200970948-17903-3-git-send-email-tytso@mit.edu>
     [not found]     ` <1200970948-17903-4-git-send-email-tytso@mit.edu>
     [not found]       ` <1200970948-17903-5-git-send-email-tytso@mit.edu>
     [not found]         ` <1200970948-17903-6-git-send-email-tytso@mit.edu>
     [not found]           ` <1200970948-17903-7-git-send-email-tytso@mit.edu>
     [not found]             ` <1200970948-17903-8-git-send-email-tytso@mit.edu>
     [not found]               ` <1200970948-17903-9-git-send-email-tytso@mit.edu>
     [not found]                 ` <1200970948-17903-10-git-send-email-tytso@mit.edu>
     [not found]                   ` <1200970948-17903-11-git-send-email-tytso@mit.edu>
     [not found]                     ` <1200970948-17903-12-git-send-email-tytso@mit.edu>
     [not found]                       ` <1200970948-17903-13-git-send-email-tytso@mit.edu>
     [not found]                         ` <1200970948-17903-14-git-send-email-tytso@mit.edu>
     [not found]                           ` <1200970948-17903-15-git-send-email-tytso@mit.edu>
     [not found]                             ` <1200970948-17903-16-git-send-email-tytso@mit.edu>
     [not found]                               ` <1200970948-17903-17-git-send-email-tytso@mit.edu>
     [not found]                                 ` <1200970948-17903-18-git-send-email-tytso@mit.edu>
     [not found]                                   ` <1200970948-17903-19-git-send-email-tytso@mit.edu>
     [not found]                                     ` <1200970948-17903-20-git-send-email-tytso@mit.edu>
     [not found]                                       ` <1200970948-17903-21-git-send-email-tytso@mit.edu>
     [not found]                                         ` <1200970948-17903-22-git-send-email-tytso@mit.edu>
     [not found]                                           ` <1200970948-17903-23-git-send-email-tytso@mit.edu>
     [not found]                                             ` <1200970948-17903-24-git-send-email-tytso@mit.edu>
2008-01-23 22:06                                               ` [PATCH 23/49] Add buffer head related helper functions Andrew Morton
2008-01-24  5:22                                                 ` Aneesh Kumar K.V
2008-01-24  8:53                                                   ` Andrew Morton
     [not found]                                               ` <1200970948-17903-25-git-send-email-tytso@mit.edu>
     [not found]                                                 ` <1200970948-17903-26-git-send-email-tytso@mit.edu>
2008-01-22  3:02                                                   ` [PATCH 26/49] jbd2: Fix assertion failure in fs/jbd2/checkpoint.c Theodore Ts'o
     [not found]                                                     ` <1200970948-17903-28-git-send-email-tytso@mit.edu>
     [not found]                                                       ` <1200970948-17903-29-git-send-email-tytso@mit.edu>
     [not found]                                                         ` <1200970948-17903-30-git-send-email-tytso@mit.edu>
     [not found]                                                           ` <1200970948-17903-31-git-send-email-tytso@mit.edu>
2008-01-23 22:06                                                             ` [PATCH 30/49] ext4: Convert truncate_mutex to read write semaphore Andrew Morton
2008-01-24  5:29                                                               ` Aneesh Kumar K.V
2008-01-24 13:00                                                               ` Andy Whitcroft
     [not found]                                                             ` <1200970948-17903-32-git-send-email-tytso@mit.edu>
     [not found]                                                               ` <1200970948-17903-33-git-send-email-tytso@mit.edu>
     [not found]                                                                 ` <1200970948-17903-34-git-send-email-tytso@mit.edu>
2008-01-23 22:07                                                                   ` [PATCH 33/49] ext4: Add the journal checksum feature Andrew Morton
2008-01-23 22:40                                                                     ` Andreas Dilger
2008-01-24 21:24                                                                     ` Mingming Cao
2008-02-01 20:50                                                                       ` Girish Shilamkar
     [not found]                                                                   ` <1200970948-17903-35-git-send-email-tytso@mit.edu>
     [not found]                                                                     ` <1200970948-17903-36-git-send-email-tytso@mit.edu>
     [not found]                                                                       ` <1200970948-17903-37-git-send-email-tytso@mit.edu>
     [not found]                                                                         ` <1200970948-17903-38-git-send-email-tytso@mit.edu>
     [not found]                                                                           ` <1200970948-17903-39-git-send-email-tytso@mit.edu>
2008-01-22  3:02                                                                             ` [PATCH 39/49] ext4: Add ext4_find_next_bit() Theodore Ts'o
     [not found]                                                                               ` <1200970948-17903-41-git-send-email-tytso@mit.edu>
     [not found]                                                                                 ` <1200970948-17903-42-git-send-email-tytso@mit.edu>
2008-01-23 22:07                                                                                   ` [PATCH 41/49] ext4: Add multi block allocator for ext4 Andrew Morton
2008-01-23 23:20                                                                                     ` Andreas Dilger
2008-01-24  7:56                                                                                     ` Aneesh Kumar K.V
2008-01-24  9:04                                                                                       ` Aneesh Kumar K.V
2008-01-24 14:53                                                                                       ` Aneesh Kumar K.V
2008-01-23 22:07                                                                         ` [PATCH 36/49] ext4: Add EXT4_IOC_MIGRATE ioctl Andrew Morton
2008-01-24  5:55                                                                           ` Aneesh Kumar K.V
2008-01-26  4:15                                                                             ` Theodore Tso
2008-01-26  8:42                                                                               ` Aneesh Kumar K.V [this message]
2008-01-23 22:06                                                 ` [PATCH 24/49] ext4: add block bitmap validation Andrew Morton
2008-01-26 13:26                                                   ` 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=20080126084247.GA6778@skywalker \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@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).