diff options
Diffstat (limited to 'fs/reiserfs/journal.c')
-rw-r--r-- | fs/reiserfs/journal.c | 67 |
1 files changed, 4 insertions, 63 deletions
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 73feacc49b2e..fd777032c2ba 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -1163,21 +1163,6 @@ static struct reiserfs_journal_list *find_newer_jl_for_cn(struct | |||
1163 | return NULL; | 1163 | return NULL; |
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | static int newer_jl_done(struct reiserfs_journal_cnode *cn) | ||
1167 | { | ||
1168 | struct super_block *sb = cn->sb; | ||
1169 | b_blocknr_t blocknr = cn->blocknr; | ||
1170 | |||
1171 | cn = cn->hprev; | ||
1172 | while (cn) { | ||
1173 | if (cn->sb == sb && cn->blocknr == blocknr && cn->jlist && | ||
1174 | atomic_read(&cn->jlist->j_commit_left) != 0) | ||
1175 | return 0; | ||
1176 | cn = cn->hprev; | ||
1177 | } | ||
1178 | return 1; | ||
1179 | } | ||
1180 | |||
1181 | static void remove_journal_hash(struct super_block *, | 1166 | static void remove_journal_hash(struct super_block *, |
1182 | struct reiserfs_journal_cnode **, | 1167 | struct reiserfs_journal_cnode **, |
1183 | struct reiserfs_journal_list *, unsigned long, | 1168 | struct reiserfs_journal_list *, unsigned long, |
@@ -1353,7 +1338,6 @@ static int flush_journal_list(struct super_block *s, | |||
1353 | reiserfs_warning(s, "clm-2048", "called with wcount %d", | 1338 | reiserfs_warning(s, "clm-2048", "called with wcount %d", |
1354 | atomic_read(&journal->j_wcount)); | 1339 | atomic_read(&journal->j_wcount)); |
1355 | } | 1340 | } |
1356 | BUG_ON(jl->j_trans_id == 0); | ||
1357 | 1341 | ||
1358 | /* if flushall == 0, the lock is already held */ | 1342 | /* if flushall == 0, the lock is already held */ |
1359 | if (flushall) { | 1343 | if (flushall) { |
@@ -1593,31 +1577,6 @@ static int flush_journal_list(struct super_block *s, | |||
1593 | return err; | 1577 | return err; |
1594 | } | 1578 | } |
1595 | 1579 | ||
1596 | static int test_transaction(struct super_block *s, | ||
1597 | struct reiserfs_journal_list *jl) | ||
1598 | { | ||
1599 | struct reiserfs_journal_cnode *cn; | ||
1600 | |||
1601 | if (jl->j_len == 0 || atomic_read(&jl->j_nonzerolen) == 0) | ||
1602 | return 1; | ||
1603 | |||
1604 | cn = jl->j_realblock; | ||
1605 | while (cn) { | ||
1606 | /* if the blocknr == 0, this has been cleared from the hash, | ||
1607 | ** skip it | ||
1608 | */ | ||
1609 | if (cn->blocknr == 0) { | ||
1610 | goto next; | ||
1611 | } | ||
1612 | if (cn->bh && !newer_jl_done(cn)) | ||
1613 | return 0; | ||
1614 | next: | ||
1615 | cn = cn->next; | ||
1616 | cond_resched(); | ||
1617 | } | ||
1618 | return 0; | ||
1619 | } | ||
1620 | |||
1621 | static int write_one_transaction(struct super_block *s, | 1580 | static int write_one_transaction(struct super_block *s, |
1622 | struct reiserfs_journal_list *jl, | 1581 | struct reiserfs_journal_list *jl, |
1623 | struct buffer_chunk *chunk) | 1582 | struct buffer_chunk *chunk) |
@@ -1805,6 +1764,8 @@ static int flush_used_journal_lists(struct super_block *s, | |||
1805 | break; | 1764 | break; |
1806 | tjl = JOURNAL_LIST_ENTRY(tjl->j_list.next); | 1765 | tjl = JOURNAL_LIST_ENTRY(tjl->j_list.next); |
1807 | } | 1766 | } |
1767 | get_journal_list(jl); | ||
1768 | get_journal_list(flush_jl); | ||
1808 | /* try to find a group of blocks we can flush across all the | 1769 | /* try to find a group of blocks we can flush across all the |
1809 | ** transactions, but only bother if we've actually spanned | 1770 | ** transactions, but only bother if we've actually spanned |
1810 | ** across multiple lists | 1771 | ** across multiple lists |
@@ -1813,6 +1774,8 @@ static int flush_used_journal_lists(struct super_block *s, | |||
1813 | ret = kupdate_transactions(s, jl, &tjl, &trans_id, len, i); | 1774 | ret = kupdate_transactions(s, jl, &tjl, &trans_id, len, i); |
1814 | } | 1775 | } |
1815 | flush_journal_list(s, flush_jl, 1); | 1776 | flush_journal_list(s, flush_jl, 1); |
1777 | put_journal_list(s, flush_jl); | ||
1778 | put_journal_list(s, jl); | ||
1816 | return 0; | 1779 | return 0; |
1817 | } | 1780 | } |
1818 | 1781 | ||
@@ -3868,27 +3831,6 @@ int reiserfs_prepare_for_journal(struct super_block *sb, | |||
3868 | return 1; | 3831 | return 1; |
3869 | } | 3832 | } |
3870 | 3833 | ||
3871 | static void flush_old_journal_lists(struct super_block *s) | ||
3872 | { | ||
3873 | struct reiserfs_journal *journal = SB_JOURNAL(s); | ||
3874 | struct reiserfs_journal_list *jl; | ||
3875 | struct list_head *entry; | ||
3876 | time_t now = get_seconds(); | ||
3877 | |||
3878 | while (!list_empty(&journal->j_journal_list)) { | ||
3879 | entry = journal->j_journal_list.next; | ||
3880 | jl = JOURNAL_LIST_ENTRY(entry); | ||
3881 | /* this check should always be run, to send old lists to disk */ | ||
3882 | if (jl->j_timestamp < (now - (JOURNAL_MAX_TRANS_AGE * 4)) && | ||
3883 | atomic_read(&jl->j_commit_left) == 0 && | ||
3884 | test_transaction(s, jl)) { | ||
3885 | flush_used_journal_lists(s, jl); | ||
3886 | } else { | ||
3887 | break; | ||
3888 | } | ||
3889 | } | ||
3890 | } | ||
3891 | |||
3892 | /* | 3834 | /* |
3893 | ** long and ugly. If flush, will not return until all commit | 3835 | ** long and ugly. If flush, will not return until all commit |
3894 | ** blocks and all real buffers in the trans are on disk. | 3836 | ** blocks and all real buffers in the trans are on disk. |
@@ -4232,7 +4174,6 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, | |||
4232 | } | 4174 | } |
4233 | } | 4175 | } |
4234 | } | 4176 | } |
4235 | flush_old_journal_lists(sb); | ||
4236 | 4177 | ||
4237 | journal->j_current_jl->j_list_bitmap = | 4178 | journal->j_current_jl->j_list_bitmap = |
4238 | get_list_bitmap(sb, journal->j_current_jl); | 4179 | get_list_bitmap(sb, journal->j_current_jl); |