Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 262125
b: refs/heads/master
c: 6d40bc5
h: refs/heads/master
i:
  262123: d58b6c0
v: v3
  • Loading branch information
Yongqiang Yang authored and Theodore Ts'o committed Jul 27, 2011
1 parent 94d363f commit 50c0272
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c3e94d1df9bdd9e2c4ba7e8f534f7925f1756f97
refs/heads/master: 6d40bc5a7e8fc71795d131e835f38f161ed7e1b1
39 changes: 20 additions & 19 deletions trunk/fs/ext4/resize.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ static struct buffer_head *bclean(handle_t *handle, struct super_block *sb,
* If that fails, restart the transaction & regain write access for the
* buffer head which is used for block_bitmap modifications.
*/
static int extend_or_restart_transaction(handle_t *handle, int thresh,
struct buffer_head *bh)
static int extend_or_restart_transaction(handle_t *handle, int thresh)
{
int err;

Expand All @@ -173,9 +172,8 @@ static int extend_or_restart_transaction(handle_t *handle, int thresh,
if (err < 0)
return err;
if (err) {
if ((err = ext4_journal_restart(handle, EXT4_MAX_TRANS_DATA)))
return err;
if ((err = ext4_journal_get_write_access(handle, bh)))
err = ext4_journal_restart(handle, EXT4_MAX_TRANS_DATA);
if (err)
return err;
}

Expand Down Expand Up @@ -212,29 +210,24 @@ static int setup_new_group_blocks(struct super_block *sb,

BUG_ON(input->group != sbi->s_groups_count);

if (IS_ERR(bh = bclean(handle, sb, input->block_bitmap))) {
err = PTR_ERR(bh);
goto exit_journal;
}

/* Copy all of the GDT blocks into the backup in this group */
for (i = 0, bit = 1, block = start + 1;
i < gdblocks; i++, block++, bit++) {
struct buffer_head *gdb;

ext4_debug("update backup group %#04llx (+%d)\n", block, bit);

if ((err = extend_or_restart_transaction(handle, 1, bh)))
goto exit_bh;
err = extend_or_restart_transaction(handle, 1);
if (err)
goto exit_journal;

gdb = sb_getblk(sb, block);
if (!gdb) {
err = -EIO;
goto exit_bh;
goto exit_journal;
}
if ((err = ext4_journal_get_write_access(handle, gdb))) {
brelse(gdb);
goto exit_bh;
goto exit_journal;
}
lock_buffer(gdb);
memcpy(gdb->b_data, sbi->s_group_desc[i]->b_data, gdb->b_size);
Expand All @@ -243,7 +236,7 @@ static int setup_new_group_blocks(struct super_block *sb,
err = ext4_handle_dirty_metadata(handle, NULL, gdb);
if (unlikely(err)) {
brelse(gdb);
goto exit_bh;
goto exit_journal;
}
brelse(gdb);
}
Expand All @@ -254,7 +247,17 @@ static int setup_new_group_blocks(struct super_block *sb,
err = sb_issue_zeroout(sb, gdblocks + start + 1, reserved_gdb,
GFP_NOFS);
if (err)
goto exit_bh;
goto exit_journal;

err = extend_or_restart_transaction(handle, 2);
if (err)
goto exit_journal;

bh = bclean(handle, sb, input->block_bitmap);
if (IS_ERR(bh)) {
err = PTR_ERR(bh);
goto exit_journal;
}

if (ext4_bg_has_super(sb, input->group)) {
ext4_debug("mark backup group tables %#04llx (+0)\n", start);
Expand All @@ -278,8 +281,6 @@ static int setup_new_group_blocks(struct super_block *sb,
ext4_set_bits(bh->b_data, input->inode_table - start,
sbi->s_itb_per_group);

if ((err = extend_or_restart_transaction(handle, 2, bh)))
goto exit_bh;

ext4_mark_bitmap_end(input->blocks_count, sb->s_blocksize * 8,
bh->b_data);
Expand Down

0 comments on commit 50c0272

Please sign in to comment.