diff options
author | Yongqiang Yang <xiaoqiangnk@gmail.com> | 2012-01-04 17:09:48 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-01-04 17:09:48 -0500 |
commit | d89651c8e222b2d2797bf66d4eb7064459f4f4f4 (patch) | |
tree | 831f27a1758bceebb52fa00a642ce063ca40b2a3 | |
parent | 19c5246d251640ac76daa4d34165af78c64b1454 (diff) |
ext4: let ext4_group_extend() use common code
ext4_group_extend_no_check() is moved out from ext4_group_extend(),
this patch lets ext4_group_extend() call ext4_group_extentd_no_check()
instead.
Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | fs/ext4/resize.c | 41 |
1 files changed, 2 insertions, 39 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 5fe2a013ee65..eba706d9276a 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -1795,8 +1795,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, | |||
1795 | ext4_grpblk_t last; | 1795 | ext4_grpblk_t last; |
1796 | ext4_grpblk_t add; | 1796 | ext4_grpblk_t add; |
1797 | struct buffer_head *bh; | 1797 | struct buffer_head *bh; |
1798 | handle_t *handle; | 1798 | int err; |
1799 | int err, err2; | ||
1800 | ext4_group_t group; | 1799 | ext4_group_t group; |
1801 | 1800 | ||
1802 | o_blocks_count = ext4_blocks_count(es); | 1801 | o_blocks_count = ext4_blocks_count(es); |
@@ -1852,43 +1851,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, | |||
1852 | } | 1851 | } |
1853 | brelse(bh); | 1852 | brelse(bh); |
1854 | 1853 | ||
1855 | /* We will update the superblock, one block bitmap, and | 1854 | err = ext4_group_extend_no_check(sb, o_blocks_count, add); |
1856 | * one group descriptor via ext4_free_blocks(). | ||
1857 | */ | ||
1858 | handle = ext4_journal_start_sb(sb, 3); | ||
1859 | if (IS_ERR(handle)) { | ||
1860 | err = PTR_ERR(handle); | ||
1861 | ext4_warning(sb, "error %d on journal start", err); | ||
1862 | goto exit_put; | ||
1863 | } | ||
1864 | |||
1865 | if ((err = ext4_journal_get_write_access(handle, | ||
1866 | EXT4_SB(sb)->s_sbh))) { | ||
1867 | ext4_warning(sb, "error %d on journal write access", err); | ||
1868 | ext4_journal_stop(handle); | ||
1869 | goto exit_put; | ||
1870 | } | ||
1871 | ext4_blocks_count_set(es, o_blocks_count + add); | ||
1872 | ext4_debug("freeing blocks %llu through %llu\n", o_blocks_count, | ||
1873 | o_blocks_count + add); | ||
1874 | /* We add the blocks to the bitmap and set the group need init bit */ | ||
1875 | err = ext4_group_add_blocks(handle, sb, o_blocks_count, add); | ||
1876 | ext4_handle_dirty_super(handle, sb); | ||
1877 | ext4_debug("freed blocks %llu through %llu\n", o_blocks_count, | ||
1878 | o_blocks_count + add); | ||
1879 | err2 = ext4_journal_stop(handle); | ||
1880 | if (!err && err2) | ||
1881 | err = err2; | ||
1882 | |||
1883 | if (err) | ||
1884 | goto exit_put; | ||
1885 | |||
1886 | if (test_opt(sb, DEBUG)) | ||
1887 | printk(KERN_DEBUG "EXT4-fs: extended group to %llu blocks\n", | ||
1888 | ext4_blocks_count(es)); | ||
1889 | update_backups(sb, EXT4_SB(sb)->s_sbh->b_blocknr, (char *)es, | ||
1890 | sizeof(struct ext4_super_block)); | ||
1891 | exit_put: | ||
1892 | return err; | 1855 | return err; |
1893 | } /* ext4_group_extend */ | 1856 | } /* ext4_group_extend */ |
1894 | 1857 | ||