.. | .. |
---|
32 | 32 | * to disk for all backgrounded commits that have been |
---|
33 | 33 | * around too long. |
---|
34 | 34 | * -- Note, if you call this as an immediate flush from |
---|
35 | | - * from within kupdate, it will ignore the immediate flag |
---|
| 35 | + * within kupdate, it will ignore the immediate flag |
---|
36 | 36 | */ |
---|
37 | 37 | |
---|
38 | 38 | #include <linux/time.h> |
---|
.. | .. |
---|
56 | 56 | /* gets a struct reiserfs_journal_list * from a list head */ |
---|
57 | 57 | #define JOURNAL_LIST_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \ |
---|
58 | 58 | j_list)) |
---|
59 | | -#define JOURNAL_WORK_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \ |
---|
60 | | - j_working_list)) |
---|
61 | 59 | |
---|
62 | 60 | /* must be correct to keep the desc and commit structs at 4k */ |
---|
63 | 61 | #define JOURNAL_TRANS_HALF 1018 |
---|
.. | .. |
---|
94 | 92 | struct super_block *sb); |
---|
95 | 93 | static void release_journal_dev(struct super_block *super, |
---|
96 | 94 | struct reiserfs_journal *journal); |
---|
97 | | -static int dirty_one_transaction(struct super_block *s, |
---|
| 95 | +static void dirty_one_transaction(struct super_block *s, |
---|
98 | 96 | struct reiserfs_journal_list *jl); |
---|
99 | 97 | static void flush_async_commits(struct work_struct *work); |
---|
100 | 98 | static void queue_log_writer(struct super_block *s); |
---|
.. | .. |
---|
891 | 889 | struct list_head *entry; |
---|
892 | 890 | unsigned int trans_id = jl->j_trans_id; |
---|
893 | 891 | unsigned int other_trans_id; |
---|
894 | | - unsigned int first_trans_id; |
---|
895 | 892 | |
---|
896 | 893 | find_first: |
---|
897 | 894 | /* |
---|
.. | .. |
---|
913 | 910 | if (first_jl == jl) { |
---|
914 | 911 | return 0; |
---|
915 | 912 | } |
---|
916 | | - |
---|
917 | | - first_trans_id = first_jl->j_trans_id; |
---|
918 | 913 | |
---|
919 | 914 | entry = &first_jl->j_list; |
---|
920 | 915 | while (1) { |
---|
.. | .. |
---|
1351 | 1346 | struct reiserfs_journal_list *jl, int flushall) |
---|
1352 | 1347 | { |
---|
1353 | 1348 | struct reiserfs_journal_list *pjl; |
---|
1354 | | - struct reiserfs_journal_cnode *cn, *last; |
---|
| 1349 | + struct reiserfs_journal_cnode *cn; |
---|
1355 | 1350 | int count; |
---|
1356 | 1351 | int was_jwait = 0; |
---|
1357 | 1352 | int was_dirty = 0; |
---|
.. | .. |
---|
1509 | 1504 | b_blocknr, __func__); |
---|
1510 | 1505 | } |
---|
1511 | 1506 | free_cnode: |
---|
1512 | | - last = cn; |
---|
1513 | 1507 | cn = cn->next; |
---|
1514 | 1508 | if (saved_bh) { |
---|
1515 | 1509 | /* |
---|
.. | .. |
---|
1682 | 1676 | } |
---|
1683 | 1677 | |
---|
1684 | 1678 | /* used by flush_commit_list */ |
---|
1685 | | -static int dirty_one_transaction(struct super_block *s, |
---|
| 1679 | +static void dirty_one_transaction(struct super_block *s, |
---|
1686 | 1680 | struct reiserfs_journal_list *jl) |
---|
1687 | 1681 | { |
---|
1688 | 1682 | struct reiserfs_journal_cnode *cn; |
---|
1689 | 1683 | struct reiserfs_journal_list *pjl; |
---|
1690 | | - int ret = 0; |
---|
1691 | 1684 | |
---|
1692 | 1685 | jl->j_state |= LIST_DIRTY; |
---|
1693 | 1686 | cn = jl->j_realblock; |
---|
.. | .. |
---|
1716 | 1709 | } |
---|
1717 | 1710 | cn = cn->next; |
---|
1718 | 1711 | } |
---|
1719 | | - return ret; |
---|
1720 | 1712 | } |
---|
1721 | 1713 | |
---|
1722 | 1714 | static int kupdate_transactions(struct super_block *s, |
---|
.. | .. |
---|
1794 | 1786 | { |
---|
1795 | 1787 | unsigned long len = 0; |
---|
1796 | 1788 | unsigned long cur_len; |
---|
1797 | | - int ret; |
---|
1798 | 1789 | int i; |
---|
1799 | 1790 | int limit = 256; |
---|
1800 | 1791 | struct reiserfs_journal_list *tjl; |
---|
.. | .. |
---|
1831 | 1822 | * transactions, but only bother if we've actually spanned |
---|
1832 | 1823 | * across multiple lists |
---|
1833 | 1824 | */ |
---|
1834 | | - if (flush_jl != jl) { |
---|
1835 | | - ret = kupdate_transactions(s, jl, &tjl, &trans_id, len, i); |
---|
1836 | | - } |
---|
| 1825 | + if (flush_jl != jl) |
---|
| 1826 | + kupdate_transactions(s, jl, &tjl, &trans_id, len, i); |
---|
| 1827 | + |
---|
1837 | 1828 | flush_journal_list(s, flush_jl, 1); |
---|
1838 | 1829 | put_journal_list(s, flush_jl); |
---|
1839 | 1830 | put_journal_list(s, jl); |
---|
.. | .. |
---|
1844 | 1835 | * removes any nodes in table with name block and dev as bh. |
---|
1845 | 1836 | * only touchs the hnext and hprev pointers. |
---|
1846 | 1837 | */ |
---|
1847 | | -void remove_journal_hash(struct super_block *sb, |
---|
| 1838 | +static void remove_journal_hash(struct super_block *sb, |
---|
1848 | 1839 | struct reiserfs_journal_cnode **table, |
---|
1849 | 1840 | struct reiserfs_journal_list *jl, |
---|
1850 | 1841 | unsigned long block, int remove_freed) |
---|
.. | .. |
---|
1913 | 1904 | struct super_block *sb, int error) |
---|
1914 | 1905 | { |
---|
1915 | 1906 | struct reiserfs_transaction_handle myth; |
---|
1916 | | - int flushed = 0; |
---|
1917 | 1907 | struct reiserfs_journal *journal = SB_JOURNAL(sb); |
---|
1918 | 1908 | |
---|
1919 | 1909 | /* |
---|
.. | .. |
---|
1935 | 1925 | 1); |
---|
1936 | 1926 | journal_mark_dirty(&myth, SB_BUFFER_WITH_SB(sb)); |
---|
1937 | 1927 | do_journal_end(&myth, FLUSH_ALL); |
---|
1938 | | - flushed = 1; |
---|
1939 | 1928 | } |
---|
1940 | 1929 | } |
---|
1941 | 1930 | |
---|
.. | .. |
---|
2336 | 2325 | int i, j; |
---|
2337 | 2326 | |
---|
2338 | 2327 | bh = __getblk(dev, block, bufsize); |
---|
2339 | | - if (buffer_uptodate(bh)) |
---|
| 2328 | + if (!bh || buffer_uptodate(bh)) |
---|
2340 | 2329 | return (bh); |
---|
2341 | 2330 | |
---|
2342 | 2331 | if (block + BUFNR > max_block) { |
---|
.. | .. |
---|
2346 | 2335 | j = 1; |
---|
2347 | 2336 | for (i = 1; i < blocks; i++) { |
---|
2348 | 2337 | bh = __getblk(dev, block + i, bufsize); |
---|
| 2338 | + if (!bh) |
---|
| 2339 | + break; |
---|
2349 | 2340 | if (buffer_uptodate(bh)) { |
---|
2350 | 2341 | brelse(bh); |
---|
2351 | 2342 | break; |
---|
.. | .. |
---|
2610 | 2601 | int result; |
---|
2611 | 2602 | dev_t jdev; |
---|
2612 | 2603 | fmode_t blkdev_mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL; |
---|
2613 | | - char b[BDEVNAME_SIZE]; |
---|
2614 | 2604 | |
---|
2615 | 2605 | result = 0; |
---|
2616 | 2606 | |
---|
.. | .. |
---|
2632 | 2622 | result = PTR_ERR(journal->j_dev_bd); |
---|
2633 | 2623 | journal->j_dev_bd = NULL; |
---|
2634 | 2624 | reiserfs_warning(super, "sh-458", |
---|
2635 | | - "cannot init journal device '%s': %i", |
---|
2636 | | - __bdevname(jdev, b), result); |
---|
| 2625 | + "cannot init journal device unknown-block(%u,%u): %i", |
---|
| 2626 | + MAJOR(jdev), MINOR(jdev), result); |
---|
2637 | 2627 | return result; |
---|
2638 | 2628 | } else if (jdev != super->s_dev) |
---|
2639 | 2629 | set_blocksize(journal->j_dev_bd, super->s_blocksize); |
---|
.. | .. |
---|
3460 | 3450 | if (cn == journal->j_last) { |
---|
3461 | 3451 | journal->j_last = cn->prev; |
---|
3462 | 3452 | } |
---|
3463 | | - if (bh) |
---|
3464 | | - remove_journal_hash(sb, journal->j_hash_table, NULL, |
---|
3465 | | - bh->b_blocknr, 0); |
---|
| 3453 | + remove_journal_hash(sb, journal->j_hash_table, NULL, |
---|
| 3454 | + bh->b_blocknr, 0); |
---|
3466 | 3455 | clear_buffer_journaled(bh); /* don't log this one */ |
---|
3467 | 3456 | |
---|
3468 | 3457 | if (!already_cleaned) { |
---|
.. | .. |
---|
4004 | 3993 | struct buffer_head *c_bh; /* commit bh */ |
---|
4005 | 3994 | struct buffer_head *d_bh; /* desc bh */ |
---|
4006 | 3995 | int cur_write_start = 0; /* start index of current log write */ |
---|
4007 | | - int old_start; |
---|
4008 | 3996 | int i; |
---|
4009 | 3997 | int flush; |
---|
4010 | 3998 | int wait_on_commit; |
---|
.. | .. |
---|
4261 | 4249 | journal->j_num_work_lists++; |
---|
4262 | 4250 | |
---|
4263 | 4251 | /* reset journal values for the next transaction */ |
---|
4264 | | - old_start = journal->j_start; |
---|
4265 | 4252 | journal->j_start = |
---|
4266 | 4253 | (journal->j_start + journal->j_len + |
---|
4267 | 4254 | 2) % SB_ONDISK_JOURNAL_SIZE(sb); |
---|