Lines Matching refs:th
91 static int journal_join(struct reiserfs_transaction_handle *th,
109 static int do_journal_begin_r(struct reiserfs_transaction_handle *th,
1903 static int do_journal_release(struct reiserfs_transaction_handle *th, in do_journal_release() argument
1915 BUG_ON(!th->t_trans_id); in do_journal_release()
1916 do_journal_end(th, FLUSH_ALL); in do_journal_release()
1967 int journal_release(struct reiserfs_transaction_handle *th, in journal_release() argument
1970 return do_journal_release(th, sb, 0); in journal_release()
1974 int journal_release_error(struct reiserfs_transaction_handle *th, in journal_release_error() argument
1977 return do_journal_release(th, sb, 1); in journal_release_error()
2917 int journal_transaction_should_end(struct reiserfs_transaction_handle *th, in journal_transaction_should_end() argument
2920 struct reiserfs_journal *journal = SB_JOURNAL(th->t_super); in journal_transaction_should_end()
2923 BUG_ON(!th->t_trans_id); in journal_transaction_should_end()
2924 if (th->t_refcount > 1) in journal_transaction_should_end()
2935 th->t_blocks_allocated += new_alloc ; in journal_transaction_should_end()
2940 void reiserfs_block_writes(struct reiserfs_transaction_handle *th) in reiserfs_block_writes() argument
2942 struct reiserfs_journal *journal = SB_JOURNAL(th->t_super); in reiserfs_block_writes()
2943 BUG_ON(!th->t_trans_id); in reiserfs_block_writes()
3026 static int do_journal_begin_r(struct reiserfs_transaction_handle *th, in do_journal_begin_r() argument
3043 th->t_refcount = 1; in do_journal_begin_r()
3044 th->t_super = sb; in do_journal_begin_r()
3130 th->t_blocks_logged = 0; in do_journal_begin_r()
3131 th->t_blocks_allocated = nblocks; in do_journal_begin_r()
3132 th->t_trans_id = journal->j_trans_id; in do_journal_begin_r()
3134 INIT_LIST_HEAD(&th->t_list); in do_journal_begin_r()
3138 memset(th, 0, sizeof(*th)); in do_journal_begin_r()
3144 th->t_super = sb; in do_journal_begin_r()
3154 struct reiserfs_transaction_handle *th; in reiserfs_persistent_transaction() local
3161 th = current->journal_info; in reiserfs_persistent_transaction()
3162 th->t_refcount++; in reiserfs_persistent_transaction()
3163 BUG_ON(th->t_refcount < 2); in reiserfs_persistent_transaction()
3165 return th; in reiserfs_persistent_transaction()
3167 th = kmalloc(sizeof(struct reiserfs_transaction_handle), GFP_NOFS); in reiserfs_persistent_transaction()
3168 if (!th) in reiserfs_persistent_transaction()
3170 ret = journal_begin(th, s, nblocks); in reiserfs_persistent_transaction()
3172 kfree(th); in reiserfs_persistent_transaction()
3177 return th; in reiserfs_persistent_transaction()
3180 int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *th) in reiserfs_end_persistent_transaction() argument
3182 struct super_block *s = th->t_super; in reiserfs_end_persistent_transaction()
3184 if (th->t_trans_id) in reiserfs_end_persistent_transaction()
3185 ret = journal_end(th); in reiserfs_end_persistent_transaction()
3188 if (th->t_refcount == 0) { in reiserfs_end_persistent_transaction()
3190 kfree(th); in reiserfs_end_persistent_transaction()
3195 static int journal_join(struct reiserfs_transaction_handle *th, in journal_join() argument
3204 th->t_handle_save = cur_th; in journal_join()
3206 return do_journal_begin_r(th, sb, 1, JBEGIN_JOIN); in journal_join()
3209 int journal_join_abort(struct reiserfs_transaction_handle *th, in journal_join_abort() argument
3218 th->t_handle_save = cur_th; in journal_join_abort()
3220 return do_journal_begin_r(th, sb, 1, JBEGIN_ABORT); in journal_join_abort()
3223 int journal_begin(struct reiserfs_transaction_handle *th, in journal_begin() argument
3229 th->t_handle_save = NULL; in journal_begin()
3235 memcpy(th, cur_th, sizeof(*th)); in journal_begin()
3236 if (th->t_refcount <= 1) in journal_begin()
3249 th->t_handle_save = current->journal_info; in journal_begin()
3250 current->journal_info = th; in journal_begin()
3253 current->journal_info = th; in journal_begin()
3255 ret = do_journal_begin_r(th, sb, nblocks, JBEGIN_REG); in journal_begin()
3256 BUG_ON(current->journal_info != th); in journal_begin()
3263 current->journal_info = th->t_handle_save; in journal_begin()
3265 BUG_ON(!th->t_refcount); in journal_begin()
3280 int journal_mark_dirty(struct reiserfs_transaction_handle *th, in journal_mark_dirty() argument
3283 struct super_block *sb = th->t_super; in journal_mark_dirty()
3288 BUG_ON(!th->t_trans_id); in journal_mark_dirty()
3291 if (th->t_trans_id != journal->j_trans_id) { in journal_mark_dirty()
3292 reiserfs_panic(th->t_super, "journal-1577", in journal_mark_dirty()
3294 th->t_trans_id, journal->j_trans_id); in journal_mark_dirty()
3333 reiserfs_panic(th->t_super, "journal-1413", in journal_mark_dirty()
3357 if (th->t_blocks_logged == th->t_blocks_allocated) { in journal_mark_dirty()
3358 th->t_blocks_allocated += JOURNAL_PER_BALANCE_CNT; in journal_mark_dirty()
3361 th->t_blocks_logged++; in journal_mark_dirty()
3387 int journal_end(struct reiserfs_transaction_handle *th) in journal_end() argument
3389 struct super_block *sb = th->t_super; in journal_end()
3390 if (!current->journal_info && th->t_refcount > 1) in journal_end()
3392 "th NULL, refcount %d", th->t_refcount); in journal_end()
3394 if (!th->t_trans_id) { in journal_end()
3399 th->t_refcount--; in journal_end()
3400 if (th->t_refcount > 0) { in journal_end()
3408 BUG_ON(cur_th->t_super != th->t_super); in journal_end()
3410 if (th != cur_th) { in journal_end()
3411 memcpy(current->journal_info, th, sizeof(*th)); in journal_end()
3412 th->t_trans_id = 0; in journal_end()
3416 return do_journal_end(th, 0); in journal_end()
3524 int journal_end_sync(struct reiserfs_transaction_handle *th) in journal_end_sync() argument
3526 struct super_block *sb = th->t_super; in journal_end_sync()
3529 BUG_ON(!th->t_trans_id); in journal_end_sync()
3531 BUG_ON(th->t_refcount > 1); in journal_end_sync()
3535 journal_mark_dirty(th, SB_BUFFER_WITH_SB(sb)); in journal_end_sync()
3537 return do_journal_end(th, COMMIT_NOW | WAIT); in journal_end_sync()
3566 struct reiserfs_transaction_handle th; in reiserfs_flush_old_commits() local
3585 if (!journal_join(&th, sb)) { in reiserfs_flush_old_commits()
3589 journal_mark_dirty(&th, SB_BUFFER_WITH_SB(sb)); in reiserfs_flush_old_commits()
3596 do_journal_end(&th, COMMIT_NOW | WAIT); in reiserfs_flush_old_commits()
3616 static int check_journal_end(struct reiserfs_transaction_handle *th, int flags) in check_journal_end() argument
3624 struct super_block *sb = th->t_super; in check_journal_end()
3627 BUG_ON(!th->t_trans_id); in check_journal_end()
3629 if (th->t_trans_id != journal->j_trans_id) { in check_journal_end()
3630 reiserfs_panic(th->t_super, "journal-1577", in check_journal_end()
3632 th->t_trans_id, journal->j_trans_id); in check_journal_end()
3635 journal->j_len_alloc -= (th->t_blocks_allocated - th->t_blocks_logged); in check_journal_end()
3741 int journal_mark_freed(struct reiserfs_transaction_handle *th, in journal_mark_freed() argument
3749 BUG_ON(!th->t_trans_id); in journal_mark_freed()
3846 struct reiserfs_transaction_handle th; in __commit_trans_jl() local
3866 ret = journal_begin(&th, sb, 1); in __commit_trans_jl()
3874 journal_mark_dirty(&th, SB_BUFFER_WITH_SB(sb)); in __commit_trans_jl()
3875 ret = journal_end(&th); in __commit_trans_jl()
3879 ret = journal_end_sync(&th); in __commit_trans_jl()
3985 static int do_journal_end(struct reiserfs_transaction_handle *th, int flags) in do_journal_end() argument
3987 struct super_block *sb = th->t_super; in do_journal_end()
4006 BUG_ON(th->t_refcount > 1); in do_journal_end()
4007 BUG_ON(!th->t_trans_id); in do_journal_end()
4008 BUG_ON(!th->t_super); in do_journal_end()
4014 if (th->t_trans_id == ~0U) in do_journal_end()
4019 current->journal_info = th->t_handle_save; in do_journal_end()
4024 journal_mark_dirty(th, SB_BUFFER_WITH_SB(sb)); in do_journal_end()
4042 if (!check_journal_end(th, flags)) { in do_journal_end()
4066 current->journal_info = th; in do_journal_end()
4067 th->t_refcount++; in do_journal_end()
4070 reiserfs_discard_all_prealloc(th); in do_journal_end()
4072 th->t_refcount--; in do_journal_end()
4073 current->journal_info = th->t_handle_save; in do_journal_end()
4379 memset(th, 0, sizeof(*th)); in do_journal_end()
4385 th->t_super = sb; in do_journal_end()