Lines Matching refs:journal
94 struct reiserfs_journal *journal);
115 struct reiserfs_journal *journal = SB_JOURNAL(sb); in init_journal_hash() local
116 memset(journal->j_hash_table, 0, in init_journal_hash()
157 struct reiserfs_journal *journal = SB_JOURNAL(sb); in get_bitmap_node() local
159 struct list_head *entry = journal->j_bitmap_nodes.next; in get_bitmap_node()
161 journal->j_used_bitmap_nodes++; in get_bitmap_node()
164 if (entry != &journal->j_bitmap_nodes) { in get_bitmap_node()
168 journal->j_free_bitmap_nodes--; in get_bitmap_node()
181 struct reiserfs_journal *journal = SB_JOURNAL(sb); in free_bitmap_node() local
182 journal->j_used_bitmap_nodes--; in free_bitmap_node()
183 if (journal->j_free_bitmap_nodes > REISERFS_MAX_BITMAP_NODES) { in free_bitmap_node()
187 list_add(&bn->list, &journal->j_bitmap_nodes); in free_bitmap_node()
188 journal->j_free_bitmap_nodes++; in free_bitmap_node()
195 struct reiserfs_journal *journal = SB_JOURNAL(sb); in allocate_bitmap_nodes() local
200 list_add(&bn->list, &journal->j_bitmap_nodes); in allocate_bitmap_nodes()
201 journal->j_free_bitmap_nodes++; in allocate_bitmap_nodes()
258 struct reiserfs_journal *journal = SB_JOURNAL(sb); in free_bitmap_nodes() local
259 struct list_head *next = journal->j_bitmap_nodes.next; in free_bitmap_nodes()
262 while (next != &journal->j_bitmap_nodes) { in free_bitmap_nodes()
267 next = journal->j_bitmap_nodes.next; in free_bitmap_nodes()
268 journal->j_free_bitmap_nodes--; in free_bitmap_nodes()
314 struct reiserfs_journal *journal = SB_JOURNAL(sb); in get_list_bitmap() local
318 i = journal->j_list_bitmap_index; in get_list_bitmap()
319 journal->j_list_bitmap_index = (i + 1) % JOURNAL_NUM_BITMAPS; in get_list_bitmap()
320 jb = journal->j_list_bitmap + i; in get_list_bitmap()
321 if (journal->j_list_bitmap[i].journal_list) { in get_list_bitmap()
323 journal->j_list_bitmap[i]. in get_list_bitmap()
325 if (!journal->j_list_bitmap[i].journal_list) { in get_list_bitmap()
370 struct reiserfs_journal *journal = SB_JOURNAL(sb); in get_cnode() local
374 if (journal->j_cnode_free <= 0) { in get_cnode()
377 journal->j_cnode_used++; in get_cnode()
378 journal->j_cnode_free--; in get_cnode()
379 cn = journal->j_cnode_free_list; in get_cnode()
386 journal->j_cnode_free_list = cn->next; in get_cnode()
397 struct reiserfs_journal *journal = SB_JOURNAL(sb); in free_cnode() local
401 journal->j_cnode_used--; in free_cnode()
402 journal->j_cnode_free++; in free_cnode()
404 cn->next = journal->j_cnode_free_list; in free_cnode()
405 if (journal->j_cnode_free_list) { in free_cnode()
406 journal->j_cnode_free_list->prev = cn; in free_cnode()
409 journal->j_cnode_free_list = cn; in free_cnode()
463 struct reiserfs_journal *journal = SB_JOURNAL(sb); in reiserfs_in_journal() local
470 PROC_INFO_INC(sb, journal.in_journal); in reiserfs_in_journal()
479 PROC_INFO_INC(sb, journal.in_journal_bitmap); in reiserfs_in_journal()
480 jb = journal->j_list_bitmap + i; in reiserfs_in_journal()
499 && (get_journal_hash_dev(sb, journal->j_list_hash_table, bl))) { in reiserfs_in_journal()
504 if ((get_journal_hash_dev(sb, journal->j_hash_table, bl))) { in reiserfs_in_journal()
509 PROC_INFO_INC(sb, journal.in_journal_reusable); in reiserfs_in_journal()
532 PROC_INFO_INC(sb, journal.lock_journal); in lock_journal()
579 struct reiserfs_journal *journal = SB_JOURNAL(s); in journal_list_still_alive() local
580 struct list_head *entry = &journal->j_journal_list; in journal_list_still_alive()
884 struct reiserfs_journal *journal = SB_JOURNAL(s); in flush_older_commits() local
899 if (entry == &journal->j_journal_list || in flush_older_commits()
937 if (entry == &journal->j_journal_list) in flush_older_commits()
977 struct reiserfs_journal *journal = SB_JOURNAL(s); in flush_commit_list() local
993 BUG_ON(trans_id == journal->j_trans_id); in flush_commit_list()
1032 ret = write_ordered_buffers(&journal->j_dirty_buffers_lock, in flush_commit_list()
1033 journal, jl, &jl->j_bh_list); in flush_commit_list()
1046 atomic_inc(&journal->j_async_throttle); in flush_commit_list()
1063 if (atomic_dec_and_test(&journal->j_async_throttle)) in flush_commit_list()
1064 wake_up_var(&journal->j_async_throttle); in flush_commit_list()
1106 if (likely(!retval && !reiserfs_is_journal_aborted (journal))) { in flush_commit_list()
1131 if (journal->j_last_commit_id != 0 && in flush_commit_list()
1132 (jl->j_trans_id - journal->j_last_commit_id) != 1) { in flush_commit_list()
1134 journal->j_last_commit_id, jl->j_trans_id); in flush_commit_list()
1136 journal->j_last_commit_id = jl->j_trans_id; in flush_commit_list()
1144 retval = retval ? retval : journal->j_errno; in flush_commit_list()
1200 struct reiserfs_journal *journal = SB_JOURNAL(sb); in remove_all_from_journal_list() local
1217 remove_journal_hash(sb, journal->j_list_hash_table, in remove_all_from_journal_list()
1240 struct reiserfs_journal *journal = SB_JOURNAL(sb); in _update_journal_header_block() local
1243 if (reiserfs_is_journal_aborted(journal)) in _update_journal_header_block()
1246 if (trans_id >= journal->j_last_flush_trans_id) { in _update_journal_header_block()
1247 if (buffer_locked((journal->j_header_bh))) { in _update_journal_header_block()
1249 __wait_on_buffer(journal->j_header_bh); in _update_journal_header_block()
1251 if (unlikely(!buffer_uptodate(journal->j_header_bh))) { in _update_journal_header_block()
1259 journal->j_last_flush_trans_id = trans_id; in _update_journal_header_block()
1260 journal->j_first_unflushed_offset = offset; in _update_journal_header_block()
1261 jh = (struct reiserfs_journal_header *)(journal->j_header_bh-> in _update_journal_header_block()
1265 jh->j_mount_id = cpu_to_le32(journal->j_mount_id); in _update_journal_header_block()
1267 set_buffer_dirty(journal->j_header_bh); in _update_journal_header_block()
1271 __sync_dirty_buffer(journal->j_header_bh, in _update_journal_header_block()
1274 sync_dirty_buffer(journal->j_header_bh); in _update_journal_header_block()
1277 if (!buffer_uptodate(journal->j_header_bh)) { in _update_journal_header_block()
1302 struct reiserfs_journal *journal = SB_JOURNAL(sb); in flush_older_journal_lists() local
1310 entry = journal->j_journal_list.next; in flush_older_journal_lists()
1312 if (entry == &journal->j_journal_list) in flush_older_journal_lists()
1329 struct reiserfs_journal *journal = SB_JOURNAL(s); in del_from_work_list() local
1332 journal->j_num_work_lists--; in del_from_work_list()
1356 struct reiserfs_journal *journal = SB_JOURNAL(s); in flush_journal_list() local
1362 if (atomic_read(&journal->j_wcount) != 0) { in flush_journal_list()
1364 atomic_read(&journal->j_wcount)); in flush_journal_list()
1369 reiserfs_mutex_lock_safe(&journal->j_flush_mutex, s); in flush_journal_list()
1370 } else if (mutex_trylock(&journal->j_flush_mutex)) { in flush_journal_list()
1375 if (j_len_saved > journal->j_trans_max) { in flush_journal_list()
1394 && !reiserfs_is_journal_aborted(journal)) in flush_journal_list()
1407 if (atomic_read(&journal->j_wcount) != 0) { in flush_journal_list()
1578 err = journal->j_errno; in flush_journal_list()
1601 journal->j_num_lists--; in flush_journal_list()
1604 if (journal->j_last_flush_id != 0 && in flush_journal_list()
1605 (jl->j_trans_id - journal->j_last_flush_id) != 1) { in flush_journal_list()
1607 journal->j_last_flush_id, jl->j_trans_id); in flush_journal_list()
1609 journal->j_last_flush_id = jl->j_trans_id; in flush_journal_list()
1624 mutex_unlock(&journal->j_flush_mutex); in flush_journal_list()
1727 struct reiserfs_journal *journal = SB_JOURNAL(s); in kupdate_transactions() local
1730 reiserfs_mutex_lock_safe(&journal->j_flush_mutex, s); in kupdate_transactions()
1757 if (entry == &journal->j_journal_list) { in kupdate_transactions()
1771 mutex_unlock(&journal->j_flush_mutex); in kupdate_transactions()
1795 struct reiserfs_journal *journal = SB_JOURNAL(s); in flush_used_journal_lists() local
1814 if (tjl->j_list.next == &journal->j_journal_list) in flush_used_journal_lists()
1882 struct reiserfs_journal *journal = SB_JOURNAL(sb); in free_journal_ram() local
1883 kfree(journal->j_current_jl); in free_journal_ram()
1884 journal->j_num_lists--; in free_journal_ram()
1886 vfree(journal->j_cnode_free_orig); in free_journal_ram()
1887 free_list_bitmaps(sb, journal->j_list_bitmap); in free_journal_ram()
1889 if (journal->j_header_bh) { in free_journal_ram()
1890 brelse(journal->j_header_bh); in free_journal_ram()
1896 release_journal_dev(sb, journal); in free_journal_ram()
1897 vfree(journal); in free_journal_ram()
1908 struct reiserfs_journal *journal = SB_JOURNAL(sb); in do_journal_release() local
1933 if (!error && reiserfs_is_journal_aborted(journal)) { in do_journal_release()
2115 struct reiserfs_journal *journal = SB_JOURNAL(sb); in journal_read_transaction() local
2298 journal->j_start = cur_dblock - SB_ONDISK_JOURNAL_1st_BLOCK(sb); in journal_read_transaction()
2299 journal->j_last_flush_trans_id = trans_id; in journal_read_transaction()
2300 journal->j_trans_id = trans_id + 1; in journal_read_transaction()
2302 if (journal->j_trans_id == 0) in journal_read_transaction()
2303 journal->j_trans_id = 10; in journal_read_transaction()
2371 struct reiserfs_journal *journal = SB_JOURNAL(sb); in journal_read() local
2388 journal->j_dev_bd); in journal_read()
2396 journal->j_header_bh = journal_bread(sb, in journal_read()
2399 if (!journal->j_header_bh) { in journal_read()
2402 jh = (struct reiserfs_journal_header *)(journal->j_header_bh->b_data); in journal_read()
2449 reiserfs_breada(journal->j_dev_bd, cur_dblock, in journal_read()
2515 SB_ONDISK_JOURNAL_1st_BLOCK(sb) + journal->j_start; in journal_read()
2532 journal->j_start = le32_to_cpu(jh->j_first_unflushed_offset); in journal_read()
2533 journal->j_trans_id = in journal_read()
2536 if (journal->j_trans_id == 0) in journal_read()
2537 journal->j_trans_id = 10; in journal_read()
2538 journal->j_last_flush_trans_id = in journal_read()
2540 journal->j_mount_id = le32_to_cpu(jh->j_mount_id) + 1; in journal_read()
2542 journal->j_mount_id = newest_mount_id + 1; in journal_read()
2545 "newest_mount_id to %lu", journal->j_mount_id); in journal_read()
2546 journal->j_first_unflushed_offset = journal->j_start; in journal_read()
2555 _update_journal_header_block(sb, journal->j_start, in journal_read()
2556 journal->j_last_flush_trans_id)) { in journal_read()
2589 struct reiserfs_journal *journal) in release_journal_dev() argument
2591 if (journal->j_dev_bd != NULL) { in release_journal_dev()
2592 blkdev_put(journal->j_dev_bd, journal->j_dev_mode); in release_journal_dev()
2593 journal->j_dev_bd = NULL; in release_journal_dev()
2598 struct reiserfs_journal *journal, in journal_init_dev() argument
2607 journal->j_dev_bd = NULL; in journal_init_dev()
2618 journal->j_dev_bd = blkdev_get_by_dev(jdev, blkdev_mode, in journal_init_dev()
2619 journal); in journal_init_dev()
2620 journal->j_dev_mode = blkdev_mode; in journal_init_dev()
2621 if (IS_ERR(journal->j_dev_bd)) { in journal_init_dev()
2622 result = PTR_ERR(journal->j_dev_bd); in journal_init_dev()
2623 journal->j_dev_bd = NULL; in journal_init_dev()
2629 set_blocksize(journal->j_dev_bd, super->s_blocksize); in journal_init_dev()
2634 journal->j_dev_mode = blkdev_mode; in journal_init_dev()
2635 journal->j_dev_bd = blkdev_get_by_path(jdev_name, blkdev_mode, journal); in journal_init_dev()
2636 if (IS_ERR(journal->j_dev_bd)) { in journal_init_dev()
2637 result = PTR_ERR(journal->j_dev_bd); in journal_init_dev()
2638 journal->j_dev_bd = NULL; in journal_init_dev()
2645 set_blocksize(journal->j_dev_bd, super->s_blocksize); in journal_init_dev()
2648 journal->j_dev_bd); in journal_init_dev()
2667 struct reiserfs_journal *journal) in check_advise_trans_params() argument
2669 if (journal->j_trans_max) { in check_advise_trans_params()
2675 if (journal->j_trans_max > JOURNAL_TRANS_MAX_DEFAULT / ratio || in check_advise_trans_params()
2676 journal->j_trans_max < JOURNAL_TRANS_MIN_DEFAULT / ratio || in check_advise_trans_params()
2677 SB_ONDISK_JOURNAL_SIZE(sb) / journal->j_trans_max < in check_advise_trans_params()
2681 "FSCK?", journal->j_trans_max); in check_advise_trans_params()
2684 if (journal->j_max_batch != (journal->j_trans_max) * in check_advise_trans_params()
2688 "FSCK?", journal->j_max_batch); in check_advise_trans_params()
2703 journal->j_trans_max = JOURNAL_TRANS_MAX_DEFAULT; in check_advise_trans_params()
2704 journal->j_max_batch = JOURNAL_MAX_BATCH_DEFAULT; in check_advise_trans_params()
2705 journal->j_max_commit_age = JOURNAL_MAX_COMMIT_AGE; in check_advise_trans_params()
2718 struct reiserfs_journal *journal; in journal_init() local
2722 journal = SB_JOURNAL(sb) = vzalloc(sizeof(struct reiserfs_journal)); in journal_init()
2723 if (!journal) { in journal_init()
2728 INIT_LIST_HEAD(&journal->j_bitmap_nodes); in journal_init()
2729 INIT_LIST_HEAD(&journal->j_prealloc_list); in journal_init()
2730 INIT_LIST_HEAD(&journal->j_working_list); in journal_init()
2731 INIT_LIST_HEAD(&journal->j_journal_list); in journal_init()
2732 journal->j_persistent_trans = 0; in journal_init()
2733 if (reiserfs_allocate_list_bitmaps(sb, journal->j_list_bitmap, in journal_init()
2779 if (journal_init_dev(sb, journal, j_dev_name) != 0) { in journal_init()
2806 journal->j_dev_bd, in journal_init()
2812 journal->j_trans_max = le32_to_cpu(jh->jh_journal.jp_journal_trans_max); in journal_init()
2813 journal->j_max_batch = le32_to_cpu(jh->jh_journal.jp_journal_max_batch); in journal_init()
2814 journal->j_max_commit_age = in journal_init()
2816 journal->j_max_trans_age = JOURNAL_MAX_TRANS_AGE; in journal_init()
2818 if (check_advise_trans_params(sb, journal) != 0) in journal_init()
2820 journal->j_default_max_commit_age = journal->j_max_commit_age; in journal_init()
2823 journal->j_max_commit_age = commit_max_age; in journal_init()
2824 journal->j_max_trans_age = commit_max_age; in journal_init()
2830 journal->j_dev_bd, in journal_init()
2833 journal->j_trans_max, in journal_init()
2834 journal->j_max_batch, in journal_init()
2835 journal->j_max_commit_age, journal->j_max_trans_age); in journal_init()
2839 journal->j_list_bitmap_index = 0; in journal_init()
2842 memset(journal->j_list_hash_table, 0, in journal_init()
2845 INIT_LIST_HEAD(&journal->j_dirty_buffers); in journal_init()
2846 spin_lock_init(&journal->j_dirty_buffers_lock); in journal_init()
2848 journal->j_start = 0; in journal_init()
2849 journal->j_len = 0; in journal_init()
2850 journal->j_len_alloc = 0; in journal_init()
2851 atomic_set(&journal->j_wcount, 0); in journal_init()
2852 atomic_set(&journal->j_async_throttle, 0); in journal_init()
2853 journal->j_bcount = 0; in journal_init()
2854 journal->j_trans_start_time = 0; in journal_init()
2855 journal->j_last = NULL; in journal_init()
2856 journal->j_first = NULL; in journal_init()
2857 init_waitqueue_head(&journal->j_join_wait); in journal_init()
2858 mutex_init(&journal->j_mutex); in journal_init()
2859 mutex_init(&journal->j_flush_mutex); in journal_init()
2861 journal->j_trans_id = 10; in journal_init()
2862 journal->j_mount_id = 10; in journal_init()
2863 journal->j_state = 0; in journal_init()
2864 atomic_set(&journal->j_jlock, 0); in journal_init()
2865 journal->j_cnode_free_list = allocate_cnodes(num_cnodes); in journal_init()
2866 journal->j_cnode_free_orig = journal->j_cnode_free_list; in journal_init()
2867 journal->j_cnode_free = journal->j_cnode_free_list ? num_cnodes : 0; in journal_init()
2868 journal->j_cnode_used = 0; in journal_init()
2869 journal->j_must_wait = 0; in journal_init()
2871 if (journal->j_cnode_free == 0) { in journal_init()
2881 jl = journal->j_current_jl; in journal_init()
2904 INIT_DELAYED_WORK(&journal->j_work, flush_async_commits); in journal_init()
2905 journal->j_work_sb = sb; in journal_init()
2920 struct reiserfs_journal *journal = SB_JOURNAL(th->t_super); in journal_transaction_should_end() local
2926 if (journal->j_must_wait > 0 || in journal_transaction_should_end()
2927 (journal->j_len_alloc + new_alloc) >= journal->j_max_batch || in journal_transaction_should_end()
2928 atomic_read(&journal->j_jlock) || in journal_transaction_should_end()
2929 (now - journal->j_trans_start_time) > journal->j_max_trans_age || in journal_transaction_should_end()
2930 journal->j_cnode_free < (journal->j_trans_max * 3)) { in journal_transaction_should_end()
2934 journal->j_len_alloc += new_alloc; in journal_transaction_should_end()
2942 struct reiserfs_journal *journal = SB_JOURNAL(th->t_super); in reiserfs_block_writes() local
2944 journal->j_must_wait = 1; in reiserfs_block_writes()
2945 set_bit(J_WRITERS_BLOCKED, &journal->j_state); in reiserfs_block_writes()
2952 struct reiserfs_journal *journal = SB_JOURNAL(s); in reiserfs_allow_writes() local
2953 clear_bit(J_WRITERS_BLOCKED, &journal->j_state); in reiserfs_allow_writes()
2954 wake_up(&journal->j_join_wait); in reiserfs_allow_writes()
2960 struct reiserfs_journal *journal = SB_JOURNAL(s); in reiserfs_wait_on_write_block() local
2961 wait_event(journal->j_join_wait, in reiserfs_wait_on_write_block()
2962 !test_bit(J_WRITERS_BLOCKED, &journal->j_state)); in reiserfs_wait_on_write_block()
2968 struct reiserfs_journal *journal = SB_JOURNAL(s); in queue_log_writer() local
2969 set_bit(J_WRITERS_QUEUED, &journal->j_state); in queue_log_writer()
2976 add_wait_queue(&journal->j_join_wait, &wait); in queue_log_writer()
2978 if (test_bit(J_WRITERS_QUEUED, &journal->j_state)) { in queue_log_writer()
2984 remove_wait_queue(&journal->j_join_wait, &wait); in queue_log_writer()
2989 struct reiserfs_journal *journal = SB_JOURNAL(s); in wake_queued_writers() local
2990 if (test_and_clear_bit(J_WRITERS_QUEUED, &journal->j_state)) in wake_queued_writers()
2991 wake_up(&journal->j_join_wait); in wake_queued_writers()
2996 struct reiserfs_journal *journal = SB_JOURNAL(sb); in let_transaction_grow() local
2997 unsigned long bcount = journal->j_bcount; in let_transaction_grow()
3005 journal->j_current_jl->j_state |= LIST_COMMIT_PENDING; in let_transaction_grow()
3006 while ((atomic_read(&journal->j_wcount) > 0 || in let_transaction_grow()
3007 atomic_read(&journal->j_jlock)) && in let_transaction_grow()
3008 journal->j_trans_id == trans_id) { in let_transaction_grow()
3011 if (journal->j_trans_id != trans_id) in let_transaction_grow()
3013 if (bcount == journal->j_bcount) in let_transaction_grow()
3015 bcount = journal->j_bcount; in let_transaction_grow()
3032 struct reiserfs_journal *journal = SB_JOURNAL(sb); in do_journal_begin_r() local
3039 BUG_ON(nblocks > journal->j_trans_max); in do_journal_begin_r()
3041 PROC_INFO_INC(sb, journal.journal_being); in do_journal_begin_r()
3048 if (join != JBEGIN_ABORT && reiserfs_is_journal_aborted(journal)) { in do_journal_begin_r()
3050 retval = journal->j_errno; in do_journal_begin_r()
3053 journal->j_bcount++; in do_journal_begin_r()
3055 if (test_bit(J_WRITERS_BLOCKED, &journal->j_state)) { in do_journal_begin_r()
3060 PROC_INFO_INC(sb, journal.journal_relock_writers); in do_journal_begin_r()
3072 if ((!join && journal->j_must_wait > 0) || in do_journal_begin_r()
3074 && (journal->j_len_alloc + nblocks + 2) >= journal->j_max_batch) in do_journal_begin_r()
3075 || (!join && atomic_read(&journal->j_wcount) > 0 in do_journal_begin_r()
3076 && journal->j_trans_start_time > 0 in do_journal_begin_r()
3077 && (now - journal->j_trans_start_time) > in do_journal_begin_r()
3078 journal->j_max_trans_age) || (!join in do_journal_begin_r()
3079 && atomic_read(&journal->j_jlock)) in do_journal_begin_r()
3080 || (!join && journal->j_cnode_free < (journal->j_trans_max * 3))) { in do_journal_begin_r()
3082 old_trans_id = journal->j_trans_id; in do_journal_begin_r()
3086 if (!join && (journal->j_len_alloc + nblocks + 2) >= in do_journal_begin_r()
3087 journal->j_max_batch && in do_journal_begin_r()
3088 ((journal->j_len + nblocks + 2) * 100) < in do_journal_begin_r()
3089 (journal->j_len_alloc * 75)) { in do_journal_begin_r()
3090 if (atomic_read(&journal->j_wcount) > 10) { in do_journal_begin_r()
3100 if (atomic_read(&journal->j_jlock)) { in do_journal_begin_r()
3101 while (journal->j_trans_id == old_trans_id && in do_journal_begin_r()
3102 atomic_read(&journal->j_jlock)) { in do_journal_begin_r()
3112 if (old_trans_id != journal->j_trans_id) { in do_journal_begin_r()
3121 PROC_INFO_INC(sb, journal.journal_relock_wcount); in do_journal_begin_r()
3125 if (journal->j_trans_start_time == 0) { in do_journal_begin_r()
3126 journal->j_trans_start_time = ktime_get_seconds(); in do_journal_begin_r()
3128 atomic_inc(&journal->j_wcount); in do_journal_begin_r()
3129 journal->j_len_alloc += nblocks; in do_journal_begin_r()
3132 th->t_trans_id = journal->j_trans_id; in do_journal_begin_r()
3284 struct reiserfs_journal *journal = SB_JOURNAL(sb); in journal_mark_dirty() local
3290 PROC_INFO_INC(sb, journal.mark_dirty); in journal_mark_dirty()
3291 if (th->t_trans_id != journal->j_trans_id) { in journal_mark_dirty()
3294 th->t_trans_id, journal->j_trans_id); in journal_mark_dirty()
3301 PROC_INFO_INC(sb, journal.mark_dirty_already); in journal_mark_dirty()
3321 if (atomic_read(&journal->j_wcount) <= 0) { in journal_mark_dirty()
3324 atomic_read(&journal->j_wcount)); in journal_mark_dirty()
3332 if (journal->j_len >= journal->j_trans_max) { in journal_mark_dirty()
3335 journal->j_len); in journal_mark_dirty()
3340 PROC_INFO_INC(sb, journal.mark_dirty_notjournal); in journal_mark_dirty()
3344 if (journal->j_len > journal->j_len_alloc) { in journal_mark_dirty()
3345 journal->j_len_alloc = journal->j_len + JOURNAL_PER_BALANCE_CNT; in journal_mark_dirty()
3359 journal->j_len_alloc += JOURNAL_PER_BALANCE_CNT; in journal_mark_dirty()
3362 journal->j_len++; in journal_mark_dirty()
3368 insert_journal_hash(journal->j_hash_table, cn); in journal_mark_dirty()
3374 cn->prev = journal->j_last; in journal_mark_dirty()
3376 if (journal->j_last) { in journal_mark_dirty()
3377 journal->j_last->next = cn; in journal_mark_dirty()
3378 journal->j_last = cn; in journal_mark_dirty()
3380 journal->j_first = cn; in journal_mark_dirty()
3381 journal->j_last = cn; in journal_mark_dirty()
3433 struct reiserfs_journal *journal = SB_JOURNAL(sb); in remove_from_transaction() local
3436 cn = get_journal_hash_dev(sb, journal->j_hash_table, blocknr); in remove_from_transaction()
3447 if (cn == journal->j_first) { in remove_from_transaction()
3448 journal->j_first = cn->next; in remove_from_transaction()
3450 if (cn == journal->j_last) { in remove_from_transaction()
3451 journal->j_last = cn->prev; in remove_from_transaction()
3453 remove_journal_hash(sb, journal->j_hash_table, NULL, in remove_from_transaction()
3468 journal->j_len--; in remove_from_transaction()
3469 journal->j_len_alloc--; in remove_from_transaction()
3527 struct reiserfs_journal *journal = SB_JOURNAL(sb); in journal_end_sync() local
3532 if (journal->j_len == 0) { in journal_end_sync()
3543 struct reiserfs_journal *journal = in flush_async_commits() local
3545 struct super_block *sb = journal->j_work_sb; in flush_async_commits()
3550 if (!list_empty(&journal->j_journal_list)) { in flush_async_commits()
3552 entry = journal->j_journal_list.prev; in flush_async_commits()
3567 struct reiserfs_journal *journal = SB_JOURNAL(sb); in reiserfs_flush_old_commits() local
3574 if (list_empty(&journal->j_journal_list)) in reiserfs_flush_old_commits()
3581 if (atomic_read(&journal->j_wcount) <= 0 && in reiserfs_flush_old_commits()
3582 journal->j_trans_start_time > 0 && in reiserfs_flush_old_commits()
3583 journal->j_len > 0 && in reiserfs_flush_old_commits()
3584 (now - journal->j_trans_start_time) > journal->j_max_trans_age) { in reiserfs_flush_old_commits()
3625 struct reiserfs_journal *journal = SB_JOURNAL(sb); in check_journal_end() local
3629 if (th->t_trans_id != journal->j_trans_id) { 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()
3637 if (atomic_read(&journal->j_wcount) > 0) in check_journal_end()
3638 atomic_dec(&journal->j_wcount); in check_journal_end()
3646 BUG_ON(journal->j_len == 0); in check_journal_end()
3656 if (atomic_read(&journal->j_wcount) > 0) { in check_journal_end()
3660 jl = journal->j_current_jl; in check_journal_end()
3664 atomic_set(&journal->j_jlock, 1); in check_journal_end()
3666 journal->j_next_full_flush = 1; in check_journal_end()
3674 while (journal->j_trans_id == trans_id) { in check_journal_end()
3675 if (atomic_read(&journal->j_jlock)) { in check_journal_end()
3679 if (journal->j_trans_id == trans_id) { in check_journal_end()
3680 atomic_set(&journal->j_jlock, in check_journal_end()
3686 BUG_ON(journal->j_trans_id == trans_id); in check_journal_end()
3701 if ((now - journal->j_trans_start_time) > journal->j_max_trans_age) { in check_journal_end()
3703 journal->j_next_async_flush = 1; in check_journal_end()
3707 if (!(journal->j_must_wait > 0) && !(atomic_read(&journal->j_jlock)) in check_journal_end()
3708 && !flush && !commit_now && (journal->j_len < journal->j_max_batch) in check_journal_end()
3709 && journal->j_len_alloc < journal->j_max_batch in check_journal_end()
3710 && journal->j_cnode_free > (journal->j_trans_max * 3)) { in check_journal_end()
3711 journal->j_bcount++; in check_journal_end()
3716 if (journal->j_start > SB_ONDISK_JOURNAL_SIZE(sb)) { in check_journal_end()
3719 journal->j_start); in check_journal_end()
3744 struct reiserfs_journal *journal = SB_JOURNAL(sb); in journal_mark_freed() local
3751 cn = get_journal_hash_dev(sb, journal->j_hash_table, blocknr); in journal_mark_freed()
3767 jb = journal->j_current_jl->j_list_bitmap; in journal_mark_freed()
3786 cn = get_journal_hash_dev(sb, journal->j_list_hash_table, in journal_mark_freed()
3834 struct reiserfs_journal *journal = SB_JOURNAL(inode->i_sb); in reiserfs_update_inode_transaction() local
3835 REISERFS_I(inode)->i_jl = journal->j_current_jl; in reiserfs_update_inode_transaction()
3836 REISERFS_I(inode)->i_trans_id = journal->j_trans_id; in reiserfs_update_inode_transaction()
3848 struct reiserfs_journal *journal = SB_JOURNAL(sb); in __commit_trans_jl() local
3855 if (id == journal->j_trans_id) { in __commit_trans_jl()
3856 jl = journal->j_current_jl; in __commit_trans_jl()
3862 if (journal->j_trans_id != id) { in __commit_trans_jl()
3871 if (journal->j_trans_id != id) { in __commit_trans_jl()
3899 if (journal->j_errno) in __commit_trans_jl()
3900 ret = journal->j_errno; in __commit_trans_jl()
3928 struct reiserfs_journal *journal = SB_JOURNAL(sb); in reiserfs_restore_prepared_buffer() local
3929 PROC_INFO_INC(sb, journal.restore_prepared); in reiserfs_restore_prepared_buffer()
3938 journal->j_list_hash_table, in reiserfs_restore_prepared_buffer()
3959 PROC_INFO_INC(sb, journal.prepare); in reiserfs_prepare_for_journal()
3988 struct reiserfs_journal *journal = SB_JOURNAL(sb); in do_journal_end() local
4021 if (journal->j_len == 0) { in do_journal_end()
4028 if (journal->j_next_full_flush) { in do_journal_end()
4032 if (journal->j_next_async_flush) { in do_journal_end()
4050 if (journal->j_next_full_flush) { in do_journal_end()
4058 if (journal->j_must_wait > 0) { in do_journal_end()
4080 journal->j_start); in do_journal_end()
4085 set_desc_trans_id(desc, journal->j_trans_id); in do_journal_end()
4092 ((journal->j_start + journal->j_len + in do_journal_end()
4096 set_commit_trans_id(commit, journal->j_trans_id); in do_journal_end()
4100 jl = journal->j_current_jl; in do_journal_end()
4114 jl->j_trans_id = journal->j_trans_id; in do_journal_end()
4115 jl->j_timestamp = journal->j_trans_start_time; in do_journal_end()
4117 jl->j_start = journal->j_start; in do_journal_end()
4118 jl->j_len = journal->j_len; in do_journal_end()
4119 atomic_set(&jl->j_nonzerolen, journal->j_len); in do_journal_end()
4120 atomic_set(&jl->j_commit_left, journal->j_len + 2); in do_journal_end()
4129 for (i = 0, cn = journal->j_first; cn; cn = cn->next, i++) { in do_journal_end()
4161 insert_journal_hash(journal->j_list_hash_table, jl_cn); in do_journal_end()
4173 set_desc_trans_len(desc, journal->j_len); in do_journal_end()
4174 set_desc_mount_id(desc, journal->j_mount_id); in do_journal_end()
4175 set_desc_trans_id(desc, journal->j_trans_id); in do_journal_end()
4176 set_commit_trans_len(commit, journal->j_len); in do_journal_end()
4182 BUG_ON(journal->j_len == 0); in do_journal_end()
4195 cur_write_start = journal->j_start; in do_journal_end()
4196 cn = journal->j_first; in do_journal_end()
4244 journal->j_current_jl = alloc_journal_list(sb); in do_journal_end()
4247 list_add_tail(&jl->j_list, &journal->j_journal_list); in do_journal_end()
4248 list_add_tail(&jl->j_working_list, &journal->j_working_list); in do_journal_end()
4249 journal->j_num_work_lists++; in do_journal_end()
4252 journal->j_start = in do_journal_end()
4253 (journal->j_start + journal->j_len + in do_journal_end()
4255 atomic_set(&journal->j_wcount, 0); in do_journal_end()
4256 journal->j_bcount = 0; in do_journal_end()
4257 journal->j_last = NULL; in do_journal_end()
4258 journal->j_first = NULL; in do_journal_end()
4259 journal->j_len = 0; in do_journal_end()
4260 journal->j_trans_start_time = 0; in do_journal_end()
4262 if (++journal->j_trans_id == 0) in do_journal_end()
4263 journal->j_trans_id = 10; in do_journal_end()
4264 journal->j_current_jl->j_trans_id = journal->j_trans_id; in do_journal_end()
4265 journal->j_must_wait = 0; in do_journal_end()
4266 journal->j_len_alloc = 0; in do_journal_end()
4267 journal->j_next_full_flush = 0; in do_journal_end()
4268 journal->j_next_async_flush = 0; in do_journal_end()
4286 write_ordered_buffers(&journal->j_dirty_buffers_lock, in do_journal_end()
4287 journal, jl, &jl->j_tail_bh_list); in do_journal_end()
4311 &journal->j_work, HZ / 10); in do_journal_end()
4320 list_for_each_safe(entry, safe, &journal->j_journal_list) { in do_journal_end()
4322 if (journal->j_start <= temp_jl->j_start) { in do_journal_end()
4323 if ((journal->j_start + journal->j_trans_max + 1) >= in do_journal_end()
4327 } else if ((journal->j_start + in do_journal_end()
4328 journal->j_trans_max + 1) < in do_journal_end()
4338 } else if ((journal->j_start + in do_journal_end()
4339 journal->j_trans_max + 1) > in do_journal_end()
4341 if (((journal->j_start + journal->j_trans_max + 1) % in do_journal_end()
4358 journal->j_current_jl->j_list_bitmap = in do_journal_end()
4359 get_list_bitmap(sb, journal->j_current_jl); in do_journal_end()
4361 if (!(journal->j_current_jl->j_list_bitmap)) { in do_journal_end()
4366 atomic_set(&journal->j_jlock, 0); in do_journal_end()
4369 clear_bit(J_WRITERS_QUEUED, &journal->j_state); in do_journal_end()
4370 wake_up(&journal->j_join_wait); in do_journal_end()
4387 return journal->j_errno; in do_journal_end()
4393 struct reiserfs_journal *journal = SB_JOURNAL(sb); in reiserfs_abort_journal() local
4394 if (test_bit(J_ABORTED, &journal->j_state)) in reiserfs_abort_journal()
4397 if (!journal->j_errno) in reiserfs_abort_journal()
4398 journal->j_errno = errno; in reiserfs_abort_journal()
4401 set_bit(J_ABORTED, &journal->j_state); in reiserfs_abort_journal()