public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* PATCH] ext4: Change error handling in ext4_defrag_alloc_blocks
@ 2008-06-12  1:43 Akira Fujita
  2008-06-12 22:49 ` Mingming Cao
  0 siblings, 1 reply; 2+ messages in thread
From: Akira Fujita @ 2008-06-12  1:43 UTC (permalink / raw)
  To: linux-ext4, Mingming Cao, Theodore Tso; +Cc: Aneesh Kumar K.V, shen

Change error handling in ext4_defrag_alloc_blocks,
since ext4_ext_journal_restart returns the error value.

Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
---
 fs/ext4/defrag.c  |    6 ++----
 fs/ext4/ext4.h    |    2 +-
 fs/ext4/extents.c |    2 +-
 3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/fs/ext4/defrag.c b/fs/ext4/defrag.c
index cd8b151..5187681 100644
--- a/fs/ext4/defrag.c
+++ b/fs/ext4/defrag.c
@@ -1386,12 +1386,10 @@ ext4_defrag_alloc_blocks(handle_t *handle, struct inode *org_inode,
 	int err, i, credits = 0;

 	credits = ext4_ext_calc_credits_for_insert(dest_inode, dest_path);
-	handle = ext4_ext_journal_restart(handle,
+	err = ext4_ext_journal_restart(handle,
 				credits + EXT4_TRANS_META_BLOCKS);
-	if (IS_ERR(handle)) {
-		err = PTR_ERR(handle);
+	if (err)
 		return err;
-	}

 	*newblock = ext4_mb_new_blocks(handle, ar, &err);
 	if (err)
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index eec99be..202514e 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1198,7 +1198,7 @@ extern void ext4_inode_bitmap_set(struct super_block *sb,
 extern void ext4_inode_table_set(struct super_block *sb,
 				 struct ext4_group_desc *bg, ext4_fsblk_t blk);
 /* extents.c */
-extern handle_t *ext4_ext_journal_restart(handle_t *handle, int needed);
+extern int ext4_ext_journal_restart(handle_t *handle, int needed);
 /* defrag.c */
 extern int ext4_defrag(struct file *filp, ext4_lblk_t block_start,
 			ext4_lblk_t defrag_size, ext4_fsblk_t goal,
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 8d47490..30e011b 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -93,7 +93,7 @@ static void ext4_idx_store_pblock(struct ext4_extent_idx *ix, ext4_fsblk_t pb)
 	ix->ei_leaf_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff);
 }

-handle_t *ext4_ext_journal_restart(handle_t *handle, int needed)
+int ext4_ext_journal_restart(handle_t *handle, int needed)
 {
 	int err;


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

* Re: PATCH] ext4: Change error handling in ext4_defrag_alloc_blocks
  2008-06-12  1:43 PATCH] ext4: Change error handling in ext4_defrag_alloc_blocks Akira Fujita
@ 2008-06-12 22:49 ` Mingming Cao
  0 siblings, 0 replies; 2+ messages in thread
From: Mingming Cao @ 2008-06-12 22:49 UTC (permalink / raw)
  To: Akira Fujita; +Cc: linux-ext4, Theodore Tso, Aneesh Kumar K.V, shen

On Thu, 2008-06-12 at 10:43 +0900, Akira Fujita wrote:
> Change error handling in ext4_defrag_alloc_blocks,
> since ext4_ext_journal_restart returns the error value.
> 
> Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
> ---
>  fs/ext4/defrag.c  |    6 ++----
>  fs/ext4/ext4.h    |    2 +-
>  fs/ext4/extents.c |    2 +-
>  3 files changed, 4 insertions(+), 6 deletions(-)
> diff --git a/fs/ext4/defrag.c b/fs/ext4/defrag.c
> index cd8b151..5187681 100644
> --- a/fs/ext4/defrag.c
> +++ b/fs/ext4/defrag.c
> @@ -1386,12 +1386,10 @@ ext4_defrag_alloc_blocks(handle_t *handle, struct inode *org_inode,
>  	int err, i, credits = 0;
> 
>  	credits = ext4_ext_calc_credits_for_insert(dest_inode, dest_path);
> -	handle = ext4_ext_journal_restart(handle,
> +	err = ext4_ext_journal_restart(handle,
>  				credits + EXT4_TRANS_META_BLOCKS);
> -	if (IS_ERR(handle)) {
> -		err = PTR_ERR(handle);
> +	if (err)
>  		return err;
> -	}
> 
>  	*newblock = ext4_mb_new_blocks(handle, ar, &err);
>  	if (err)
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index eec99be..202514e 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -1198,7 +1198,7 @@ extern void ext4_inode_bitmap_set(struct super_block *sb,
>  extern void ext4_inode_table_set(struct super_block *sb,
>  				 struct ext4_group_desc *bg, ext4_fsblk_t blk);
>  /* extents.c */
> -extern handle_t *ext4_ext_journal_restart(handle_t *handle, int needed);
> +extern int ext4_ext_journal_restart(handle_t *handle, int needed);
>  /* defrag.c */
>  extern int ext4_defrag(struct file *filp, ext4_lblk_t block_start,
>  			ext4_lblk_t defrag_size, ext4_fsblk_t goal,
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 8d47490..30e011b 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -93,7 +93,7 @@ static void ext4_idx_store_pblock(struct ext4_extent_idx *ix, ext4_fsblk_t pb)
>  	ix->ei_leaf_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff);
>  }
> 
> -handle_t *ext4_ext_journal_restart(handle_t *handle, int needed)
> +int ext4_ext_journal_restart(handle_t *handle, int needed)
>  {
>  	int err;
> 

Thanks, I fold this patch to the parent patch
ext4-online-defrag-alloc-contiguous-blks.patch with slightly
modification to make it apply.

Mingming



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

end of thread, other threads:[~2008-06-12 22:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-12  1:43 PATCH] ext4: Change error handling in ext4_defrag_alloc_blocks Akira Fujita
2008-06-12 22:49 ` Mingming Cao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox