• Home
  • Raw
  • Download

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()
975 struct reiserfs_journal *journal = SB_JOURNAL(s); in flush_commit_list() local
991 BUG_ON(trans_id == journal->j_trans_id); in flush_commit_list()
1030 ret = write_ordered_buffers(&journal->j_dirty_buffers_lock, in flush_commit_list()
1031 journal, jl, &jl->j_bh_list); in flush_commit_list()
1044 atomic_inc(&journal->j_async_throttle); in flush_commit_list()
1061 atomic_dec(&journal->j_async_throttle); in flush_commit_list()
1103 if (likely(!retval && !reiserfs_is_journal_aborted (journal))) { in flush_commit_list()
1128 if (journal->j_last_commit_id != 0 && in flush_commit_list()
1129 (jl->j_trans_id - journal->j_last_commit_id) != 1) { in flush_commit_list()
1131 journal->j_last_commit_id, jl->j_trans_id); in flush_commit_list()
1133 journal->j_last_commit_id = jl->j_trans_id; in flush_commit_list()
1141 retval = retval ? retval : journal->j_errno; in flush_commit_list()
1197 struct reiserfs_journal *journal = SB_JOURNAL(sb); in remove_all_from_journal_list() local
1214 remove_journal_hash(sb, journal->j_list_hash_table, in remove_all_from_journal_list()
1237 struct reiserfs_journal *journal = SB_JOURNAL(sb); in _update_journal_header_block() local
1240 if (reiserfs_is_journal_aborted(journal)) in _update_journal_header_block()
1243 if (trans_id >= journal->j_last_flush_trans_id) { in _update_journal_header_block()
1244 if (buffer_locked((journal->j_header_bh))) { in _update_journal_header_block()
1246 __wait_on_buffer(journal->j_header_bh); in _update_journal_header_block()
1248 if (unlikely(!buffer_uptodate(journal->j_header_bh))) { in _update_journal_header_block()
1256 journal->j_last_flush_trans_id = trans_id; in _update_journal_header_block()
1257 journal->j_first_unflushed_offset = offset; in _update_journal_header_block()
1258 jh = (struct reiserfs_journal_header *)(journal->j_header_bh-> in _update_journal_header_block()
1262 jh->j_mount_id = cpu_to_le32(journal->j_mount_id); in _update_journal_header_block()
1264 set_buffer_dirty(journal->j_header_bh); in _update_journal_header_block()
1268 __sync_dirty_buffer(journal->j_header_bh, in _update_journal_header_block()
1271 sync_dirty_buffer(journal->j_header_bh); in _update_journal_header_block()
1274 if (!buffer_uptodate(journal->j_header_bh)) { in _update_journal_header_block()
1299 struct reiserfs_journal *journal = SB_JOURNAL(sb); in flush_older_journal_lists() local
1307 entry = journal->j_journal_list.next; in flush_older_journal_lists()
1309 if (entry == &journal->j_journal_list) in flush_older_journal_lists()
1326 struct reiserfs_journal *journal = SB_JOURNAL(s); in del_from_work_list() local
1329 journal->j_num_work_lists--; in del_from_work_list()
1353 struct reiserfs_journal *journal = SB_JOURNAL(s); in flush_journal_list() local
1359 if (atomic_read(&journal->j_wcount) != 0) { in flush_journal_list()
1361 atomic_read(&journal->j_wcount)); in flush_journal_list()
1366 reiserfs_mutex_lock_safe(&journal->j_flush_mutex, s); in flush_journal_list()
1367 } else if (mutex_trylock(&journal->j_flush_mutex)) { in flush_journal_list()
1372 if (j_len_saved > journal->j_trans_max) { in flush_journal_list()
1391 && !reiserfs_is_journal_aborted(journal)) in flush_journal_list()
1404 if (atomic_read(&journal->j_wcount) != 0) { in flush_journal_list()
1575 err = journal->j_errno; in flush_journal_list()
1598 journal->j_num_lists--; in flush_journal_list()
1601 if (journal->j_last_flush_id != 0 && in flush_journal_list()
1602 (jl->j_trans_id - journal->j_last_flush_id) != 1) { in flush_journal_list()
1604 journal->j_last_flush_id, jl->j_trans_id); in flush_journal_list()
1606 journal->j_last_flush_id = jl->j_trans_id; in flush_journal_list()
1621 mutex_unlock(&journal->j_flush_mutex); in flush_journal_list()
1724 struct reiserfs_journal *journal = SB_JOURNAL(s); in kupdate_transactions() local
1727 reiserfs_mutex_lock_safe(&journal->j_flush_mutex, s); in kupdate_transactions()
1754 if (entry == &journal->j_journal_list) { in kupdate_transactions()
1768 mutex_unlock(&journal->j_flush_mutex); in kupdate_transactions()
1792 struct reiserfs_journal *journal = SB_JOURNAL(s); in flush_used_journal_lists() local
1811 if (tjl->j_list.next == &journal->j_journal_list) in flush_used_journal_lists()
1879 struct reiserfs_journal *journal = SB_JOURNAL(sb); in free_journal_ram() local
1880 kfree(journal->j_current_jl); in free_journal_ram()
1881 journal->j_num_lists--; in free_journal_ram()
1883 vfree(journal->j_cnode_free_orig); in free_journal_ram()
1884 free_list_bitmaps(sb, journal->j_list_bitmap); in free_journal_ram()
1886 if (journal->j_header_bh) { in free_journal_ram()
1887 brelse(journal->j_header_bh); in free_journal_ram()
1893 release_journal_dev(sb, journal); in free_journal_ram()
1894 vfree(journal); in free_journal_ram()
1905 struct reiserfs_journal *journal = SB_JOURNAL(sb); in do_journal_release() local
1930 if (!error && reiserfs_is_journal_aborted(journal)) { in do_journal_release()
2112 struct reiserfs_journal *journal = SB_JOURNAL(sb); in journal_read_transaction() local
2295 journal->j_start = cur_dblock - SB_ONDISK_JOURNAL_1st_BLOCK(sb); in journal_read_transaction()
2296 journal->j_last_flush_trans_id = trans_id; in journal_read_transaction()
2297 journal->j_trans_id = trans_id + 1; in journal_read_transaction()
2299 if (journal->j_trans_id == 0) in journal_read_transaction()
2300 journal->j_trans_id = 10; in journal_read_transaction()
2369 struct reiserfs_journal *journal = SB_JOURNAL(sb); in journal_read() local
2386 journal->j_dev_bd); in journal_read()
2394 journal->j_header_bh = journal_bread(sb, in journal_read()
2397 if (!journal->j_header_bh) { in journal_read()
2400 jh = (struct reiserfs_journal_header *)(journal->j_header_bh->b_data); in journal_read()
2447 reiserfs_breada(journal->j_dev_bd, cur_dblock, in journal_read()
2513 SB_ONDISK_JOURNAL_1st_BLOCK(sb) + journal->j_start; in journal_read()
2530 journal->j_start = le32_to_cpu(jh->j_first_unflushed_offset); in journal_read()
2531 journal->j_trans_id = in journal_read()
2534 if (journal->j_trans_id == 0) in journal_read()
2535 journal->j_trans_id = 10; in journal_read()
2536 journal->j_last_flush_trans_id = in journal_read()
2538 journal->j_mount_id = le32_to_cpu(jh->j_mount_id) + 1; in journal_read()
2540 journal->j_mount_id = newest_mount_id + 1; in journal_read()
2543 "newest_mount_id to %lu", journal->j_mount_id); in journal_read()
2544 journal->j_first_unflushed_offset = journal->j_start; in journal_read()
2553 _update_journal_header_block(sb, journal->j_start, in journal_read()
2554 journal->j_last_flush_trans_id)) { in journal_read()
2587 struct reiserfs_journal *journal) in release_journal_dev() argument
2589 if (journal->j_dev_bd != NULL) { in release_journal_dev()
2590 blkdev_put(journal->j_dev_bd, journal->j_dev_mode); in release_journal_dev()
2591 journal->j_dev_bd = NULL; in release_journal_dev()
2596 struct reiserfs_journal *journal, in journal_init_dev() argument
2605 journal->j_dev_bd = NULL; in journal_init_dev()
2616 journal->j_dev_bd = blkdev_get_by_dev(jdev, blkdev_mode, in journal_init_dev()
2617 journal); in journal_init_dev()
2618 journal->j_dev_mode = blkdev_mode; in journal_init_dev()
2619 if (IS_ERR(journal->j_dev_bd)) { in journal_init_dev()
2620 result = PTR_ERR(journal->j_dev_bd); in journal_init_dev()
2621 journal->j_dev_bd = NULL; in journal_init_dev()
2627 set_blocksize(journal->j_dev_bd, super->s_blocksize); in journal_init_dev()
2632 journal->j_dev_mode = blkdev_mode; in journal_init_dev()
2633 journal->j_dev_bd = blkdev_get_by_path(jdev_name, blkdev_mode, journal); in journal_init_dev()
2634 if (IS_ERR(journal->j_dev_bd)) { in journal_init_dev()
2635 result = PTR_ERR(journal->j_dev_bd); in journal_init_dev()
2636 journal->j_dev_bd = NULL; in journal_init_dev()
2643 set_blocksize(journal->j_dev_bd, super->s_blocksize); in journal_init_dev()
2646 journal->j_dev_bd); in journal_init_dev()
2665 struct reiserfs_journal *journal) in check_advise_trans_params() argument
2667 if (journal->j_trans_max) { in check_advise_trans_params()
2673 if (journal->j_trans_max > JOURNAL_TRANS_MAX_DEFAULT / ratio || in check_advise_trans_params()
2674 journal->j_trans_max < JOURNAL_TRANS_MIN_DEFAULT / ratio || in check_advise_trans_params()
2675 SB_ONDISK_JOURNAL_SIZE(sb) / journal->j_trans_max < in check_advise_trans_params()
2679 "FSCK?", journal->j_trans_max); in check_advise_trans_params()
2682 if (journal->j_max_batch != (journal->j_trans_max) * in check_advise_trans_params()
2686 "FSCK?", journal->j_max_batch); in check_advise_trans_params()
2701 journal->j_trans_max = JOURNAL_TRANS_MAX_DEFAULT; in check_advise_trans_params()
2702 journal->j_max_batch = JOURNAL_MAX_BATCH_DEFAULT; in check_advise_trans_params()
2703 journal->j_max_commit_age = JOURNAL_MAX_COMMIT_AGE; in check_advise_trans_params()
2716 struct reiserfs_journal *journal; in journal_init() local
2720 journal = SB_JOURNAL(sb) = vzalloc(sizeof(struct reiserfs_journal)); in journal_init()
2721 if (!journal) { in journal_init()
2726 INIT_LIST_HEAD(&journal->j_bitmap_nodes); in journal_init()
2727 INIT_LIST_HEAD(&journal->j_prealloc_list); in journal_init()
2728 INIT_LIST_HEAD(&journal->j_working_list); in journal_init()
2729 INIT_LIST_HEAD(&journal->j_journal_list); in journal_init()
2730 journal->j_persistent_trans = 0; in journal_init()
2731 if (reiserfs_allocate_list_bitmaps(sb, journal->j_list_bitmap, in journal_init()
2777 if (journal_init_dev(sb, journal, j_dev_name) != 0) { in journal_init()
2804 journal->j_dev_bd, in journal_init()
2810 journal->j_trans_max = le32_to_cpu(jh->jh_journal.jp_journal_trans_max); in journal_init()
2811 journal->j_max_batch = le32_to_cpu(jh->jh_journal.jp_journal_max_batch); in journal_init()
2812 journal->j_max_commit_age = in journal_init()
2814 journal->j_max_trans_age = JOURNAL_MAX_TRANS_AGE; in journal_init()
2816 if (check_advise_trans_params(sb, journal) != 0) in journal_init()
2818 journal->j_default_max_commit_age = journal->j_max_commit_age; in journal_init()
2821 journal->j_max_commit_age = commit_max_age; in journal_init()
2822 journal->j_max_trans_age = commit_max_age; in journal_init()
2828 journal->j_dev_bd, in journal_init()
2831 journal->j_trans_max, in journal_init()
2832 journal->j_max_batch, in journal_init()
2833 journal->j_max_commit_age, journal->j_max_trans_age); in journal_init()
2837 journal->j_list_bitmap_index = 0; in journal_init()
2840 memset(journal->j_list_hash_table, 0, in journal_init()
2843 INIT_LIST_HEAD(&journal->j_dirty_buffers); in journal_init()
2844 spin_lock_init(&journal->j_dirty_buffers_lock); in journal_init()
2846 journal->j_start = 0; in journal_init()
2847 journal->j_len = 0; in journal_init()
2848 journal->j_len_alloc = 0; in journal_init()
2849 atomic_set(&journal->j_wcount, 0); in journal_init()
2850 atomic_set(&journal->j_async_throttle, 0); in journal_init()
2851 journal->j_bcount = 0; in journal_init()
2852 journal->j_trans_start_time = 0; in journal_init()
2853 journal->j_last = NULL; in journal_init()
2854 journal->j_first = NULL; in journal_init()
2855 init_waitqueue_head(&journal->j_join_wait); in journal_init()
2856 mutex_init(&journal->j_mutex); in journal_init()
2857 mutex_init(&journal->j_flush_mutex); in journal_init()
2859 journal->j_trans_id = 10; in journal_init()
2860 journal->j_mount_id = 10; in journal_init()
2861 journal->j_state = 0; in journal_init()
2862 atomic_set(&journal->j_jlock, 0); in journal_init()
2863 journal->j_cnode_free_list = allocate_cnodes(num_cnodes); in journal_init()
2864 journal->j_cnode_free_orig = journal->j_cnode_free_list; in journal_init()
2865 journal->j_cnode_free = journal->j_cnode_free_list ? num_cnodes : 0; in journal_init()
2866 journal->j_cnode_used = 0; in journal_init()
2867 journal->j_must_wait = 0; in journal_init()
2869 if (journal->j_cnode_free == 0) { in journal_init()
2879 jl = journal->j_current_jl; in journal_init()
2902 INIT_DELAYED_WORK(&journal->j_work, flush_async_commits); in journal_init()
2903 journal->j_work_sb = sb; in journal_init()
2918 struct reiserfs_journal *journal = SB_JOURNAL(th->t_super); in journal_transaction_should_end() local
2924 if (journal->j_must_wait > 0 || in journal_transaction_should_end()
2925 (journal->j_len_alloc + new_alloc) >= journal->j_max_batch || in journal_transaction_should_end()
2926 atomic_read(&journal->j_jlock) || in journal_transaction_should_end()
2927 (now - journal->j_trans_start_time) > journal->j_max_trans_age || in journal_transaction_should_end()
2928 journal->j_cnode_free < (journal->j_trans_max * 3)) { in journal_transaction_should_end()
2932 journal->j_len_alloc += new_alloc; in journal_transaction_should_end()
2940 struct reiserfs_journal *journal = SB_JOURNAL(th->t_super); in reiserfs_block_writes() local
2942 journal->j_must_wait = 1; in reiserfs_block_writes()
2943 set_bit(J_WRITERS_BLOCKED, &journal->j_state); in reiserfs_block_writes()
2950 struct reiserfs_journal *journal = SB_JOURNAL(s); in reiserfs_allow_writes() local
2951 clear_bit(J_WRITERS_BLOCKED, &journal->j_state); in reiserfs_allow_writes()
2952 wake_up(&journal->j_join_wait); in reiserfs_allow_writes()
2958 struct reiserfs_journal *journal = SB_JOURNAL(s); in reiserfs_wait_on_write_block() local
2959 wait_event(journal->j_join_wait, in reiserfs_wait_on_write_block()
2960 !test_bit(J_WRITERS_BLOCKED, &journal->j_state)); in reiserfs_wait_on_write_block()
2966 struct reiserfs_journal *journal = SB_JOURNAL(s); in queue_log_writer() local
2967 set_bit(J_WRITERS_QUEUED, &journal->j_state); in queue_log_writer()
2974 add_wait_queue(&journal->j_join_wait, &wait); in queue_log_writer()
2976 if (test_bit(J_WRITERS_QUEUED, &journal->j_state)) { in queue_log_writer()
2982 remove_wait_queue(&journal->j_join_wait, &wait); in queue_log_writer()
2987 struct reiserfs_journal *journal = SB_JOURNAL(s); in wake_queued_writers() local
2988 if (test_and_clear_bit(J_WRITERS_QUEUED, &journal->j_state)) in wake_queued_writers()
2989 wake_up(&journal->j_join_wait); in wake_queued_writers()
2994 struct reiserfs_journal *journal = SB_JOURNAL(sb); in let_transaction_grow() local
2995 unsigned long bcount = journal->j_bcount; in let_transaction_grow()
3003 journal->j_current_jl->j_state |= LIST_COMMIT_PENDING; in let_transaction_grow()
3004 while ((atomic_read(&journal->j_wcount) > 0 || in let_transaction_grow()
3005 atomic_read(&journal->j_jlock)) && in let_transaction_grow()
3006 journal->j_trans_id == trans_id) { in let_transaction_grow()
3009 if (journal->j_trans_id != trans_id) in let_transaction_grow()
3011 if (bcount == journal->j_bcount) in let_transaction_grow()
3013 bcount = journal->j_bcount; in let_transaction_grow()
3030 struct reiserfs_journal *journal = SB_JOURNAL(sb); in do_journal_begin_r() local
3037 BUG_ON(nblocks > journal->j_trans_max); in do_journal_begin_r()
3039 PROC_INFO_INC(sb, journal.journal_being); in do_journal_begin_r()
3046 if (join != JBEGIN_ABORT && reiserfs_is_journal_aborted(journal)) { in do_journal_begin_r()
3048 retval = journal->j_errno; in do_journal_begin_r()
3051 journal->j_bcount++; in do_journal_begin_r()
3053 if (test_bit(J_WRITERS_BLOCKED, &journal->j_state)) { in do_journal_begin_r()
3058 PROC_INFO_INC(sb, journal.journal_relock_writers); in do_journal_begin_r()
3070 if ((!join && journal->j_must_wait > 0) || in do_journal_begin_r()
3072 && (journal->j_len_alloc + nblocks + 2) >= journal->j_max_batch) in do_journal_begin_r()
3073 || (!join && atomic_read(&journal->j_wcount) > 0 in do_journal_begin_r()
3074 && journal->j_trans_start_time > 0 in do_journal_begin_r()
3075 && (now - journal->j_trans_start_time) > in do_journal_begin_r()
3076 journal->j_max_trans_age) || (!join in do_journal_begin_r()
3077 && atomic_read(&journal->j_jlock)) in do_journal_begin_r()
3078 || (!join && journal->j_cnode_free < (journal->j_trans_max * 3))) { in do_journal_begin_r()
3080 old_trans_id = journal->j_trans_id; in do_journal_begin_r()
3084 if (!join && (journal->j_len_alloc + nblocks + 2) >= in do_journal_begin_r()
3085 journal->j_max_batch && in do_journal_begin_r()
3086 ((journal->j_len + nblocks + 2) * 100) < in do_journal_begin_r()
3087 (journal->j_len_alloc * 75)) { in do_journal_begin_r()
3088 if (atomic_read(&journal->j_wcount) > 10) { in do_journal_begin_r()
3098 if (atomic_read(&journal->j_jlock)) { in do_journal_begin_r()
3099 while (journal->j_trans_id == old_trans_id && in do_journal_begin_r()
3100 atomic_read(&journal->j_jlock)) { in do_journal_begin_r()
3110 if (old_trans_id != journal->j_trans_id) { in do_journal_begin_r()
3119 PROC_INFO_INC(sb, journal.journal_relock_wcount); in do_journal_begin_r()
3123 if (journal->j_trans_start_time == 0) { in do_journal_begin_r()
3124 journal->j_trans_start_time = ktime_get_seconds(); in do_journal_begin_r()
3126 atomic_inc(&journal->j_wcount); in do_journal_begin_r()
3127 journal->j_len_alloc += nblocks; in do_journal_begin_r()
3130 th->t_trans_id = journal->j_trans_id; in do_journal_begin_r()
3282 struct reiserfs_journal *journal = SB_JOURNAL(sb); in journal_mark_dirty() local
3288 PROC_INFO_INC(sb, journal.mark_dirty); in journal_mark_dirty()
3289 if (th->t_trans_id != journal->j_trans_id) { in journal_mark_dirty()
3292 th->t_trans_id, journal->j_trans_id); in journal_mark_dirty()
3299 PROC_INFO_INC(sb, journal.mark_dirty_already); in journal_mark_dirty()
3319 if (atomic_read(&journal->j_wcount) <= 0) { in journal_mark_dirty()
3322 atomic_read(&journal->j_wcount)); in journal_mark_dirty()
3330 if (journal->j_len >= journal->j_trans_max) { in journal_mark_dirty()
3333 journal->j_len); in journal_mark_dirty()
3338 PROC_INFO_INC(sb, journal.mark_dirty_notjournal); in journal_mark_dirty()
3342 if (journal->j_len > journal->j_len_alloc) { in journal_mark_dirty()
3343 journal->j_len_alloc = journal->j_len + JOURNAL_PER_BALANCE_CNT; in journal_mark_dirty()
3357 journal->j_len_alloc += JOURNAL_PER_BALANCE_CNT; in journal_mark_dirty()
3360 journal->j_len++; in journal_mark_dirty()
3366 insert_journal_hash(journal->j_hash_table, cn); in journal_mark_dirty()
3372 cn->prev = journal->j_last; in journal_mark_dirty()
3374 if (journal->j_last) { in journal_mark_dirty()
3375 journal->j_last->next = cn; in journal_mark_dirty()
3376 journal->j_last = cn; in journal_mark_dirty()
3378 journal->j_first = cn; in journal_mark_dirty()
3379 journal->j_last = cn; in journal_mark_dirty()
3431 struct reiserfs_journal *journal = SB_JOURNAL(sb); in remove_from_transaction() local
3434 cn = get_journal_hash_dev(sb, journal->j_hash_table, blocknr); in remove_from_transaction()
3445 if (cn == journal->j_first) { in remove_from_transaction()
3446 journal->j_first = cn->next; in remove_from_transaction()
3448 if (cn == journal->j_last) { in remove_from_transaction()
3449 journal->j_last = cn->prev; in remove_from_transaction()
3451 remove_journal_hash(sb, journal->j_hash_table, NULL, in remove_from_transaction()
3466 journal->j_len--; in remove_from_transaction()
3467 journal->j_len_alloc--; in remove_from_transaction()
3525 struct reiserfs_journal *journal = SB_JOURNAL(sb); in journal_end_sync() local
3530 if (journal->j_len == 0) { in journal_end_sync()
3541 struct reiserfs_journal *journal = in flush_async_commits() local
3543 struct super_block *sb = journal->j_work_sb; in flush_async_commits()
3548 if (!list_empty(&journal->j_journal_list)) { in flush_async_commits()
3550 entry = journal->j_journal_list.prev; in flush_async_commits()
3565 struct reiserfs_journal *journal = SB_JOURNAL(sb); in reiserfs_flush_old_commits() local
3572 if (list_empty(&journal->j_journal_list)) in reiserfs_flush_old_commits()
3579 if (atomic_read(&journal->j_wcount) <= 0 && in reiserfs_flush_old_commits()
3580 journal->j_trans_start_time > 0 && in reiserfs_flush_old_commits()
3581 journal->j_len > 0 && in reiserfs_flush_old_commits()
3582 (now - journal->j_trans_start_time) > journal->j_max_trans_age) { in reiserfs_flush_old_commits()
3623 struct reiserfs_journal *journal = SB_JOURNAL(sb); in check_journal_end() local
3627 if (th->t_trans_id != journal->j_trans_id) { in check_journal_end()
3630 th->t_trans_id, journal->j_trans_id); in check_journal_end()
3633 journal->j_len_alloc -= (th->t_blocks_allocated - th->t_blocks_logged); in check_journal_end()
3635 if (atomic_read(&journal->j_wcount) > 0) in check_journal_end()
3636 atomic_dec(&journal->j_wcount); in check_journal_end()
3644 BUG_ON(journal->j_len == 0); in check_journal_end()
3654 if (atomic_read(&journal->j_wcount) > 0) { in check_journal_end()
3658 jl = journal->j_current_jl; in check_journal_end()
3662 atomic_set(&journal->j_jlock, 1); in check_journal_end()
3664 journal->j_next_full_flush = 1; in check_journal_end()
3672 while (journal->j_trans_id == trans_id) { in check_journal_end()
3673 if (atomic_read(&journal->j_jlock)) { in check_journal_end()
3677 if (journal->j_trans_id == trans_id) { in check_journal_end()
3678 atomic_set(&journal->j_jlock, in check_journal_end()
3684 BUG_ON(journal->j_trans_id == trans_id); in check_journal_end()
3699 if ((now - journal->j_trans_start_time) > journal->j_max_trans_age) { in check_journal_end()
3701 journal->j_next_async_flush = 1; in check_journal_end()
3705 if (!(journal->j_must_wait > 0) && !(atomic_read(&journal->j_jlock)) in check_journal_end()
3706 && !flush && !commit_now && (journal->j_len < journal->j_max_batch) in check_journal_end()
3707 && journal->j_len_alloc < journal->j_max_batch in check_journal_end()
3708 && journal->j_cnode_free > (journal->j_trans_max * 3)) { in check_journal_end()
3709 journal->j_bcount++; in check_journal_end()
3714 if (journal->j_start > SB_ONDISK_JOURNAL_SIZE(sb)) { in check_journal_end()
3717 journal->j_start); in check_journal_end()
3742 struct reiserfs_journal *journal = SB_JOURNAL(sb); in journal_mark_freed() local
3749 cn = get_journal_hash_dev(sb, journal->j_hash_table, blocknr); in journal_mark_freed()
3765 jb = journal->j_current_jl->j_list_bitmap; in journal_mark_freed()
3784 cn = get_journal_hash_dev(sb, journal->j_list_hash_table, in journal_mark_freed()
3832 struct reiserfs_journal *journal = SB_JOURNAL(inode->i_sb); in reiserfs_update_inode_transaction() local
3833 REISERFS_I(inode)->i_jl = journal->j_current_jl; in reiserfs_update_inode_transaction()
3834 REISERFS_I(inode)->i_trans_id = journal->j_trans_id; in reiserfs_update_inode_transaction()
3846 struct reiserfs_journal *journal = SB_JOURNAL(sb); in __commit_trans_jl() local
3853 if (id == journal->j_trans_id) { in __commit_trans_jl()
3854 jl = journal->j_current_jl; in __commit_trans_jl()
3860 if (journal->j_trans_id != id) { in __commit_trans_jl()
3869 if (journal->j_trans_id != id) { in __commit_trans_jl()
3897 if (journal->j_errno) in __commit_trans_jl()
3898 ret = journal->j_errno; in __commit_trans_jl()
3926 struct reiserfs_journal *journal = SB_JOURNAL(sb); in reiserfs_restore_prepared_buffer() local
3927 PROC_INFO_INC(sb, journal.restore_prepared); in reiserfs_restore_prepared_buffer()
3936 journal->j_list_hash_table, in reiserfs_restore_prepared_buffer()
3957 PROC_INFO_INC(sb, journal.prepare); in reiserfs_prepare_for_journal()
3986 struct reiserfs_journal *journal = SB_JOURNAL(sb); in do_journal_end() local
4019 if (journal->j_len == 0) { in do_journal_end()
4026 if (journal->j_next_full_flush) { in do_journal_end()
4030 if (journal->j_next_async_flush) { in do_journal_end()
4048 if (journal->j_next_full_flush) { in do_journal_end()
4056 if (journal->j_must_wait > 0) { in do_journal_end()
4078 journal->j_start); in do_journal_end()
4083 set_desc_trans_id(desc, journal->j_trans_id); in do_journal_end()
4090 ((journal->j_start + journal->j_len + in do_journal_end()
4094 set_commit_trans_id(commit, journal->j_trans_id); in do_journal_end()
4098 jl = journal->j_current_jl; in do_journal_end()
4112 jl->j_trans_id = journal->j_trans_id; in do_journal_end()
4113 jl->j_timestamp = journal->j_trans_start_time; in do_journal_end()
4115 jl->j_start = journal->j_start; in do_journal_end()
4116 jl->j_len = journal->j_len; in do_journal_end()
4117 atomic_set(&jl->j_nonzerolen, journal->j_len); in do_journal_end()
4118 atomic_set(&jl->j_commit_left, journal->j_len + 2); in do_journal_end()
4127 for (i = 0, cn = journal->j_first; cn; cn = cn->next, i++) { in do_journal_end()
4159 insert_journal_hash(journal->j_list_hash_table, jl_cn); in do_journal_end()
4171 set_desc_trans_len(desc, journal->j_len); in do_journal_end()
4172 set_desc_mount_id(desc, journal->j_mount_id); in do_journal_end()
4173 set_desc_trans_id(desc, journal->j_trans_id); in do_journal_end()
4174 set_commit_trans_len(commit, journal->j_len); in do_journal_end()
4180 BUG_ON(journal->j_len == 0); in do_journal_end()
4193 cur_write_start = journal->j_start; in do_journal_end()
4194 cn = journal->j_first; in do_journal_end()
4242 journal->j_current_jl = alloc_journal_list(sb); in do_journal_end()
4245 list_add_tail(&jl->j_list, &journal->j_journal_list); in do_journal_end()
4246 list_add_tail(&jl->j_working_list, &journal->j_working_list); in do_journal_end()
4247 journal->j_num_work_lists++; in do_journal_end()
4250 journal->j_start = in do_journal_end()
4251 (journal->j_start + journal->j_len + in do_journal_end()
4253 atomic_set(&journal->j_wcount, 0); in do_journal_end()
4254 journal->j_bcount = 0; in do_journal_end()
4255 journal->j_last = NULL; in do_journal_end()
4256 journal->j_first = NULL; in do_journal_end()
4257 journal->j_len = 0; in do_journal_end()
4258 journal->j_trans_start_time = 0; in do_journal_end()
4260 if (++journal->j_trans_id == 0) in do_journal_end()
4261 journal->j_trans_id = 10; in do_journal_end()
4262 journal->j_current_jl->j_trans_id = journal->j_trans_id; in do_journal_end()
4263 journal->j_must_wait = 0; in do_journal_end()
4264 journal->j_len_alloc = 0; in do_journal_end()
4265 journal->j_next_full_flush = 0; in do_journal_end()
4266 journal->j_next_async_flush = 0; in do_journal_end()
4284 write_ordered_buffers(&journal->j_dirty_buffers_lock, in do_journal_end()
4285 journal, jl, &jl->j_tail_bh_list); in do_journal_end()
4309 &journal->j_work, HZ / 10); in do_journal_end()
4318 list_for_each_safe(entry, safe, &journal->j_journal_list) { in do_journal_end()
4320 if (journal->j_start <= temp_jl->j_start) { in do_journal_end()
4321 if ((journal->j_start + journal->j_trans_max + 1) >= in do_journal_end()
4325 } else if ((journal->j_start + in do_journal_end()
4326 journal->j_trans_max + 1) < in do_journal_end()
4336 } else if ((journal->j_start + in do_journal_end()
4337 journal->j_trans_max + 1) > in do_journal_end()
4339 if (((journal->j_start + journal->j_trans_max + 1) % in do_journal_end()
4356 journal->j_current_jl->j_list_bitmap = in do_journal_end()
4357 get_list_bitmap(sb, journal->j_current_jl); in do_journal_end()
4359 if (!(journal->j_current_jl->j_list_bitmap)) { in do_journal_end()
4364 atomic_set(&journal->j_jlock, 0); in do_journal_end()
4367 clear_bit(J_WRITERS_QUEUED, &journal->j_state); in do_journal_end()
4368 wake_up(&journal->j_join_wait); in do_journal_end()
4385 return journal->j_errno; in do_journal_end()
4391 struct reiserfs_journal *journal = SB_JOURNAL(sb); in reiserfs_abort_journal() local
4392 if (test_bit(J_ABORTED, &journal->j_state)) in reiserfs_abort_journal()
4395 if (!journal->j_errno) in reiserfs_abort_journal()
4396 journal->j_errno = errno; in reiserfs_abort_journal()
4399 set_bit(J_ABORTED, &journal->j_state); in reiserfs_abort_journal()