aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/localalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/localalloc.c')
-rw-r--r--fs/ocfs2/localalloc.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index 75f09f1b4ced..869383e7c562 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -64,7 +64,6 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb,
64 struct buffer_head *main_bm_bh); 64 struct buffer_head *main_bm_bh);
65 65
66static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb, 66static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb,
67 struct ocfs2_journal_handle *handle,
68 struct ocfs2_alloc_context **ac, 67 struct ocfs2_alloc_context **ac,
69 struct inode **bitmap_inode, 68 struct inode **bitmap_inode,
70 struct buffer_head **bitmap_bh); 69 struct buffer_head **bitmap_bh);
@@ -448,7 +447,6 @@ out:
448 * our own in order to shift windows. 447 * our own in order to shift windows.
449 */ 448 */
450int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb, 449int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
451 struct ocfs2_journal_handle *passed_handle,
452 u32 bits_wanted, 450 u32 bits_wanted,
453 struct ocfs2_alloc_context *ac) 451 struct ocfs2_alloc_context *ac)
454{ 452{
@@ -459,9 +457,7 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
459 457
460 mlog_entry_void(); 458 mlog_entry_void();
461 459
462 BUG_ON(!passed_handle);
463 BUG_ON(!ac); 460 BUG_ON(!ac);
464 BUG_ON(passed_handle->k_handle);
465 461
466 local_alloc_inode = 462 local_alloc_inode =
467 ocfs2_get_system_file_inode(osb, 463 ocfs2_get_system_file_inode(osb,
@@ -472,7 +468,11 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
472 mlog_errno(status); 468 mlog_errno(status);
473 goto bail; 469 goto bail;
474 } 470 }
475 ocfs2_handle_add_inode(passed_handle, local_alloc_inode); 471
472 mutex_lock(&local_alloc_inode->i_mutex);
473
474 ac->ac_inode = local_alloc_inode;
475 ac->ac_which = OCFS2_AC_USE_LOCAL;
476 476
477 if (osb->local_alloc_state != OCFS2_LA_ENABLED) { 477 if (osb->local_alloc_state != OCFS2_LA_ENABLED) {
478 status = -ENOSPC; 478 status = -ENOSPC;
@@ -511,14 +511,10 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
511 } 511 }
512 } 512 }
513 513
514 ac->ac_inode = igrab(local_alloc_inode);
515 get_bh(osb->local_alloc_bh); 514 get_bh(osb->local_alloc_bh);
516 ac->ac_bh = osb->local_alloc_bh; 515 ac->ac_bh = osb->local_alloc_bh;
517 ac->ac_which = OCFS2_AC_USE_LOCAL;
518 status = 0; 516 status = 0;
519bail: 517bail:
520 if (local_alloc_inode)
521 iput(local_alloc_inode);
522 518
523 mlog_exit(status); 519 mlog_exit(status);
524 return status; 520 return status;
@@ -774,7 +770,6 @@ bail:
774} 770}
775 771
776static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb, 772static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb,
777 struct ocfs2_journal_handle *handle,
778 struct ocfs2_alloc_context **ac, 773 struct ocfs2_alloc_context **ac,
779 struct inode **bitmap_inode, 774 struct inode **bitmap_inode,
780 struct buffer_head **bitmap_bh) 775 struct buffer_head **bitmap_bh)
@@ -788,7 +783,6 @@ static int ocfs2_local_alloc_reserve_for_window(struct ocfs2_super *osb,
788 goto bail; 783 goto bail;
789 } 784 }
790 785
791 (*ac)->ac_handle = handle;
792 (*ac)->ac_bits_wanted = ocfs2_local_alloc_window_bits(osb); 786 (*ac)->ac_bits_wanted = ocfs2_local_alloc_window_bits(osb);
793 787
794 status = ocfs2_reserve_cluster_bitmap_bits(osb, *ac); 788 status = ocfs2_reserve_cluster_bitmap_bits(osb, *ac);
@@ -891,16 +885,8 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
891 885
892 mlog_entry_void(); 886 mlog_entry_void();
893 887
894 handle = ocfs2_alloc_handle(osb);
895 if (!handle) {
896 status = -ENOMEM;
897 mlog_errno(status);
898 goto bail;
899 }
900
901 /* This will lock the main bitmap for us. */ 888 /* This will lock the main bitmap for us. */
902 status = ocfs2_local_alloc_reserve_for_window(osb, 889 status = ocfs2_local_alloc_reserve_for_window(osb,
903 handle,
904 &ac, 890 &ac,
905 &main_bm_inode, 891 &main_bm_inode,
906 &main_bm_bh); 892 &main_bm_bh);
@@ -910,7 +896,7 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
910 goto bail; 896 goto bail;
911 } 897 }
912 898
913 handle = ocfs2_start_trans(osb, handle, OCFS2_WINDOW_MOVE_CREDITS); 899 handle = ocfs2_start_trans(osb, NULL, OCFS2_WINDOW_MOVE_CREDITS);
914 if (IS_ERR(handle)) { 900 if (IS_ERR(handle)) {
915 status = PTR_ERR(handle); 901 status = PTR_ERR(handle);
916 handle = NULL; 902 handle = NULL;