hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/fs/reiserfs/journal.c
....@@ -32,7 +32,7 @@
3232 * to disk for all backgrounded commits that have been
3333 * around too long.
3434 * -- 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
3636 */
3737
3838 #include <linux/time.h>
....@@ -56,8 +56,6 @@
5656 /* gets a struct reiserfs_journal_list * from a list head */
5757 #define JOURNAL_LIST_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \
5858 j_list))
59
-#define JOURNAL_WORK_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \
60
- j_working_list))
6159
6260 /* must be correct to keep the desc and commit structs at 4k */
6361 #define JOURNAL_TRANS_HALF 1018
....@@ -94,7 +92,7 @@
9492 struct super_block *sb);
9593 static void release_journal_dev(struct super_block *super,
9694 struct reiserfs_journal *journal);
97
-static int dirty_one_transaction(struct super_block *s,
95
+static void dirty_one_transaction(struct super_block *s,
9896 struct reiserfs_journal_list *jl);
9997 static void flush_async_commits(struct work_struct *work);
10098 static void queue_log_writer(struct super_block *s);
....@@ -891,7 +889,6 @@
891889 struct list_head *entry;
892890 unsigned int trans_id = jl->j_trans_id;
893891 unsigned int other_trans_id;
894
- unsigned int first_trans_id;
895892
896893 find_first:
897894 /*
....@@ -913,8 +910,6 @@
913910 if (first_jl == jl) {
914911 return 0;
915912 }
916
-
917
- first_trans_id = first_jl->j_trans_id;
918913
919914 entry = &first_jl->j_list;
920915 while (1) {
....@@ -1351,7 +1346,7 @@
13511346 struct reiserfs_journal_list *jl, int flushall)
13521347 {
13531348 struct reiserfs_journal_list *pjl;
1354
- struct reiserfs_journal_cnode *cn, *last;
1349
+ struct reiserfs_journal_cnode *cn;
13551350 int count;
13561351 int was_jwait = 0;
13571352 int was_dirty = 0;
....@@ -1509,7 +1504,6 @@
15091504 b_blocknr, __func__);
15101505 }
15111506 free_cnode:
1512
- last = cn;
15131507 cn = cn->next;
15141508 if (saved_bh) {
15151509 /*
....@@ -1682,12 +1676,11 @@
16821676 }
16831677
16841678 /* 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,
16861680 struct reiserfs_journal_list *jl)
16871681 {
16881682 struct reiserfs_journal_cnode *cn;
16891683 struct reiserfs_journal_list *pjl;
1690
- int ret = 0;
16911684
16921685 jl->j_state |= LIST_DIRTY;
16931686 cn = jl->j_realblock;
....@@ -1716,7 +1709,6 @@
17161709 }
17171710 cn = cn->next;
17181711 }
1719
- return ret;
17201712 }
17211713
17221714 static int kupdate_transactions(struct super_block *s,
....@@ -1794,7 +1786,6 @@
17941786 {
17951787 unsigned long len = 0;
17961788 unsigned long cur_len;
1797
- int ret;
17981789 int i;
17991790 int limit = 256;
18001791 struct reiserfs_journal_list *tjl;
....@@ -1831,9 +1822,9 @@
18311822 * transactions, but only bother if we've actually spanned
18321823 * across multiple lists
18331824 */
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
+
18371828 flush_journal_list(s, flush_jl, 1);
18381829 put_journal_list(s, flush_jl);
18391830 put_journal_list(s, jl);
....@@ -1844,7 +1835,7 @@
18441835 * removes any nodes in table with name block and dev as bh.
18451836 * only touchs the hnext and hprev pointers.
18461837 */
1847
-void remove_journal_hash(struct super_block *sb,
1838
+static void remove_journal_hash(struct super_block *sb,
18481839 struct reiserfs_journal_cnode **table,
18491840 struct reiserfs_journal_list *jl,
18501841 unsigned long block, int remove_freed)
....@@ -1913,7 +1904,6 @@
19131904 struct super_block *sb, int error)
19141905 {
19151906 struct reiserfs_transaction_handle myth;
1916
- int flushed = 0;
19171907 struct reiserfs_journal *journal = SB_JOURNAL(sb);
19181908
19191909 /*
....@@ -1935,7 +1925,6 @@
19351925 1);
19361926 journal_mark_dirty(&myth, SB_BUFFER_WITH_SB(sb));
19371927 do_journal_end(&myth, FLUSH_ALL);
1938
- flushed = 1;
19391928 }
19401929 }
19411930
....@@ -2336,7 +2325,7 @@
23362325 int i, j;
23372326
23382327 bh = __getblk(dev, block, bufsize);
2339
- if (buffer_uptodate(bh))
2328
+ if (!bh || buffer_uptodate(bh))
23402329 return (bh);
23412330
23422331 if (block + BUFNR > max_block) {
....@@ -2346,6 +2335,8 @@
23462335 j = 1;
23472336 for (i = 1; i < blocks; i++) {
23482337 bh = __getblk(dev, block + i, bufsize);
2338
+ if (!bh)
2339
+ break;
23492340 if (buffer_uptodate(bh)) {
23502341 brelse(bh);
23512342 break;
....@@ -2610,7 +2601,6 @@
26102601 int result;
26112602 dev_t jdev;
26122603 fmode_t blkdev_mode = FMODE_READ | FMODE_WRITE | FMODE_EXCL;
2613
- char b[BDEVNAME_SIZE];
26142604
26152605 result = 0;
26162606
....@@ -2632,8 +2622,8 @@
26322622 result = PTR_ERR(journal->j_dev_bd);
26332623 journal->j_dev_bd = NULL;
26342624 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);
26372627 return result;
26382628 } else if (jdev != super->s_dev)
26392629 set_blocksize(journal->j_dev_bd, super->s_blocksize);
....@@ -3460,9 +3450,8 @@
34603450 if (cn == journal->j_last) {
34613451 journal->j_last = cn->prev;
34623452 }
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);
34663455 clear_buffer_journaled(bh); /* don't log this one */
34673456
34683457 if (!already_cleaned) {
....@@ -4004,7 +3993,6 @@
40043993 struct buffer_head *c_bh; /* commit bh */
40053994 struct buffer_head *d_bh; /* desc bh */
40063995 int cur_write_start = 0; /* start index of current log write */
4007
- int old_start;
40083996 int i;
40093997 int flush;
40103998 int wait_on_commit;
....@@ -4261,7 +4249,6 @@
42614249 journal->j_num_work_lists++;
42624250
42634251 /* reset journal values for the next transaction */
4264
- old_start = journal->j_start;
42654252 journal->j_start =
42664253 (journal->j_start + journal->j_len +
42674254 2) % SB_ONDISK_JOURNAL_SIZE(sb);