Patchwork [12/12] ext4: simplify parameters of reserve_backup_gdb()

login
register
mail settings
Submitter Yongqiang Yang
Date July 18, 2011, 2:52 a.m.
Message ID <1310957555-15617-13-git-send-email-xiaoqiangnk@gmail.com>
Download mbox | patch
Permalink /patch/105155/
State Superseded
Headers show

Comments

Yongqiang Yang - July 18, 2011, 2:52 a.m.
reserve_backup_gdb() only needs the no. of a group, there is no need to pass
a pointer to struct ext4_new_group_data to it.

Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
---
 fs/ext4/resize.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
Amir Goldstein - July 18, 2011, 7:12 a.m.
On Mon, Jul 18, 2011 at 5:52 AM, Yongqiang Yang <xiaoqiangnk@gmail.com> wrote:
> reserve_backup_gdb() only needs the no. of a group, there is no need to pass
> a pointer to struct ext4_new_group_data to it.
>
> Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>

Acked-by: Amir Goldstein" <amir73il@users.sf.net>
For All 12 patches.

> ---
>  fs/ext4/resize.c |   12 +++++++-----
>  1 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
> index 52d0426..3e790ad 100644
> --- a/fs/ext4/resize.c
> +++ b/fs/ext4/resize.c
> @@ -556,7 +556,7 @@ exit_bh:
>  * backup GDT blocks are stored in their reserved primary GDT block.
>  */
>  static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
> -                             struct ext4_new_group_data *input)
> +                             ext4_group_t group)
>  {
>        struct super_block *sb = inode->i_sb;
>        int reserved_gdb =le16_to_cpu(EXT4_SB(sb)->s_es->s_reserved_gdt_blocks);
> @@ -627,7 +627,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
>         * Finally we can add each of the reserved backup GDT blocks from
>         * the new group to its reserved primary GDT block.
>         */
> -       blk = input->group * EXT4_BLOCKS_PER_GROUP(sb);
> +       blk = group * EXT4_BLOCKS_PER_GROUP(sb);
>        for (i = 0; i < reserved_gdb; i++) {
>                int err2;
>                data = (__le32 *)primary[i]->b_data;
> @@ -841,9 +841,11 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
>                if ((err = ext4_journal_get_write_access(handle, primary)))
>                        goto exit_journal;
>
> -               if (reserved_gdb && ext4_bg_num_gdb(sb, input->group) &&
> -                   (err = reserve_backup_gdb(handle, inode, input)))
> -                       goto exit_journal;
> +               if (reserved_gdb && ext4_bg_num_gdb(sb, input->group)) {
> +                       err = reserve_backup_gdb(handle, inode, input->group);
> +                       if (err)
> +                               goto exit_journal;
> +               }
>        } else {
>                err = add_new_gdb(handle, inode, input->group);
>                if (err)
> --
> 1.7.5.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 52d0426..3e790ad 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -556,7 +556,7 @@  exit_bh:
  * backup GDT blocks are stored in their reserved primary GDT block.
  */
 static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
-			      struct ext4_new_group_data *input)
+			      ext4_group_t group)
 {
 	struct super_block *sb = inode->i_sb;
 	int reserved_gdb =le16_to_cpu(EXT4_SB(sb)->s_es->s_reserved_gdt_blocks);
@@ -627,7 +627,7 @@  static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
 	 * Finally we can add each of the reserved backup GDT blocks from
 	 * the new group to its reserved primary GDT block.
 	 */
-	blk = input->group * EXT4_BLOCKS_PER_GROUP(sb);
+	blk = group * EXT4_BLOCKS_PER_GROUP(sb);
 	for (i = 0; i < reserved_gdb; i++) {
 		int err2;
 		data = (__le32 *)primary[i]->b_data;
@@ -841,9 +841,11 @@  int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
 		if ((err = ext4_journal_get_write_access(handle, primary)))
 			goto exit_journal;
 
-		if (reserved_gdb && ext4_bg_num_gdb(sb, input->group) &&
-		    (err = reserve_backup_gdb(handle, inode, input)))
-			goto exit_journal;
+		if (reserved_gdb && ext4_bg_num_gdb(sb, input->group)) {
+			err = reserve_backup_gdb(handle, inode, input->group);
+			if (err)
+				goto exit_journal;
+		}
 	} else {
 		err = add_new_gdb(handle, inode, input->group);
 		if (err)