aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/balloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/balloc.c')
-rw-r--r--fs/ext4/balloc.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 7aac2025ba9c..58005c01abb8 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -132,7 +132,7 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
132 */ 132 */
133 group_blocks = ext4_blocks_count(sbi->s_es) - 133 group_blocks = ext4_blocks_count(sbi->s_es) -
134 le32_to_cpu(sbi->s_es->s_first_data_block) - 134 le32_to_cpu(sbi->s_es->s_first_data_block) -
135 (EXT4_BLOCKS_PER_GROUP(sb) * (sbi->s_groups_count -1)); 135 (EXT4_BLOCKS_PER_GROUP(sb) * (sbi->s_groups_count - 1));
136 } else { 136 } else {
137 group_blocks = EXT4_BLOCKS_PER_GROUP(sb); 137 group_blocks = EXT4_BLOCKS_PER_GROUP(sb);
138 } 138 }
@@ -200,20 +200,20 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
200 * @bh: pointer to the buffer head to store the block 200 * @bh: pointer to the buffer head to store the block
201 * group descriptor 201 * group descriptor
202 */ 202 */
203struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, 203struct ext4_group_desc * ext4_get_group_desc(struct super_block *sb,
204 ext4_group_t block_group, 204 ext4_group_t block_group,
205 struct buffer_head ** bh) 205 struct buffer_head **bh)
206{ 206{
207 unsigned long group_desc; 207 unsigned long group_desc;
208 unsigned long offset; 208 unsigned long offset;
209 struct ext4_group_desc * desc; 209 struct ext4_group_desc *desc;
210 struct ext4_sb_info *sbi = EXT4_SB(sb); 210 struct ext4_sb_info *sbi = EXT4_SB(sb);
211 211
212 if (block_group >= sbi->s_groups_count) { 212 if (block_group >= sbi->s_groups_count) {
213 ext4_error (sb, "ext4_get_group_desc", 213 ext4_error(sb, "ext4_get_group_desc",
214 "block_group >= groups_count - " 214 "block_group >= groups_count - "
215 "block_group = %lu, groups_count = %lu", 215 "block_group = %lu, groups_count = %lu",
216 block_group, sbi->s_groups_count); 216 block_group, sbi->s_groups_count);
217 217
218 return NULL; 218 return NULL;
219 } 219 }
@@ -222,10 +222,10 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
222 group_desc = block_group >> EXT4_DESC_PER_BLOCK_BITS(sb); 222 group_desc = block_group >> EXT4_DESC_PER_BLOCK_BITS(sb);
223 offset = block_group & (EXT4_DESC_PER_BLOCK(sb) - 1); 223 offset = block_group & (EXT4_DESC_PER_BLOCK(sb) - 1);
224 if (!sbi->s_group_desc[group_desc]) { 224 if (!sbi->s_group_desc[group_desc]) {
225 ext4_error (sb, "ext4_get_group_desc", 225 ext4_error(sb, "ext4_get_group_desc",
226 "Group descriptor not loaded - " 226 "Group descriptor not loaded - "
227 "block_group = %lu, group_desc = %lu, desc = %lu", 227 "block_group = %lu, group_desc = %lu, desc = %lu",
228 block_group, group_desc, offset); 228 block_group, group_desc, offset);
229 return NULL; 229 return NULL;
230 } 230 }
231 231
@@ -302,8 +302,8 @@ err_out:
302struct buffer_head * 302struct buffer_head *
303ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group) 303ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group)
304{ 304{
305 struct ext4_group_desc * desc; 305 struct ext4_group_desc *desc;
306 struct buffer_head * bh = NULL; 306 struct buffer_head *bh = NULL;
307 ext4_fsblk_t bitmap_blk; 307 ext4_fsblk_t bitmap_blk;
308 308
309 desc = ext4_get_group_desc(sb, block_group, NULL); 309 desc = ext4_get_group_desc(sb, block_group, NULL);
@@ -506,8 +506,8 @@ void ext4_rsv_window_add(struct super_block *sb,
506 struct rb_node *node = &rsv->rsv_node; 506 struct rb_node *node = &rsv->rsv_node;
507 ext4_fsblk_t start = rsv->rsv_start; 507 ext4_fsblk_t start = rsv->rsv_start;
508 508
509 struct rb_node ** p = &root->rb_node; 509 struct rb_node **p = &root->rb_node;
510 struct rb_node * parent = NULL; 510 struct rb_node *parent = NULL;
511 struct ext4_reserve_window_node *this; 511 struct ext4_reserve_window_node *this;
512 512
513 while (*p) 513 while (*p)
@@ -661,8 +661,8 @@ void ext4_free_blocks_sb(handle_t *handle, struct super_block *sb,
661 ext4_grpblk_t bit; 661 ext4_grpblk_t bit;
662 unsigned long i; 662 unsigned long i;
663 unsigned long overflow; 663 unsigned long overflow;
664 struct ext4_group_desc * desc; 664 struct ext4_group_desc *desc;
665 struct ext4_super_block * es; 665 struct ext4_super_block *es;
666 struct ext4_sb_info *sbi; 666 struct ext4_sb_info *sbi;
667 int err = 0, ret; 667 int err = 0, ret;
668 ext4_grpblk_t group_freed; 668 ext4_grpblk_t group_freed;
@@ -673,13 +673,13 @@ void ext4_free_blocks_sb(handle_t *handle, struct super_block *sb,
673 if (block < le32_to_cpu(es->s_first_data_block) || 673 if (block < le32_to_cpu(es->s_first_data_block) ||
674 block + count < block || 674 block + count < block ||
675 block + count > ext4_blocks_count(es)) { 675 block + count > ext4_blocks_count(es)) {
676 ext4_error (sb, "ext4_free_blocks", 676 ext4_error(sb, "ext4_free_blocks",
677 "Freeing blocks not in datazone - " 677 "Freeing blocks not in datazone - "
678 "block = %llu, count = %lu", block, count); 678 "block = %llu, count = %lu", block, count);
679 goto error_return; 679 goto error_return;
680 } 680 }
681 681
682 ext4_debug ("freeing block(s) %llu-%llu\n", block, block + count - 1); 682 ext4_debug("freeing block(s) %llu-%llu\n", block, block + count - 1);
683 683
684do_more: 684do_more:
685 overflow = 0; 685 overflow = 0;
@@ -696,7 +696,7 @@ do_more:
696 bitmap_bh = ext4_read_block_bitmap(sb, block_group); 696 bitmap_bh = ext4_read_block_bitmap(sb, block_group);
697 if (!bitmap_bh) 697 if (!bitmap_bh)
698 goto error_return; 698 goto error_return;
699 desc = ext4_get_group_desc (sb, block_group, &gd_bh); 699 desc = ext4_get_group_desc(sb, block_group, &gd_bh);
700 if (!desc) 700 if (!desc)
701 goto error_return; 701 goto error_return;
702 702
@@ -705,10 +705,10 @@ do_more:
705 in_range(block, ext4_inode_table(sb, desc), sbi->s_itb_per_group) || 705 in_range(block, ext4_inode_table(sb, desc), sbi->s_itb_per_group) ||
706 in_range(block + count - 1, ext4_inode_table(sb, desc), 706 in_range(block + count - 1, ext4_inode_table(sb, desc),
707 sbi->s_itb_per_group)) { 707 sbi->s_itb_per_group)) {
708 ext4_error (sb, "ext4_free_blocks", 708 ext4_error(sb, "ext4_free_blocks",
709 "Freeing blocks in system zones - " 709 "Freeing blocks in system zones - "
710 "Block = %llu, count = %lu", 710 "Block = %llu, count = %lu",
711 block, count); 711 block, count);
712 goto error_return; 712 goto error_return;
713 } 713 }
714 714
@@ -850,7 +850,7 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode,
850 ext4_fsblk_t block, unsigned long count, 850 ext4_fsblk_t block, unsigned long count,
851 int metadata) 851 int metadata)
852{ 852{
853 struct super_block * sb; 853 struct super_block *sb;
854 unsigned long dquot_freed_blocks; 854 unsigned long dquot_freed_blocks;
855 855
856 /* this isn't the right place to decide whether block is metadata 856 /* this isn't the right place to decide whether block is metadata
@@ -1019,7 +1019,7 @@ claim_block(spinlock_t *lock, ext4_grpblk_t block, struct buffer_head *bh)
1019 if (ext4_set_bit_atomic(lock, block, bh->b_data)) 1019 if (ext4_set_bit_atomic(lock, block, bh->b_data))
1020 return 0; 1020 return 0;
1021 jbd_lock_bh_state(bh); 1021 jbd_lock_bh_state(bh);
1022 if (jh->b_committed_data && ext4_test_bit(block,jh->b_committed_data)) { 1022 if (jh->b_committed_data && ext4_test_bit(block, jh->b_committed_data)) {
1023 ext4_clear_bit_atomic(lock, block, bh->b_data); 1023 ext4_clear_bit_atomic(lock, block, bh->b_data);
1024 ret = 0; 1024 ret = 0;
1025 } else { 1025 } else {
@@ -1170,7 +1170,7 @@ fail_access:
1170static int find_next_reservable_window( 1170static int find_next_reservable_window(
1171 struct ext4_reserve_window_node *search_head, 1171 struct ext4_reserve_window_node *search_head,
1172 struct ext4_reserve_window_node *my_rsv, 1172 struct ext4_reserve_window_node *my_rsv,
1173 struct super_block * sb, 1173 struct super_block *sb,
1174 ext4_fsblk_t start_block, 1174 ext4_fsblk_t start_block,
1175 ext4_fsblk_t last_block) 1175 ext4_fsblk_t last_block)
1176{ 1176{
@@ -1204,7 +1204,7 @@ static int find_next_reservable_window(
1204 1204
1205 prev = rsv; 1205 prev = rsv;
1206 next = rb_next(&rsv->rsv_node); 1206 next = rb_next(&rsv->rsv_node);
1207 rsv = rb_entry(next,struct ext4_reserve_window_node,rsv_node); 1207 rsv = rb_entry(next, struct ext4_reserve_window_node, rsv_node);
1208 1208
1209 /* 1209 /*
1210 * Reached the last reservation, we can just append to the 1210 * Reached the last reservation, we can just append to the
@@ -1342,7 +1342,7 @@ static int alloc_new_reservation(struct ext4_reserve_window_node *my_rsv,
1342 size = size * 2; 1342 size = size * 2;
1343 if (size > EXT4_MAX_RESERVE_BLOCKS) 1343 if (size > EXT4_MAX_RESERVE_BLOCKS)
1344 size = EXT4_MAX_RESERVE_BLOCKS; 1344 size = EXT4_MAX_RESERVE_BLOCKS;
1345 my_rsv->rsv_goal_size= size; 1345 my_rsv->rsv_goal_size = size;
1346 } 1346 }
1347 } 1347 }
1348 1348
@@ -1491,7 +1491,7 @@ static ext4_grpblk_t
1491ext4_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle, 1491ext4_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle,
1492 ext4_group_t group, struct buffer_head *bitmap_bh, 1492 ext4_group_t group, struct buffer_head *bitmap_bh,
1493 ext4_grpblk_t grp_goal, 1493 ext4_grpblk_t grp_goal,
1494 struct ext4_reserve_window_node * my_rsv, 1494 struct ext4_reserve_window_node *my_rsv,
1495 unsigned long *count, int *errp) 1495 unsigned long *count, int *errp)
1496{ 1496{
1497 ext4_fsblk_t group_first_block, group_last_block; 1497 ext4_fsblk_t group_first_block, group_last_block;
@@ -1519,7 +1519,7 @@ ext4_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle,
1519 * or the file is not a regular file 1519 * or the file is not a regular file
1520 * or last attempt to allocate a block with reservation turned on failed 1520 * or last attempt to allocate a block with reservation turned on failed
1521 */ 1521 */
1522 if (my_rsv == NULL ) { 1522 if (my_rsv == NULL) {
1523 ret = ext4_try_to_allocate(sb, handle, group, bitmap_bh, 1523 ret = ext4_try_to_allocate(sb, handle, group, bitmap_bh,
1524 grp_goal, count, NULL); 1524 grp_goal, count, NULL);
1525 goto out; 1525 goto out;
@@ -2184,7 +2184,7 @@ unsigned long ext4_bg_num_gdb(struct super_block *sb, ext4_group_t group)
2184 2184
2185 if (!EXT4_HAS_INCOMPAT_FEATURE(sb,EXT4_FEATURE_INCOMPAT_META_BG) || 2185 if (!EXT4_HAS_INCOMPAT_FEATURE(sb,EXT4_FEATURE_INCOMPAT_META_BG) ||
2186 metagroup < first_meta_bg) 2186 metagroup < first_meta_bg)
2187 return ext4_bg_num_gdb_nometa(sb,group); 2187 return ext4_bg_num_gdb_nometa(sb, group);
2188 2188
2189 return ext4_bg_num_gdb_meta(sb,group); 2189 return ext4_bg_num_gdb_meta(sb,group);
2190 2190