Lines Matching full:cn
90 static int can_dirty(struct reiserfs_journal_cnode *cn);
368 struct reiserfs_journal_cnode *cn; in get_cnode() local
378 cn = journal->j_cnode_free_list; in get_cnode()
379 if (!cn) { in get_cnode()
380 return cn; in get_cnode()
382 if (cn->next) { in get_cnode()
383 cn->next->prev = NULL; in get_cnode()
385 journal->j_cnode_free_list = cn->next; in get_cnode()
386 memset(cn, 0, sizeof(struct reiserfs_journal_cnode)); in get_cnode()
387 return cn; in get_cnode()
394 struct reiserfs_journal_cnode *cn) in free_cnode() argument
402 /* memset(cn, 0, sizeof(struct reiserfs_journal_cnode)) ; */ in free_cnode()
403 cn->next = journal->j_cnode_free_list; in free_cnode()
405 journal->j_cnode_free_list->prev = cn; in free_cnode()
407 …cn->prev = NULL; /* not needed with the memset, but I might kill the memset, and forget to do this… in free_cnode()
408 journal->j_cnode_free_list = cn; in free_cnode()
429 struct reiserfs_journal_cnode *cn; in get_journal_hash_dev() local
430 cn = journal_hash(table, sb, bl); in get_journal_hash_dev()
431 while (cn) { in get_journal_hash_dev()
432 if (cn->blocknr == bl && cn->sb == sb) in get_journal_hash_dev()
433 return cn; in get_journal_hash_dev()
434 cn = cn->hnext; in get_journal_hash_dev()
513 /* insert cn into table */
515 struct reiserfs_journal_cnode *cn) in insert_journal_hash() argument
519 cn_orig = journal_hash(table, cn->sb, cn->blocknr); in insert_journal_hash()
520 cn->hnext = cn_orig; in insert_journal_hash()
521 cn->hprev = NULL; in insert_journal_hash()
523 cn_orig->hprev = cn; in insert_journal_hash()
525 journal_hash(table, cn->sb, cn->blocknr) = cn; in insert_journal_hash()
1169 *cn) in find_newer_jl_for_cn()
1171 struct super_block *sb = cn->sb; in find_newer_jl_for_cn()
1172 b_blocknr_t blocknr = cn->blocknr; in find_newer_jl_for_cn()
1174 cn = cn->hprev; in find_newer_jl_for_cn()
1175 while (cn) { in find_newer_jl_for_cn()
1176 if (cn->sb == sb && cn->blocknr == blocknr && cn->jlist) { in find_newer_jl_for_cn()
1177 return cn->jlist; in find_newer_jl_for_cn()
1179 cn = cn->hprev; in find_newer_jl_for_cn()
1200 struct reiserfs_journal_cnode *cn, *last; in remove_all_from_journal_list() local
1201 cn = jl->j_realblock; in remove_all_from_journal_list()
1207 while (cn) { in remove_all_from_journal_list()
1208 if (cn->blocknr != 0) { in remove_all_from_journal_list()
1212 cn->blocknr, cn->bh ? 1 : 0, in remove_all_from_journal_list()
1213 cn->state); in remove_all_from_journal_list()
1215 cn->state = 0; in remove_all_from_journal_list()
1217 jl, cn->blocknr, 1); in remove_all_from_journal_list()
1219 last = cn; in remove_all_from_journal_list()
1220 cn = cn->next; in remove_all_from_journal_list()
1349 struct reiserfs_journal_cnode *cn; in flush_journal_list() local
1410 cn = jl->j_realblock; in flush_journal_list()
1411 while (cn) { in flush_journal_list()
1416 if (cn->blocknr == 0) { in flush_journal_list()
1427 pjl = find_newer_jl_for_cn(cn); in flush_journal_list()
1433 if (!pjl && cn->bh) { in flush_journal_list()
1434 saved_bh = cn->bh; in flush_journal_list()
1443 BUG_ON(!can_dirty(cn)); in flush_journal_list()
1446 } else if (can_dirty(cn)) { in flush_journal_list()
1492 set_bit(BLOCK_NEEDS_FLUSH, &cn->state); in flush_journal_list()
1494 BUG_ON(cn->blocknr != saved_bh->b_blocknr); in flush_journal_list()
1507 cn = cn->next; in flush_journal_list()
1521 cn = jl->j_realblock; in flush_journal_list()
1522 while (cn) { in flush_journal_list()
1523 if (test_bit(BLOCK_NEEDS_FLUSH, &cn->state)) { in flush_journal_list()
1524 if (!cn->bh) { in flush_journal_list()
1526 "cn->bh is NULL"); in flush_journal_list()
1530 __wait_on_buffer(cn->bh); in flush_journal_list()
1533 if (!cn->bh) { in flush_journal_list()
1535 "cn->bh is NULL"); in flush_journal_list()
1537 if (unlikely(!buffer_uptodate(cn->bh))) { in flush_journal_list()
1550 (cn->bh)); in flush_journal_list()
1553 put_bh(cn->bh); in flush_journal_list()
1555 release_buffer_page(cn->bh); in flush_journal_list()
1557 cn = cn->next; in flush_journal_list()
1631 struct reiserfs_journal_cnode *cn; in write_one_transaction() local
1640 cn = jl->j_realblock; in write_one_transaction()
1641 while (cn) { in write_one_transaction()
1646 if (cn->blocknr == 0) { in write_one_transaction()
1649 if (cn->bh && can_dirty(cn) && buffer_dirty(cn->bh)) { in write_one_transaction()
1653 * to lock_buffer(cn->bh), so we have to inc the buffer in write_one_transaction()
1656 tmp_bh = cn->bh; in write_one_transaction()
1659 if (cn->bh && can_dirty(cn) && buffer_dirty(tmp_bh)) { in write_one_transaction()
1666 /* note, cn->bh might be null now */ in write_one_transaction()
1672 cn = cn->next; in write_one_transaction()
1682 struct reiserfs_journal_cnode *cn; in dirty_one_transaction() local
1686 cn = jl->j_realblock; in dirty_one_transaction()
1687 while (cn) { in dirty_one_transaction()
1693 pjl = find_newer_jl_for_cn(cn); in dirty_one_transaction()
1694 if (!pjl && cn->blocknr && cn->bh in dirty_one_transaction()
1695 && buffer_journal_dirty(cn->bh)) { in dirty_one_transaction()
1696 BUG_ON(!can_dirty(cn)); in dirty_one_transaction()
1702 clear_buffer_journal_new(cn->bh); in dirty_one_transaction()
1703 if (buffer_journal_prepared(cn->bh)) { in dirty_one_transaction()
1704 set_buffer_journal_restore_dirty(cn->bh); in dirty_one_transaction()
1706 set_buffer_journal_test(cn->bh); in dirty_one_transaction()
1707 mark_buffer_dirty(cn->bh); in dirty_one_transaction()
1710 cn = cn->next; in dirty_one_transaction()
3283 struct reiserfs_journal_cnode *cn = NULL; in journal_mark_dirty() local
3349 if (!cn) { in journal_mark_dirty()
3350 cn = get_cnode(sb); in journal_mark_dirty()
3351 if (!cn) { in journal_mark_dirty()
3362 cn->bh = bh; in journal_mark_dirty()
3363 cn->blocknr = bh->b_blocknr; in journal_mark_dirty()
3364 cn->sb = sb; in journal_mark_dirty()
3365 cn->jlist = NULL; in journal_mark_dirty()
3366 insert_journal_hash(journal->j_hash_table, cn); in journal_mark_dirty()
3371 cn->next = NULL; in journal_mark_dirty()
3372 cn->prev = journal->j_last; in journal_mark_dirty()
3373 cn->bh = bh; 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()
3430 struct reiserfs_journal_cnode *cn; in remove_from_transaction() local
3434 cn = get_journal_hash_dev(sb, journal->j_hash_table, blocknr); in remove_from_transaction()
3435 if (!cn || !cn->bh) { in remove_from_transaction()
3438 bh = cn->bh; in remove_from_transaction()
3439 if (cn->prev) { in remove_from_transaction()
3440 cn->prev->next = cn->next; in remove_from_transaction()
3442 if (cn->next) { in remove_from_transaction()
3443 cn->next->prev = cn->prev; 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()
3468 free_cnode(sb, cn); in remove_from_transaction()
3483 static int can_dirty(struct reiserfs_journal_cnode *cn) in can_dirty() argument
3485 struct super_block *sb = cn->sb; in can_dirty()
3486 b_blocknr_t blocknr = cn->blocknr; in can_dirty()
3487 struct reiserfs_journal_cnode *cur = cn->hprev; in can_dirty()
3491 * first test hprev. These are all newer than cn, so any node here in can_dirty()
3503 * then test hnext. These are all older than cn. As long as they in can_dirty()
3504 * are committed to the log, it is safe to write cn to disk in can_dirty()
3506 cur = cn->hnext; in can_dirty()
3743 struct reiserfs_journal_cnode *cn = NULL; in journal_mark_freed() local
3749 cn = get_journal_hash_dev(sb, journal->j_hash_table, blocknr); in journal_mark_freed()
3750 if (cn && cn->bh) { in journal_mark_freed()
3751 bh = cn->bh; in journal_mark_freed()
3784 cn = get_journal_hash_dev(sb, journal->j_list_hash_table, in journal_mark_freed()
3786 while (cn) { in journal_mark_freed()
3787 if (sb == cn->sb && blocknr == cn->blocknr) { in journal_mark_freed()
3788 set_bit(BLOCK_FREED, &cn->state); in journal_mark_freed()
3789 if (cn->bh) { in journal_mark_freed()
3796 clear_buffer_journal_dirty(cn-> in journal_mark_freed()
3798 clear_buffer_dirty(cn->bh); in journal_mark_freed()
3799 clear_buffer_journal_test(cn-> in journal_mark_freed()
3802 put_bh(cn->bh); in journal_mark_freed()
3804 (&cn->bh->b_count) < 0) { in journal_mark_freed()
3807 "cn->bh->b_count < 0"); in journal_mark_freed()
3814 if (cn->jlist) { in journal_mark_freed()
3815 atomic_dec(&cn->jlist-> in journal_mark_freed()
3818 cn->bh = NULL; in journal_mark_freed()
3821 cn = cn->hnext; in journal_mark_freed()
3933 struct reiserfs_journal_cnode *cn; in reiserfs_restore_prepared_buffer() local
3935 cn = get_journal_hash_dev(sb, in reiserfs_restore_prepared_buffer()
3938 if (cn && can_dirty(cn)) { in reiserfs_restore_prepared_buffer()
3987 struct reiserfs_journal_cnode *cn, *next, *jl_cn; in do_journal_end() local
4127 for (i = 0, cn = journal->j_first; cn; cn = cn->next, i++) { in do_journal_end()
4128 if (buffer_journaled(cn->bh)) { in do_journal_end()
4148 (sb, cn->bh->b_blocknr)) { in do_journal_end()
4152 cn->bh->b_blocknr); in do_journal_end()
4154 jl_cn->blocknr = cn->bh->b_blocknr; in do_journal_end()
4157 jl_cn->bh = cn->bh; in do_journal_end()
4162 cpu_to_le32(cn->bh->b_blocknr); in do_journal_end()
4165 cpu_to_le32(cn->bh->b_blocknr); in do_journal_end()
4194 cn = journal->j_first; in do_journal_end()
4196 while (cn) { in do_journal_end()
4197 clear_buffer_journal_new(cn->bh); in do_journal_end()
4199 if (buffer_journaled(cn->bh)) { in do_journal_end()
4210 page = cn->bh->b_page; in do_journal_end()
4213 addr + offset_in_page(cn->bh->b_data), in do_journal_end()
4214 cn->bh->b_size); in do_journal_end()
4218 set_buffer_journal_dirty(cn->bh); in do_journal_end()
4219 clear_buffer_journaled(cn->bh); in do_journal_end()
4228 brelse(cn->bh); in do_journal_end()
4230 next = cn->next; in do_journal_end()
4231 free_cnode(sb, cn); in do_journal_end()
4232 cn = next; in do_journal_end()