diff options
author | Yongqiang Yang <xiaoqiangnk@gmail.com> | 2011-07-26 22:05:53 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-07-26 22:05:53 -0400 |
commit | c3e94d1df9bdd9e2c4ba7e8f534f7925f1756f97 (patch) | |
tree | b0f23df82b491e04b64d7d67e4eecc80d1f4c6a0 /fs/ext4 | |
parent | 2b79b09d13e35577151bd13ba08809911baccd1c (diff) |
ext4: let setup_new_group_blocks() set multiple bits at a time
Rename mb_set_bits() to ext4_set_bits() and make it a global function
so that setup_new_group_blocks() can use it.
Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/ext4.h | 2 | ||||
-rw-r--r-- | fs/ext4/mballoc.c | 15 | ||||
-rw-r--r-- | fs/ext4/resize.c | 18 |
3 files changed, 17 insertions, 18 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index da7ab48948f..ba2009b49a5 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -940,6 +940,8 @@ struct ext4_inode_info { | |||
940 | #define ext4_find_next_zero_bit find_next_zero_bit_le | 940 | #define ext4_find_next_zero_bit find_next_zero_bit_le |
941 | #define ext4_find_next_bit find_next_bit_le | 941 | #define ext4_find_next_bit find_next_bit_le |
942 | 942 | ||
943 | extern void ext4_set_bits(void *bm, int cur, int len); | ||
944 | |||
943 | /* | 945 | /* |
944 | * Maximal mount counts between two filesystem checks | 946 | * Maximal mount counts between two filesystem checks |
945 | */ | 947 | */ |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index b6ef4da39ce..fa716c9b245 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -1282,7 +1282,7 @@ static void mb_clear_bits(void *bm, int cur, int len) | |||
1282 | } | 1282 | } |
1283 | } | 1283 | } |
1284 | 1284 | ||
1285 | static void mb_set_bits(void *bm, int cur, int len) | 1285 | void ext4_set_bits(void *bm, int cur, int len) |
1286 | { | 1286 | { |
1287 | __u32 *addr; | 1287 | __u32 *addr; |
1288 | 1288 | ||
@@ -1511,7 +1511,7 @@ static int mb_mark_used(struct ext4_buddy *e4b, struct ext4_free_extent *ex) | |||
1511 | } | 1511 | } |
1512 | mb_set_largest_free_order(e4b->bd_sb, e4b->bd_info); | 1512 | mb_set_largest_free_order(e4b->bd_sb, e4b->bd_info); |
1513 | 1513 | ||
1514 | mb_set_bits(EXT4_MB_BITMAP(e4b), ex->fe_start, len0); | 1514 | ext4_set_bits(EXT4_MB_BITMAP(e4b), ex->fe_start, len0); |
1515 | mb_check_buddy(e4b); | 1515 | mb_check_buddy(e4b); |
1516 | 1516 | ||
1517 | return ret; | 1517 | return ret; |
@@ -2795,8 +2795,8 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, | |||
2795 | * We leak some of the blocks here. | 2795 | * We leak some of the blocks here. |
2796 | */ | 2796 | */ |
2797 | ext4_lock_group(sb, ac->ac_b_ex.fe_group); | 2797 | ext4_lock_group(sb, ac->ac_b_ex.fe_group); |
2798 | mb_set_bits(bitmap_bh->b_data, ac->ac_b_ex.fe_start, | 2798 | ext4_set_bits(bitmap_bh->b_data, ac->ac_b_ex.fe_start, |
2799 | ac->ac_b_ex.fe_len); | 2799 | ac->ac_b_ex.fe_len); |
2800 | ext4_unlock_group(sb, ac->ac_b_ex.fe_group); | 2800 | ext4_unlock_group(sb, ac->ac_b_ex.fe_group); |
2801 | err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh); | 2801 | err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh); |
2802 | if (!err) | 2802 | if (!err) |
@@ -2814,7 +2814,8 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, | |||
2814 | } | 2814 | } |
2815 | } | 2815 | } |
2816 | #endif | 2816 | #endif |
2817 | mb_set_bits(bitmap_bh->b_data, ac->ac_b_ex.fe_start,ac->ac_b_ex.fe_len); | 2817 | ext4_set_bits(bitmap_bh->b_data, ac->ac_b_ex.fe_start, |
2818 | ac->ac_b_ex.fe_len); | ||
2818 | if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { | 2819 | if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { |
2819 | gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT); | 2820 | gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT); |
2820 | ext4_free_blks_set(sb, gdp, | 2821 | ext4_free_blks_set(sb, gdp, |
@@ -3284,7 +3285,7 @@ static void ext4_mb_generate_from_freelist(struct super_block *sb, void *bitmap, | |||
3284 | 3285 | ||
3285 | while (n) { | 3286 | while (n) { |
3286 | entry = rb_entry(n, struct ext4_free_data, node); | 3287 | entry = rb_entry(n, struct ext4_free_data, node); |
3287 | mb_set_bits(bitmap, entry->start_blk, entry->count); | 3288 | ext4_set_bits(bitmap, entry->start_blk, entry->count); |
3288 | n = rb_next(n); | 3289 | n = rb_next(n); |
3289 | } | 3290 | } |
3290 | return; | 3291 | return; |
@@ -3326,7 +3327,7 @@ void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap, | |||
3326 | if (unlikely(len == 0)) | 3327 | if (unlikely(len == 0)) |
3327 | continue; | 3328 | continue; |
3328 | BUG_ON(groupnr != group); | 3329 | BUG_ON(groupnr != group); |
3329 | mb_set_bits(bitmap, start, len); | 3330 | ext4_set_bits(bitmap, start, len); |
3330 | preallocated += len; | 3331 | preallocated += len; |
3331 | count++; | 3332 | count++; |
3332 | } | 3333 | } |
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 5f0aefdc859..178fb2f11c3 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -217,11 +217,6 @@ static int setup_new_group_blocks(struct super_block *sb, | |||
217 | goto exit_journal; | 217 | goto exit_journal; |
218 | } | 218 | } |
219 | 219 | ||
220 | if (ext4_bg_has_super(sb, input->group)) { | ||
221 | ext4_debug("mark backup superblock %#04llx (+0)\n", start); | ||
222 | ext4_set_bit(0, bh->b_data); | ||
223 | } | ||
224 | |||
225 | /* Copy all of the GDT blocks into the backup in this group */ | 220 | /* Copy all of the GDT blocks into the backup in this group */ |
226 | for (i = 0, bit = 1, block = start + 1; | 221 | for (i = 0, bit = 1, block = start + 1; |
227 | i < gdblocks; i++, block++, bit++) { | 222 | i < gdblocks; i++, block++, bit++) { |
@@ -250,7 +245,6 @@ static int setup_new_group_blocks(struct super_block *sb, | |||
250 | brelse(gdb); | 245 | brelse(gdb); |
251 | goto exit_bh; | 246 | goto exit_bh; |
252 | } | 247 | } |
253 | ext4_set_bit(bit, bh->b_data); | ||
254 | brelse(gdb); | 248 | brelse(gdb); |
255 | } | 249 | } |
256 | 250 | ||
@@ -261,8 +255,11 @@ static int setup_new_group_blocks(struct super_block *sb, | |||
261 | GFP_NOFS); | 255 | GFP_NOFS); |
262 | if (err) | 256 | if (err) |
263 | goto exit_bh; | 257 | goto exit_bh; |
264 | for (i = 0, bit = gdblocks + 1; i < reserved_gdb; i++, bit++) | 258 | |
265 | ext4_set_bit(bit, bh->b_data); | 259 | if (ext4_bg_has_super(sb, input->group)) { |
260 | ext4_debug("mark backup group tables %#04llx (+0)\n", start); | ||
261 | ext4_set_bits(bh->b_data, 0, gdblocks + reserved_gdb + 1); | ||
262 | } | ||
266 | 263 | ||
267 | ext4_debug("mark block bitmap %#04llx (+%llu)\n", input->block_bitmap, | 264 | ext4_debug("mark block bitmap %#04llx (+%llu)\n", input->block_bitmap, |
268 | input->block_bitmap - start); | 265 | input->block_bitmap - start); |
@@ -278,9 +275,8 @@ static int setup_new_group_blocks(struct super_block *sb, | |||
278 | err = sb_issue_zeroout(sb, block, sbi->s_itb_per_group, GFP_NOFS); | 275 | err = sb_issue_zeroout(sb, block, sbi->s_itb_per_group, GFP_NOFS); |
279 | if (err) | 276 | if (err) |
280 | goto exit_bh; | 277 | goto exit_bh; |
281 | for (i = 0, bit = input->inode_table - start; | 278 | ext4_set_bits(bh->b_data, input->inode_table - start, |
282 | i < sbi->s_itb_per_group; i++, bit++) | 279 | sbi->s_itb_per_group); |
283 | ext4_set_bit(bit, bh->b_data); | ||
284 | 280 | ||
285 | if ((err = extend_or_restart_transaction(handle, 2, bh))) | 281 | if ((err = extend_or_restart_transaction(handle, 2, bh))) |
286 | goto exit_bh; | 282 | goto exit_bh; |