Lines Matching defs:th

91 static int journal_join(struct reiserfs_transaction_handle *th,
108 static int do_journal_begin_r(struct reiserfs_transaction_handle *th,
1903 static int do_journal_release(struct reiserfs_transaction_handle *th,
1915 BUG_ON(!th->t_trans_id);
1916 do_journal_end(th, FLUSH_ALL);
1967 int journal_release(struct reiserfs_transaction_handle *th,
1970 return do_journal_release(th, sb, 0);
1974 int journal_release_error(struct reiserfs_transaction_handle *th,
1977 return do_journal_release(th, sb, 1);
2918 int journal_transaction_should_end(struct reiserfs_transaction_handle *th,
2921 struct reiserfs_journal *journal = SB_JOURNAL(th->t_super);
2924 BUG_ON(!th->t_trans_id);
2925 if (th->t_refcount > 1)
2936 th->t_blocks_allocated += new_alloc ;
2941 void reiserfs_block_writes(struct reiserfs_transaction_handle *th)
2943 struct reiserfs_journal *journal = SB_JOURNAL(th->t_super);
2944 BUG_ON(!th->t_trans_id);
3027 static int do_journal_begin_r(struct reiserfs_transaction_handle *th,
3043 th->t_refcount = 1;
3044 th->t_super = sb;
3129 th->t_blocks_logged = 0;
3130 th->t_blocks_allocated = nblocks;
3131 th->t_trans_id = journal->j_trans_id;
3133 INIT_LIST_HEAD(&th->t_list);
3137 memset(th, 0, sizeof(*th));
3139 * Re-set th->t_super, so we can properly keep track of how many
3143 th->t_super = sb;
3153 struct reiserfs_transaction_handle *th;
3160 th = current->journal_info;
3161 th->t_refcount++;
3162 BUG_ON(th->t_refcount < 2);
3164 return th;
3166 th = kmalloc(sizeof(struct reiserfs_transaction_handle), GFP_NOFS);
3167 if (!th)
3169 ret = journal_begin(th, s, nblocks);
3171 kfree(th);
3176 return th;
3179 int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *th)
3181 struct super_block *s = th->t_super;
3183 if (th->t_trans_id)
3184 ret = journal_end(th);
3187 if (th->t_refcount == 0) {
3189 kfree(th);
3194 static int journal_join(struct reiserfs_transaction_handle *th,
3203 th->t_handle_save = cur_th;
3205 return do_journal_begin_r(th, sb, 1, JBEGIN_JOIN);
3208 int journal_join_abort(struct reiserfs_transaction_handle *th,
3217 th->t_handle_save = cur_th;
3219 return do_journal_begin_r(th, sb, 1, JBEGIN_ABORT);
3222 int journal_begin(struct reiserfs_transaction_handle *th,
3228 th->t_handle_save = NULL;
3234 memcpy(th, cur_th, sizeof(*th));
3235 if (th->t_refcount <= 1)
3248 th->t_handle_save = current->journal_info;
3249 current->journal_info = th;
3252 current->journal_info = th;
3254 ret = do_journal_begin_r(th, sb, nblocks, JBEGIN_REG);
3255 BUG_ON(current->journal_info != th);
3262 current->journal_info = th->t_handle_save;
3264 BUG_ON(!th->t_refcount);
3279 int journal_mark_dirty(struct reiserfs_transaction_handle *th,
3282 struct super_block *sb = th->t_super;
3287 BUG_ON(!th->t_trans_id);
3290 if (th->t_trans_id != journal->j_trans_id) {
3291 reiserfs_panic(th->t_super, "journal-1577",
3293 th->t_trans_id, journal->j_trans_id);
3332 reiserfs_panic(th->t_super, "journal-1413",
3356 if (th->t_blocks_logged == th->t_blocks_allocated) {
3357 th->t_blocks_allocated += JOURNAL_PER_BALANCE_CNT;
3360 th->t_blocks_logged++;
3386 int journal_end(struct reiserfs_transaction_handle *th)
3388 struct super_block *sb = th->t_super;
3389 if (!current->journal_info && th->t_refcount > 1)
3391 "th NULL, refcount %d", th->t_refcount);
3393 if (!th->t_trans_id) {
3398 th->t_refcount--;
3399 if (th->t_refcount > 0) {
3407 BUG_ON(cur_th->t_super != th->t_super);
3409 if (th != cur_th) {
3410 memcpy(current->journal_info, th, sizeof(*th));
3411 th->t_trans_id = 0;
3415 return do_journal_end(th, 0);
3523 int journal_end_sync(struct reiserfs_transaction_handle *th)
3525 struct super_block *sb = th->t_super;
3528 BUG_ON(!th->t_trans_id);
3530 BUG_ON(th->t_refcount > 1);
3534 journal_mark_dirty(th, SB_BUFFER_WITH_SB(sb));
3536 return do_journal_end(th, COMMIT_NOW | WAIT);
3565 struct reiserfs_transaction_handle th;
3584 if (!journal_join(&th, sb)) {
3588 journal_mark_dirty(&th, SB_BUFFER_WITH_SB(sb));
3595 do_journal_end(&th, COMMIT_NOW | WAIT);
3615 static int check_journal_end(struct reiserfs_transaction_handle *th, int flags)
3623 struct super_block *sb = th->t_super;
3626 BUG_ON(!th->t_trans_id);
3628 if (th->t_trans_id != journal->j_trans_id) {
3629 reiserfs_panic(th->t_super, "journal-1577",
3631 th->t_trans_id, journal->j_trans_id);
3634 journal->j_len_alloc -= (th->t_blocks_allocated - th->t_blocks_logged);
3740 int journal_mark_freed(struct reiserfs_transaction_handle *th,
3748 BUG_ON(!th->t_trans_id);
3845 struct reiserfs_transaction_handle th;
3865 ret = journal_begin(&th, sb, 1);
3873 journal_mark_dirty(&th, SB_BUFFER_WITH_SB(sb));
3874 ret = journal_end(&th);
3878 ret = journal_end_sync(&th);
3984 static int do_journal_end(struct reiserfs_transaction_handle *th, int flags)
3986 struct super_block *sb = th->t_super;
4005 BUG_ON(th->t_refcount > 1);
4006 BUG_ON(!th->t_trans_id);
4007 BUG_ON(!th->t_super);
4013 if (th->t_trans_id == ~0U)
4018 current->journal_info = th->t_handle_save;
4023 journal_mark_dirty(th, SB_BUFFER_WITH_SB(sb));
4041 if (!check_journal_end(th, flags)) {
4065 current->journal_info = th;
4066 th->t_refcount++;
4069 reiserfs_discard_all_prealloc(th);
4071 th->t_refcount--;
4072 current->journal_info = th->t_handle_save;
4378 memset(th, 0, sizeof(*th));
4380 * Re-set th->t_super, so we can properly keep track of how many
4384 th->t_super = sb;