aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/alloc.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2010-05-18 19:40:42 -0400
committerJoel Becker <joel.becker@oracle.com>2010-05-18 19:40:42 -0400
commit41841b0bcea8af7f3bff8b2a23d542b94d9c1bb1 (patch)
tree89eddf2dffadbbd13939f94eb8cd904a26279390 /fs/ocfs2/alloc.c
parent316ce2ba8e74a7bb9153b9f93adc883cb1ceb9fd (diff)
parent1a934c3e57594588c373aea858e4593cdfcba4f4 (diff)
Merge branch 'discontig-bg' of git://oss.oracle.com/git/tma/linux-2.6 into ocfs2-merge-window
Diffstat (limited to 'fs/ocfs2/alloc.c')
-rw-r--r--fs/ocfs2/alloc.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 7e9cb753fba7..215e12ce1d85 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -1006,7 +1006,7 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle,
1006 int count, status, i; 1006 int count, status, i;
1007 u16 suballoc_bit_start; 1007 u16 suballoc_bit_start;
1008 u32 num_got; 1008 u32 num_got;
1009 u64 first_blkno; 1009 u64 suballoc_loc, first_blkno;
1010 struct ocfs2_super *osb = 1010 struct ocfs2_super *osb =
1011 OCFS2_SB(ocfs2_metadata_cache_get_super(et->et_ci)); 1011 OCFS2_SB(ocfs2_metadata_cache_get_super(et->et_ci));
1012 struct ocfs2_extent_block *eb; 1012 struct ocfs2_extent_block *eb;
@@ -1015,10 +1015,10 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle,
1015 1015
1016 count = 0; 1016 count = 0;
1017 while (count < wanted) { 1017 while (count < wanted) {
1018 status = ocfs2_claim_metadata(osb, 1018 status = ocfs2_claim_metadata(handle,
1019 handle,
1020 meta_ac, 1019 meta_ac,
1021 wanted - count, 1020 wanted - count,
1021 &suballoc_loc,
1022 &suballoc_bit_start, 1022 &suballoc_bit_start,
1023 &num_got, 1023 &num_got,
1024 &first_blkno); 1024 &first_blkno);
@@ -1052,6 +1052,7 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle,
1052 eb->h_fs_generation = cpu_to_le32(osb->fs_generation); 1052 eb->h_fs_generation = cpu_to_le32(osb->fs_generation);
1053 eb->h_suballoc_slot = 1053 eb->h_suballoc_slot =
1054 cpu_to_le16(meta_ac->ac_alloc_slot); 1054 cpu_to_le16(meta_ac->ac_alloc_slot);
1055 eb->h_suballoc_loc = cpu_to_le64(suballoc_loc);
1055 eb->h_suballoc_bit = cpu_to_le16(suballoc_bit_start); 1056 eb->h_suballoc_bit = cpu_to_le16(suballoc_bit_start);
1056 eb->h_list.l_count = 1057 eb->h_list.l_count =
1057 cpu_to_le16(ocfs2_extent_recs_per_eb(osb->sb)); 1058 cpu_to_le16(ocfs2_extent_recs_per_eb(osb->sb));
@@ -4786,7 +4787,7 @@ int ocfs2_add_clusters_in_btree(handle_t *handle,
4786 goto leave; 4787 goto leave;
4787 } 4788 }
4788 4789
4789 status = __ocfs2_claim_clusters(osb, handle, data_ac, 1, 4790 status = __ocfs2_claim_clusters(handle, data_ac, 1,
4790 clusters_to_add, &bit_off, &num_bits); 4791 clusters_to_add, &bit_off, &num_bits);
4791 if (status < 0) { 4792 if (status < 0) {
4792 if (status != -ENOSPC) 4793 if (status != -ENOSPC)
@@ -6295,6 +6296,7 @@ int ocfs2_truncate_log_init(struct ocfs2_super *osb)
6295 */ 6296 */
6296struct ocfs2_cached_block_free { 6297struct ocfs2_cached_block_free {
6297 struct ocfs2_cached_block_free *free_next; 6298 struct ocfs2_cached_block_free *free_next;
6299 u64 free_bg;
6298 u64 free_blk; 6300 u64 free_blk;
6299 unsigned int free_bit; 6301 unsigned int free_bit;
6300}; 6302};
@@ -6341,8 +6343,11 @@ static int ocfs2_free_cached_blocks(struct ocfs2_super *osb,
6341 } 6343 }
6342 6344
6343 while (head) { 6345 while (head) {
6344 bg_blkno = ocfs2_which_suballoc_group(head->free_blk, 6346 if (head->free_bg)
6345 head->free_bit); 6347 bg_blkno = head->free_bg;
6348 else
6349 bg_blkno = ocfs2_which_suballoc_group(head->free_blk,
6350 head->free_bit);
6346 mlog(0, "Free bit: (bit %u, blkno %llu)\n", 6351 mlog(0, "Free bit: (bit %u, blkno %llu)\n",
6347 head->free_bit, (unsigned long long)head->free_blk); 6352 head->free_bit, (unsigned long long)head->free_blk);
6348 6353
@@ -6390,7 +6395,7 @@ int ocfs2_cache_cluster_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt,
6390 int ret = 0; 6395 int ret = 0;
6391 struct ocfs2_cached_block_free *item; 6396 struct ocfs2_cached_block_free *item;
6392 6397
6393 item = kmalloc(sizeof(*item), GFP_NOFS); 6398 item = kzalloc(sizeof(*item), GFP_NOFS);
6394 if (item == NULL) { 6399 if (item == NULL) {
6395 ret = -ENOMEM; 6400 ret = -ENOMEM;
6396 mlog_errno(ret); 6401 mlog_errno(ret);
@@ -6530,8 +6535,8 @@ ocfs2_find_per_slot_free_list(int type,
6530} 6535}
6531 6536
6532int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, 6537int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt,
6533 int type, int slot, u64 blkno, 6538 int type, int slot, u64 suballoc,
6534 unsigned int bit) 6539 u64 blkno, unsigned int bit)
6535{ 6540{
6536 int ret; 6541 int ret;
6537 struct ocfs2_per_slot_free_list *fl; 6542 struct ocfs2_per_slot_free_list *fl;
@@ -6544,7 +6549,7 @@ int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt,
6544 goto out; 6549 goto out;
6545 } 6550 }
6546 6551
6547 item = kmalloc(sizeof(*item), GFP_NOFS); 6552 item = kzalloc(sizeof(*item), GFP_NOFS);
6548 if (item == NULL) { 6553 if (item == NULL) {
6549 ret = -ENOMEM; 6554 ret = -ENOMEM;
6550 mlog_errno(ret); 6555 mlog_errno(ret);
@@ -6554,6 +6559,7 @@ int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt,
6554 mlog(0, "Insert: (type %d, slot %u, bit %u, blk %llu)\n", 6559 mlog(0, "Insert: (type %d, slot %u, bit %u, blk %llu)\n",
6555 type, slot, bit, (unsigned long long)blkno); 6560 type, slot, bit, (unsigned long long)blkno);
6556 6561
6562 item->free_bg = suballoc;
6557 item->free_blk = blkno; 6563 item->free_blk = blkno;
6558 item->free_bit = bit; 6564 item->free_bit = bit;
6559 item->free_next = fl->f_first; 6565 item->free_next = fl->f_first;
@@ -6570,6 +6576,7 @@ static int ocfs2_cache_extent_block_free(struct ocfs2_cached_dealloc_ctxt *ctxt,
6570{ 6576{
6571 return ocfs2_cache_block_dealloc(ctxt, EXTENT_ALLOC_SYSTEM_INODE, 6577 return ocfs2_cache_block_dealloc(ctxt, EXTENT_ALLOC_SYSTEM_INODE,
6572 le16_to_cpu(eb->h_suballoc_slot), 6578 le16_to_cpu(eb->h_suballoc_slot),
6579 le64_to_cpu(eb->h_suballoc_loc),
6573 le64_to_cpu(eb->h_blkno), 6580 le64_to_cpu(eb->h_blkno),
6574 le16_to_cpu(eb->h_suballoc_bit)); 6581 le16_to_cpu(eb->h_suballoc_bit));
6575} 6582}
@@ -6883,7 +6890,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
6883 6890
6884 data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv; 6891 data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv;
6885 6892
6886 ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off, 6893 ret = ocfs2_claim_clusters(handle, data_ac, 1, &bit_off,
6887 &num); 6894 &num);
6888 if (ret) { 6895 if (ret) {
6889 mlog_errno(ret); 6896 mlog_errno(ret);