• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/fs/reiserfs/

Lines Matching defs:journal

82 /* journal list state bits */
103 struct reiserfs_journal *journal);
111 JBEGIN_REG = 0, /* regular journal begin */
122 struct reiserfs_journal *journal = SB_JOURNAL(sb);
123 memset(journal->j_hash_table, 0,
170 struct reiserfs_journal *journal = SB_JOURNAL(sb);
172 struct list_head *entry = journal->j_bitmap_nodes.next;
174 journal->j_used_bitmap_nodes++;
177 if (entry != &journal->j_bitmap_nodes) {
181 journal->j_free_bitmap_nodes--;
194 struct reiserfs_journal *journal = SB_JOURNAL(sb);
195 journal->j_used_bitmap_nodes--;
196 if (journal->j_free_bitmap_nodes > REISERFS_MAX_BITMAP_NODES) {
200 list_add(&bn->list, &journal->j_bitmap_nodes);
201 journal->j_free_bitmap_nodes++;
208 struct reiserfs_journal *journal = SB_JOURNAL(sb);
213 list_add(&bn->list, &journal->j_bitmap_nodes);
214 journal->j_free_bitmap_nodes++;
270 struct reiserfs_journal *journal = SB_JOURNAL(sb);
271 struct list_head *next = journal->j_bitmap_nodes.next;
274 while (next != &journal->j_bitmap_nodes) {
279 next = journal->j_bitmap_nodes.next;
280 journal->j_free_bitmap_nodes--;
305 "allocate bitmaps for journal lists");
327 struct reiserfs_journal *journal = SB_JOURNAL(sb);
331 i = journal->j_list_bitmap_index;
332 journal->j_list_bitmap_index = (i + 1) % JOURNAL_NUM_BITMAPS;
333 jb = journal->j_list_bitmap + i;
334 if (journal->j_list_bitmap[i].journal_list) {
336 journal->j_list_bitmap[i].
338 if (!journal->j_list_bitmap[i].journal_list) {
385 struct reiserfs_journal *journal = SB_JOURNAL(sb);
389 if (journal->j_cnode_free <= 0) {
392 journal->j_cnode_used++;
393 journal->j_cnode_free--;
394 cn = journal->j_cnode_free_list;
401 journal->j_cnode_free_list = cn->next;
412 struct reiserfs_journal *journal = SB_JOURNAL(sb);
416 journal->j_cnode_used--;
417 journal->j_cnode_free++;
419 cn->next = journal->j_cnode_free_list;
420 if (journal->j_cnode_free_list) {
421 journal->j_cnode_free_list->prev = cn;
424 journal->j_cnode_free_list = cn;
462 ** when bl is rejected because it is set in a journal list bitmap, we search
474 struct reiserfs_journal *journal = SB_JOURNAL(sb);
482 PROC_INFO_INC(sb, journal.in_journal);
489 PROC_INFO_INC(sb, journal.in_journal_bitmap);
490 jb = journal->j_list_bitmap + i;
510 get_journal_hash_dev(sb, journal->j_list_hash_table, bl))) {
515 if ((cn = get_journal_hash_dev(sb, journal->j_hash_table, bl))) {
520 PROC_INFO_INC(sb, journal.in_journal_reusable);
544 PROC_INFO_INC(sb, journal.lock_journal);
564 reiserfs_panic(s, "journal-2", "trans id %u, refcount at %d",
591 struct reiserfs_journal *journal = SB_JOURNAL(s);
592 struct list_head *entry = &journal->j_journal_list;
607 * logged via data=journal.
900 * journal head from an older transaction. If someone else sets
904 * after freeing the journal header.
921 struct reiserfs_journal *journal = SB_JOURNAL(s);
937 if (entry == &journal->j_journal_list ||
975 if (entry == &journal->j_journal_list)
998 ** if this journal list still has commit blocks unflushed, send them to disk.
1011 struct reiserfs_journal *journal = SB_JOURNAL(s);
1028 BUG_ON(trans_id == journal->j_trans_id);
1064 ret = write_ordered_buffers(&journal->j_dirty_buffers_lock,
1065 journal, jl, &jl->j_bh_list);
1078 atomic_inc(&journal->j_async_throttle);
1095 atomic_dec(&journal->j_async_throttle);
1098 if (retval || reiserfs_is_journal_aborted(journal))
1134 reiserfs_warning(s, "journal-601",
1147 /* If there was a write error in the journal - we can't commit
1151 if (likely(!retval && !reiserfs_is_journal_aborted (journal))) {
1167 /* If there was a write error in the journal - we can't commit this
1172 reiserfs_warning(s, "journal-615", "buffer write failed");
1177 if (journal->j_last_commit_id != 0 &&
1178 (jl->j_trans_id - journal->j_last_commit_id) != 1) {
1180 journal->j_last_commit_id, jl->j_trans_id);
1182 journal->j_last_commit_id = jl->j_trans_id;
1187 retval = retval ? retval : journal->j_errno;
1251 ** journal list for this transaction. Aside from freeing the cnode, this also allows the
1258 struct reiserfs_journal *journal = SB_JOURNAL(sb);
1274 remove_journal_hash(sb, journal->j_list_hash_table,
1296 struct reiserfs_journal *journal = SB_JOURNAL(sb);
1298 if (reiserfs_is_journal_aborted(journal))
1301 if (trans_id >= journal->j_last_flush_trans_id) {
1302 if (buffer_locked((journal->j_header_bh))) {
1304 wait_on_buffer((journal->j_header_bh));
1306 if (unlikely(!buffer_uptodate(journal->j_header_bh))) {
1308 reiserfs_warning(sb, "journal-699",
1314 journal->j_last_flush_trans_id = trans_id;
1315 journal->j_first_unflushed_offset = offset;
1316 jh = (struct reiserfs_journal_header *)(journal->j_header_bh->
1320 jh->j_mount_id = cpu_to_le32(journal->j_mount_id);
1324 lock_buffer(journal->j_header_bh);
1325 ret = submit_barrier_buffer(journal->j_header_bh);
1327 set_buffer_uptodate(journal->j_header_bh);
1332 wait_on_buffer(journal->j_header_bh);
1334 check_barrier_completion(sb, journal->j_header_bh);
1337 set_buffer_dirty(journal->j_header_bh);
1339 sync_dirty_buffer(journal->j_header_bh);
1342 if (!buffer_uptodate(journal->j_header_bh)) {
1343 reiserfs_warning(sb, "journal-837",
1344 "IO error during journal replay");
1359 ** flush any and all journal lists older than you are
1367 struct reiserfs_journal *journal = SB_JOURNAL(sb);
1374 entry = journal->j_journal_list.next;
1376 if (entry == &journal->j_journal_list)
1393 struct reiserfs_journal *journal = SB_JOURNAL(s);
1396 journal->j_num_work_lists--;
1400 /* flush a journal list, both commit and real blocks
1405 ** IMPORTANT. This can only be called while there are no journal writers,
1406 ** and the journal is locked. That means it can only be called from
1419 struct reiserfs_journal *journal = SB_JOURNAL(s);
1424 if (atomic_read(&journal->j_wcount) != 0) {
1426 atomic_read(&journal->j_wcount));
1432 reiserfs_mutex_lock_safe(&journal->j_flush_mutex, s);
1433 } else if (mutex_trylock(&journal->j_flush_mutex)) {
1438 if (j_len_saved > journal->j_trans_max) {
1439 reiserfs_panic(s, "journal-715", "length is %lu, trans id %lu",
1458 && !reiserfs_is_journal_aborted(journal))
1470 if (atomic_read(&(journal->j_wcount)) != 0) {
1471 reiserfs_panic(s, "journal-844", "journal list is flushing, "
1532 reiserfs_warning(s, "journal-813",
1563 reiserfs_warning(s, "journal-945",
1573 reiserfs_panic(s, "journal-1011",
1582 reiserfs_panic(s, "journal-1012",
1587 reiserfs_warning(s, "journal-949",
1613 /* before we can update the journal header block, we _must_ flush all
1622 err = journal->j_errno;
1627 ** are no allocations going on while we are flushing journal lists. So,
1628 ** we only need to update the journal header block for the last list
1639 "Write error while updating journal header in %s",
1644 journal->j_num_lists--;
1647 if (journal->j_last_flush_id != 0 &&
1648 (jl->j_trans_id - journal->j_last_flush_id) != 1) {
1650 journal->j_last_flush_id, jl->j_trans_id);
1652 journal->j_last_flush_id = jl->j_trans_id;
1666 mutex_unlock(&journal->j_flush_mutex);
1793 struct reiserfs_journal *journal = SB_JOURNAL(s);
1796 reiserfs_mutex_lock_safe(&journal->j_flush_mutex, s);
1822 if (entry == &journal->j_journal_list) {
1836 mutex_unlock(&journal->j_flush_mutex);
1845 ** This function tries to clear out a large chunk of the journal lists
1846 ** at once, which makes everything faster since only the newest journal
1860 struct reiserfs_journal *journal = SB_JOURNAL(s);
1879 if (tjl->j_list.next == &journal->j_journal_list)
1937 struct reiserfs_journal *journal = SB_JOURNAL(sb);
1938 kfree(journal->j_current_jl);
1939 journal->j_num_lists--;
1941 vfree(journal->j_cnode_free_orig);
1942 free_list_bitmaps(sb, journal->j_list_bitmap);
1944 if (journal->j_header_bh) {
1945 brelse(journal->j_header_bh);
1947 /* j_header_bh is on the journal dev, make sure not to release the journal
1950 release_journal_dev(sb, journal);
1951 vfree(journal);
1963 struct reiserfs_journal *journal = SB_JOURNAL(sb);
1985 if (!error && reiserfs_is_journal_aborted(journal)) {
2021 ** call on unmount. flush all journal trans, release all alloc'd ram
2075 "journal-986: transaction "
2085 "journal-1087: transaction "
2093 reiserfs_warning(sb, "journal-2018",
2101 /* ok, we have a journal description block, lets see if the transaction was valid */
2123 "journal-1004: "
2132 "journal-1006: found valid "
2163 struct reiserfs_journal *journal = SB_JOURNAL(sb);
2180 reiserfs_debug(sb, REISERFS_DEBUG_CODE, "journal-1037: "
2185 reiserfs_debug(sb, REISERFS_DEBUG_CODE, "journal-1039: "
2193 reiserfs_debug(sb, REISERFS_DEBUG_CODE, "journal-1146: "
2240 reiserfs_warning(sb, "journal-1169",
2263 reiserfs_warning(sb, "journal-1207",
2272 reiserfs_warning(sb, "journal-1204",
2294 reiserfs_warning(sb, "journal-1212",
2319 reiserfs_warning(sb, "journal-1226",
2337 "journal-1095: setting journal " "start to offset %ld",
2341 journal->j_start = cur_dblock - SB_ONDISK_JOURNAL_1st_BLOCK(sb);
2342 journal->j_last_flush_trans_id = trans_id;
2343 journal->j_trans_id = trans_id + 1;
2345 if (journal->j_trans_id == 0)
2346 journal->j_trans_id = 10;
2357 Right now it is only used from journal code. But later we might use it
2399 ** on a clean unmount, the journal header's next unflushed pointer will be to an invalid
2408 struct reiserfs_journal *journal = SB_JOURNAL(sb);
2426 bdevname(journal->j_dev_bd, b));
2429 /* step 1, read in the journal header block. Check the transaction it says
2433 journal->j_header_bh = journal_bread(sb,
2436 if (!journal->j_header_bh) {
2439 jh = (struct reiserfs_journal_header *)(journal->j_header_bh->b_data);
2449 "journal-1153: found in "
2478 /* Note that it is required for blocksize of primary fs device and journal
2481 reiserfs_breada(journal->j_dev_bd, cur_dblock,
2496 "journal-1179: Setting "
2506 "journal-1180: Resetting "
2515 "journal-1299: Setting "
2530 "journal-1206: Starting replay "
2547 SB_ONDISK_JOURNAL_1st_BLOCK(sb) + journal->j_start;
2555 "journal-1225: No valid " "transactions found");
2562 journal->j_start = le32_to_cpu(jh->j_first_unflushed_offset);
2563 journal->j_trans_id =
2566 if (journal->j_trans_id == 0)
2567 journal->j_trans_id = 10;
2568 journal->j_last_flush_trans_id =
2570 journal->j_mount_id = le32_to_cpu(jh->j_mount_id) + 1;
2572 journal->j_mount_id = newest_mount_id + 1;
2574 reiserfs_debug(sb, REISERFS_DEBUG_CODE, "journal-1299: Setting "
2575 "newest_mount_id to %lu", journal->j_mount_id);
2576 journal->j_first_unflushed_offset = journal->j_start;
2583 _update_journal_header_block(sb, journal->j_start,
2584 journal->j_last_flush_trans_id)) {
2614 struct reiserfs_journal *journal)
2620 if (journal->j_dev_bd != NULL) {
2621 if (journal->j_dev_bd->bd_dev != super->s_dev)
2622 bd_release(journal->j_dev_bd);
2623 result = blkdev_put(journal->j_dev_bd, journal->j_dev_mode);
2624 journal->j_dev_bd = NULL;
2629 "Cannot release journal device: %i", result);
2635 struct reiserfs_journal *journal,
2645 journal->j_dev_bd = NULL;
2652 /* there is no "jdev" option and journal is on separate device */
2654 journal->j_dev_bd = open_by_devnum(jdev, blkdev_mode);
2655 journal->j_dev_mode = blkdev_mode;
2656 if (IS_ERR(journal->j_dev_bd)) {
2657 result = PTR_ERR(journal->j_dev_bd);
2658 journal->j_dev_bd = NULL;
2660 "cannot init journal device '%s': %i",
2664 result = bd_claim(journal->j_dev_bd, journal);
2666 blkdev_put(journal->j_dev_bd, blkdev_mode);
2670 set_blocksize(journal->j_dev_bd, super->s_blocksize);
2676 journal->j_dev_mode = blkdev_mode;
2677 journal->j_dev_bd = open_bdev_exclusive(jdev_name,
2678 blkdev_mode, journal);
2679 if (IS_ERR(journal->j_dev_bd)) {
2680 result = PTR_ERR(journal->j_dev_bd);
2681 journal->j_dev_bd = NULL;
2688 set_blocksize(journal->j_dev_bd, super->s_blocksize);
2690 "journal_init_dev: journal device: %s\n",
2691 bdevname(journal->j_dev_bd, b));
2697 * journal params within boundaries which depend on the ratio
2710 struct reiserfs_journal *journal)
2712 if (journal->j_trans_max) {
2713 /* Non-default journal params.
2719 if (journal->j_trans_max > JOURNAL_TRANS_MAX_DEFAULT / ratio ||
2720 journal->j_trans_max < JOURNAL_TRANS_MIN_DEFAULT / ratio ||
2721 SB_ONDISK_JOURNAL_SIZE(sb) / journal->j_trans_max <
2725 "FSCK?", journal->j_trans_max);
2728 if (journal->j_max_batch != (journal->j_trans_max) *
2732 "FSCK?", journal->j_max_batch);
2736 /* Default journal params.
2745 journal->j_trans_max = JOURNAL_TRANS_MAX_DEFAULT;
2746 journal->j_max_batch = JOURNAL_MAX_BATCH_DEFAULT;
2747 journal->j_max_commit_age = JOURNAL_MAX_COMMIT_AGE;
2762 struct reiserfs_journal *journal;
2772 journal = SB_JOURNAL(sb) = vmalloc(sizeof(struct reiserfs_journal));
2773 if (!journal) {
2774 reiserfs_warning(sb, "journal-1256",
2775 "unable to get memory for journal structure");
2779 memset(journal, 0, sizeof(struct reiserfs_journal));
2780 INIT_LIST_HEAD(&journal->j_bitmap_nodes);
2781 INIT_LIST_HEAD(&journal->j_prealloc_list);
2782 INIT_LIST_HEAD(&journal->j_working_list);
2783 INIT_LIST_HEAD(&journal->j_journal_list);
2784 journal->j_persistent_trans = 0;
2785 ret = reiserfs_allocate_list_bitmaps(sb, journal->j_list_bitmap,
2793 /* reserved for journal area support */
2802 /* Sanity check to see is the standard journal fitting withing first bitmap
2807 reiserfs_warning(sb, "journal-1393",
2808 "journal does not fit for area addressed "
2831 if (journal_init_dev(sb, journal, j_dev_name) != 0) {
2841 /* read journal header */
2847 "unable to read journal header");
2852 /* make sure that journal matches to the super block */
2857 "journal header magic %x (device %s) does "
2860 bdevname(journal->j_dev_bd, b),
2866 journal->j_trans_max = le32_to_cpu(jh->jh_journal.jp_journal_trans_max);
2867 journal->j_max_batch = le32_to_cpu(jh->jh_journal.jp_journal_max_batch);
2868 journal->j_max_commit_age =
2870 journal->j_max_trans_age = JOURNAL_MAX_TRANS_AGE;
2872 if (check_advise_trans_params(sb, journal) != 0)
2874 journal->j_default_max_commit_age = journal->j_max_commit_age;
2877 journal->j_max_commit_age = commit_max_age;
2878 journal->j_max_trans_age = commit_max_age;
2881 reiserfs_info(sb, "journal params: device %s, size %u, "
2882 "journal first block %u, max trans len %u, max batch %u, "
2884 bdevname(journal->j_dev_bd, b),
2887 journal->j_trans_max,
2888 journal->j_max_batch,
2889 journal->j_max_commit_age, journal->j_max_trans_age);
2893 journal->j_list_bitmap_index = 0;
2896 memset(journal->j_list_hash_table, 0,
2899 INIT_LIST_HEAD(&journal->j_dirty_buffers);
2900 spin_lock_init(&journal->j_dirty_buffers_lock);
2902 journal->j_start = 0;
2903 journal->j_len = 0;
2904 journal->j_len_alloc = 0;
2905 atomic_set(&(journal->j_wcount), 0);
2906 atomic_set(&(journal->j_async_throttle), 0);
2907 journal->j_bcount = 0;
2908 journal->j_trans_start_time = 0;
2909 journal->j_last = NULL;
2910 journal->j_first = NULL;
2911 init_waitqueue_head(&(journal->j_join_wait));
2912 mutex_init(&journal->j_mutex);
2913 mutex_init(&journal->j_flush_mutex);
2915 journal->j_trans_id = 10;
2916 journal->j_mount_id = 10;
2917 journal->j_state = 0;
2918 atomic_set(&(journal->j_jlock), 0);
2920 journal->j_cnode_free_list = allocate_cnodes(num_cnodes);
2922 journal->j_cnode_free_orig = journal->j_cnode_free_list;
2923 journal->j_cnode_free = journal->j_cnode_free_list ? num_cnodes : 0;
2924 journal->j_cnode_used = 0;
2925 journal->j_must_wait = 0;
2927 if (journal->j_cnode_free == 0) {
2928 reiserfs_warning(sb, "journal-2004", "Journal cnode memory "
2931 "this is due to a journal that is too large.",
2937 jl = journal->j_current_jl;
2940 reiserfs_warning(sb, "journal-2005",
2941 "get_list_bitmap failed for journal list 0");
2957 INIT_DELAYED_WORK(&journal->j_work, flush_async_commits);
2958 journal->j_work_sb = sb;
2973 struct reiserfs_journal *journal = SB_JOURNAL(th->t_super);
2979 if (journal->j_must_wait > 0 ||
2980 (journal->j_len_alloc + new_alloc) >= journal->j_max_batch ||
2981 atomic_read(&(journal->j_jlock)) ||
2982 (now - journal->j_trans_start_time) > journal->j_max_trans_age ||
2983 journal->j_cnode_free < (journal->j_trans_max * 3)) {
2987 journal->j_len_alloc += new_alloc;
2997 struct reiserfs_journal *journal = SB_JOURNAL(th->t_super);
2999 journal->j_must_wait = 1;
3000 set_bit(J_WRITERS_BLOCKED, &journal->j_state);
3009 struct reiserfs_journal *journal = SB_JOURNAL(s);
3010 clear_bit(J_WRITERS_BLOCKED, &journal->j_state);
3011 wake_up(&journal->j_join_wait);
3019 struct reiserfs_journal *journal = SB_JOURNAL(s);
3020 wait_event(journal->j_join_wait,
3021 !test_bit(J_WRITERS_BLOCKED, &journal->j_state));
3027 struct reiserfs_journal *journal = SB_JOURNAL(s);
3028 set_bit(J_WRITERS_QUEUED, &journal->j_state);
3035 add_wait_queue(&journal->j_join_wait, &wait);
3037 if (test_bit(J_WRITERS_QUEUED, &journal->j_state)) {
3043 remove_wait_queue(&journal->j_join_wait, &wait);
3048 struct reiserfs_journal *journal = SB_JOURNAL(s);
3049 if (test_and_clear_bit(J_WRITERS_QUEUED, &journal->j_state))
3050 wake_up(&journal->j_join_wait);
3055 struct reiserfs_journal *journal = SB_JOURNAL(sb);
3056 unsigned long bcount = journal->j_bcount;
3061 journal->j_current_jl->j_state |= LIST_COMMIT_PENDING;
3062 while ((atomic_read(&journal->j_wcount) > 0 ||
3063 atomic_read(&journal->j_jlock)) &&
3064 journal->j_trans_id == trans_id) {
3067 if (journal->j_trans_id != trans_id)
3069 if (bcount == journal->j_bcount)
3071 bcount = journal->j_bcount;
3087 struct reiserfs_journal *journal = SB_JOURNAL(sb);
3093 BUG_ON(nblocks > journal->j_trans_max);
3095 PROC_INFO_INC(sb, journal.journal_being);
3102 if (join != JBEGIN_ABORT && reiserfs_is_journal_aborted(journal)) {
3104 retval = journal->j_errno;
3107 journal->j_bcount++;
3109 if (test_bit(J_WRITERS_BLOCKED, &journal->j_state)) {
3114 PROC_INFO_INC(sb, journal.journal_relock_writers);
3119 /* if there is no room in the journal OR
3124 if ((!join && journal->j_must_wait > 0) ||
3126 && (journal->j_len_alloc + nblocks + 2) >= journal->j_max_batch)
3127 || (!join && atomic_read(&journal->j_wcount) > 0
3128 && journal->j_trans_start_time > 0
3129 && (now - journal->j_trans_start_time) >
3130 journal->j_max_trans_age) || (!join
3131 && atomic_read(&journal->j_jlock))
3132 || (!join && journal->j_cnode_free < (journal->j_trans_max * 3))) {
3134 old_trans_id = journal->j_trans_id;
3137 if (!join && (journal->j_len_alloc + nblocks + 2) >=
3138 journal->j_max_batch &&
3139 ((journal->j_len + nblocks + 2) * 100) <
3140 (journal->j_len_alloc * 75)) {
3141 if (atomic_read(&journal->j_wcount) > 10) {
3150 if (atomic_read(&journal->j_jlock)) {
3151 while (journal->j_trans_id == old_trans_id &&
3152 atomic_read(&journal->j_jlock)) {
3162 if (old_trans_id != journal->j_trans_id) {
3171 PROC_INFO_INC(sb, journal.journal_relock_wcount);
3175 if (journal->j_trans_start_time == 0) {
3176 journal->j_trans_start_time = get_seconds();
3178 atomic_inc(&(journal->j_wcount));
3179 journal->j_len_alloc += nblocks;
3182 th->t_trans_id = journal->j_trans_id;
3326 struct reiserfs_journal *journal = SB_JOURNAL(sb);
3332 PROC_INFO_INC(sb, journal.mark_dirty);
3333 if (th->t_trans_id != journal->j_trans_id) {
3334 reiserfs_panic(th->t_super, "journal-1577",
3336 th->t_trans_id, journal->j_trans_id);
3345 PROC_INFO_INC(sb, journal.mark_dirty_already);
3354 reiserfs_warning(sb, "journal-1777",
3364 if (atomic_read(&(journal->j_wcount)) <= 0) {
3365 reiserfs_warning(sb, "journal-1409",
3367 atomic_read(&(journal->j_wcount)));
3373 if (journal->j_len >= journal->j_trans_max) {
3374 reiserfs_panic(th->t_super, "journal-1413",
3376 journal->j_len);
3381 PROC_INFO_INC(sb, journal.mark_dirty_notjournal);
3385 if (journal->j_len > journal->j_len_alloc) {
3386 journal->j_len_alloc = journal->j_len + JOURNAL_PER_BALANCE_CNT;
3395 reiserfs_panic(sb, "journal-4", "get_cnode failed!");
3400 journal->j_len_alloc += JOURNAL_PER_BALANCE_CNT;
3403 journal->j_len++;
3409 insert_journal_hash(journal->j_hash_table, cn);
3415 cn->prev = journal->j_last;
3417 if (journal->j_last) {
3418 journal->j_last->next = cn;
3419 journal->j_last = cn;
3421 journal->j_first = cn;
3422 journal->j_last = cn;
3471 struct reiserfs_journal *journal = SB_JOURNAL(sb);
3474 cn = get_journal_hash_dev(sb, journal->j_hash_table, blocknr);
3485 if (cn == journal->j_first) {
3486 journal->j_first = cn->next;
3488 if (cn == journal->j_last) {
3489 journal->j_last = cn->prev;
3492 remove_journal_hash(sb, journal->j_hash_table, NULL,
3502 reiserfs_warning(sb, "journal-1752",
3507 journal->j_len--;
3508 journal->j_len_alloc--;
3514 ** for any cnode in a journal list, it can only be dirtied of all the
3562 struct reiserfs_journal *journal = SB_JOURNAL(sb);
3567 if (journal->j_len == 0) {
3580 struct reiserfs_journal *journal =
3582 struct super_block *sb = journal->j_work_sb;
3587 if (!list_empty(&journal->j_journal_list)) {
3589 entry = journal->j_journal_list.prev;
3604 struct reiserfs_journal *journal = SB_JOURNAL(sb);
3610 if (list_empty(&journal->j_journal_list)) {
3617 if (atomic_read(&journal->j_wcount) <= 0 &&
3618 journal->j_trans_start_time > 0 &&
3619 journal->j_len > 0 &&
3620 (now - journal->j_trans_start_time) > journal->j_max_trans_age) {
3658 struct reiserfs_journal *journal = SB_JOURNAL(sb);
3662 if (th->t_trans_id != journal->j_trans_id) {
3663 reiserfs_panic(th->t_super, "journal-1577",
3665 th->t_trans_id, journal->j_trans_id);
3668 journal->j_len_alloc -= (th->t_blocks_allocated - th->t_blocks_logged);
3669 if (atomic_read(&(journal->j_wcount)) > 0) { /* <= 0 is allowed. unmounting might not call begin */
3670 atomic_dec(&(journal->j_wcount));
3677 BUG_ON(journal->j_len == 0);
3682 ** Then, we flush the commit or journal list, and just return 0
3683 ** because the rest of journal end was already done for this transaction.
3685 if (atomic_read(&(journal->j_wcount)) > 0) {
3689 jl = journal->j_current_jl;
3693 atomic_set(&(journal->j_jlock), 1);
3695 journal->j_next_full_flush = 1;
3700 while (journal->j_trans_id == trans_id) {
3701 if (atomic_read(&journal->j_jlock)) {
3705 if (journal->j_trans_id == trans_id) {
3706 atomic_set(&(journal->j_jlock),
3712 BUG_ON(journal->j_trans_id == trans_id);
3727 if ((now - journal->j_trans_start_time) > journal->j_max_trans_age) {
3729 journal->j_next_async_flush = 1;
3733 if (!(journal->j_must_wait > 0) && !(atomic_read(&(journal->j_jlock)))
3734 && !flush && !commit_now && (journal->j_len < journal->j_max_batch)
3735 && journal->j_len_alloc < journal->j_max_batch
3736 && journal->j_cnode_free > (journal->j_trans_max * 3)) {
3737 journal->j_bcount++;
3742 if (journal->j_start > SB_ONDISK_JOURNAL_SIZE(sb)) {
3743 reiserfs_panic(sb, "journal-003",
3745 journal->j_start);
3755 ** set a bit for the block in the journal bitmap. That will prevent it from being allocated for unformatted nodes
3767 struct reiserfs_journal *journal = SB_JOURNAL(sb);
3774 cn = get_journal_hash_dev(sb, journal->j_hash_table, blocknr);
3779 /* if it is journal new, we just remove it from this transaction */
3786 /* set the bit for this block in the journal bitmap for this transaction */
3787 jb = journal->j_current_jl->j_list_bitmap;
3789 reiserfs_panic(sb, "journal-1702",
3803 cn = get_journal_hash_dev(sb, journal->j_list_hash_table,
3823 "journal-2138",
3846 struct reiserfs_journal *journal = SB_JOURNAL(inode->i_sb);
3847 REISERFS_I(inode)->i_jl = journal->j_current_jl;
3848 REISERFS_I(inode)->i_trans_id = journal->j_trans_id;
3860 struct reiserfs_journal *journal = SB_JOURNAL(sb);
3864 if (id == journal->j_trans_id) {
3865 jl = journal->j_current_jl;
3868 if (journal->j_trans_id != id) {
3877 if (journal->j_trans_id != id) {
3890 /* this gets tricky, we have to make sure the journal list in
3904 if (journal->j_errno)
3905 ret = journal->j_errno;
3932 struct reiserfs_journal *journal = SB_JOURNAL(sb);
3933 PROC_INFO_INC(sb, journal.restore_prepared);
3941 journal->j_list_hash_table,
3962 PROC_INFO_INC(sb, journal.prepare);
3980 struct reiserfs_journal *journal = SB_JOURNAL(s);
3985 while (!list_empty(&journal->j_journal_list)) {
3986 entry = journal->j_journal_list.next;
4006 ** If the journal is aborted, we just clean up. Things like flushing
4007 ** journal lists, etc just won't happen.
4013 struct reiserfs_journal *journal = SB_JOURNAL(sb);
4043 reiserfs_check_lock_depth(sb, "journal end");
4044 if (journal->j_len == 0) {
4051 if (journal->j_next_full_flush) {
4055 if (journal->j_next_async_flush) {
4060 /* check_journal_end locks the journal, and unlocks if it does not return 1
4071 if (journal->j_next_full_flush) {
4079 if (journal->j_must_wait > 0) {
4097 journal->j_start);
4102 set_desc_trans_id(desc, journal->j_trans_id);
4106 ((journal->j_start + journal->j_len +
4110 set_commit_trans_id(commit, journal->j_trans_id);
4113 /* init this journal list */
4114 jl = journal->j_current_jl;
4127 jl->j_trans_id = journal->j_trans_id;
4128 jl->j_timestamp = journal->j_trans_start_time;
4130 jl->j_start = journal->j_start;
4131 jl->j_len = journal->j_len;
4132 atomic_set(&jl->j_nonzerolen, journal->j_len);
4133 atomic_set(&jl->j_commit_left, journal->j_len + 2);
4137 ** for each real block, add it to the journal list hash,
4141 for (i = 0, cn = journal->j_first; cn; cn = cn->next, i++) {
4145 reiserfs_panic(sb, "journal-1676",
4158 of journal or reserved area */
4162 reiserfs_panic(sb, "journal-2332",
4172 insert_journal_hash(journal->j_list_hash_table, jl_cn);
4184 set_desc_trans_len(desc, journal->j_len);
4185 set_desc_mount_id(desc, journal->j_mount_id);
4186 set_desc_trans_id(desc, journal->j_trans_id);
4187 set_commit_trans_len(commit, journal->j_len);
4189 /* special check in case all buffers in the journal were marked for not logging */
4190 BUG_ON(journal->j_len == 0);
4199 cur_write_start = journal->j_start;
4200 cn = journal->j_first;
4228 reiserfs_warning(sb, "journal-2048",
4229 "BAD, buffer in journal hash, "
4246 journal->j_current_jl = alloc_journal_list(sb);
4249 list_add_tail(&jl->j_list, &journal->j_journal_list);
4250 list_add_tail(&jl->j_working_list, &journal->j_working_list);
4251 journal->j_num_work_lists++;
4253 /* reset journal values for the next transaction */
4254 old_start = journal->j_start;
4255 journal->j_start =
4256 (journal->j_start + journal->j_len +
4258 atomic_set(&(journal->j_wcount), 0);
4259 journal->j_bcount = 0;
4260 journal->j_last = NULL;
4261 journal->j_first = NULL;
4262 journal->j_len = 0;
4263 journal->j_trans_start_time = 0;
4265 if (++journal->j_trans_id == 0)
4266 journal->j_trans_id = 10;
4267 journal->j_current_jl->j_trans_id = journal->j_trans_id;
4268 journal->j_must_wait = 0;
4269 journal->j_len_alloc = 0;
4270 journal->j_next_full_flush = 0;
4271 journal->j_next_async_flush = 0;
4286 write_ordered_buffers(&journal->j_dirty_buffers_lock,
4287 journal, jl, &jl->j_tail_bh_list);
4294 ** be done outside the journal lock, they are done below
4298 ** queue don't wait for this proc to flush journal lists and such.
4304 queue_delayed_work(commit_wq, &journal->j_work, HZ / 10);
4307 ** transactions that might get overwritten. If any journal lists are very
4311 list_for_each_safe(entry, safe, &journal->j_journal_list) {
4313 if (journal->j_start <= temp_jl->j_start) {
4314 if ((journal->j_start + journal->j_trans_max + 1) >=
4318 } else if ((journal->j_start +
4319 journal->j_trans_max + 1) <
4327 } else if ((journal->j_start +
4328 journal->j_trans_max + 1) >
4330 if (((journal->j_start + journal->j_trans_max + 1) %
4346 journal->j_current_jl->j_list_bitmap =
4347 get_list_bitmap(sb, journal->j_current_jl);
4349 if (!(journal->j_current_jl->j_list_bitmap)) {
4350 reiserfs_panic(sb, "journal-1996",
4354 atomic_set(&(journal->j_jlock), 0);
4357 clear_bit(J_WRITERS_QUEUED, &journal->j_state);
4358 wake_up(&(journal->j_join_wait));
4365 reiserfs_check_lock_depth(sb, "journal end2");
4373 return journal->j_errno;
4379 struct reiserfs_journal *journal = SB_JOURNAL(sb);
4380 if (test_bit(J_ABORTED, &journal->j_state))
4383 if (!journal->j_errno)
4384 journal->j_errno = errno;
4387 set_bit(J_ABORTED, &journal->j_state);