kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] ext2:delete misused ext2_free_blocks
       [not found] <1277893287-25916-1-git-send-email-wppan@redflag-linux.com>
@ 2010-06-30 22:57 ` Dan Carpenter
  2010-07-01  1:56   ` Peter Pan
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-06-30 22:57 UTC (permalink / raw)
  To: Peter Pan
  Cc: jack, hch, viro, npiggin, jblunck, linux-fsdevel, linux-ext4,
	linux-kernel, kernel-janitors

On Wed, Jun 30, 2010 at 06:21:27PM +0800, Peter Pan wrote:
> if ext2_new_blocks returns error, no blocks need to be freed.
> 

Hi Peter,

Your patch isn't right.  The original code is OK as is.

Are you seeing a kernel panic?  Perhaps we can help you fix it.

regards,
dan carpenter

> Signed-off-by: Peter Pan <wppan@redflag-linux.com>
> ---
>  fs/ext2/inode.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
> index 3675088..f858847 100644
> --- a/fs/ext2/inode.c
> +++ b/fs/ext2/inode.c
> @@ -385,6 +385,8 @@ static int ext2_alloc_blocks(struct inode *inode,
>  	ext2_fsblk_t current_block = 0;
>  	int ret = 0;
>  
> +	*err = -ENOSPC;
> +
>  	/*
>  	 * Here we try to allocate the requested multiple blocks at once,
>  	 * on a best-effort basis.
> @@ -421,8 +423,6 @@ static int ext2_alloc_blocks(struct inode *inode,
>  	*err = 0;
>  	return ret;
>  failed_out:
> -	for (i = 0; i <index; i++)
> -		ext2_free_blocks(inode, new_blocks[i], 1);
>  	return ret;
>  }
>  
> -- 
> 1.6.6

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext2:delete misused ext2_free_blocks
  2010-06-30 22:57 ` [PATCH] ext2:delete misused ext2_free_blocks Dan Carpenter
@ 2010-07-01  1:56   ` Peter Pan
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Pan @ 2010-07-01  1:56 UTC (permalink / raw)
  To: Dan Carpenter, Peter Pan, jack, hch, viro, npiggin, jblunck,
	linux-fsdevel, linux-ext4, linux-kernel, kernel-janitors

On 07/01/2010 06:57 AM, Dan Carpenter wrote:
> On Wed, Jun 30, 2010 at 06:21:27PM +0800, Peter Pan wrote:
>    
>> if ext2_new_blocks returns error, no blocks need to be freed.
>>
>>      
> Hi Peter,
>
> Your patch isn't right.  The original code is OK as is.
>
> Are you seeing a kernel panic?  Perhaps we can help you fix it.
>    
Oh, I know that the original code is good now.
I didn't see a kernel panic, thank you for your guide.
> regards,
> dan carpenter
>
>    
>> Signed-off-by: Peter Pan<wppan@redflag-linux.com>
>> ---
>>   fs/ext2/inode.c |    4 ++--
>>   1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
>> index 3675088..f858847 100644
>> --- a/fs/ext2/inode.c
>> +++ b/fs/ext2/inode.c
>> @@ -385,6 +385,8 @@ static int ext2_alloc_blocks(struct inode *inode,
>>   	ext2_fsblk_t current_block = 0;
>>   	int ret = 0;
>>
>> +	*err = -ENOSPC;
>> +
>>   	/*
>>   	 * Here we try to allocate the requested multiple blocks at once,
>>   	 * on a best-effort basis.
>> @@ -421,8 +423,6 @@ static int ext2_alloc_blocks(struct inode *inode,
>>   	*err = 0;
>>   	return ret;
>>   failed_out:
>> -	for (i = 0; i<index; i++)
>> -		ext2_free_blocks(inode, new_blocks[i], 1);
>>   	return ret;
>>   }
>>
>> -- 
>> 1.6.6
>>      
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
>    

Regards

-- 
Peter Pan
Red Flag Software Co.,Ltd


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-01  1:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1277893287-25916-1-git-send-email-wppan@redflag-linux.com>
2010-06-30 22:57 ` [PATCH] ext2:delete misused ext2_free_blocks Dan Carpenter
2010-07-01  1:56   ` Peter Pan

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).