diff options
author | Jeff Mahoney <jeffm@suse.com> | 2009-03-30 14:02:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-03-30 15:16:35 -0400 |
commit | 600ed41675d8c384519d8f0b3c76afed39ef2f4b (patch) | |
tree | 106f17dcaaee07671efdef651ff7f78b1afffb2f /fs/reiserfs | |
parent | 702d21c6f6c790b12c4820cd2f29bc8472aed633 (diff) |
reiserfs: audit transaction ids to always be unsigned ints
This patch fixes up the reiserfs code such that transaction ids are
always unsigned ints. In places they can currently be signed ints or
unsigned longs.
The former just causes an annoying clm-2200 warning and may join a
transaction when it should wait.
The latter is just for correctness since the disk format uses a 32-bit
transaction id. There aren't any runtime problems that result from it
not wrapping at the correct location since the value is truncated
correctly even on big endian systems. The 0 value might make it to
disk, but the mount-time checks will bump it to 10 itself.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/journal.c | 46 | ||||
-rw-r--r-- | fs/reiserfs/procfs.c | 4 |
2 files changed, 25 insertions, 25 deletions
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 9643c3bbeb3b..677bb926e7d6 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -574,7 +574,7 @@ static inline void put_journal_list(struct super_block *s, | |||
574 | struct reiserfs_journal_list *jl) | 574 | struct reiserfs_journal_list *jl) |
575 | { | 575 | { |
576 | if (jl->j_refcount < 1) { | 576 | if (jl->j_refcount < 1) { |
577 | reiserfs_panic(s, "trans id %lu, refcount at %d", | 577 | reiserfs_panic(s, "trans id %u, refcount at %d", |
578 | jl->j_trans_id, jl->j_refcount); | 578 | jl->j_trans_id, jl->j_refcount); |
579 | } | 579 | } |
580 | if (--jl->j_refcount == 0) | 580 | if (--jl->j_refcount == 0) |
@@ -599,7 +599,7 @@ static void cleanup_freed_for_journal_list(struct super_block *p_s_sb, | |||
599 | } | 599 | } |
600 | 600 | ||
601 | static int journal_list_still_alive(struct super_block *s, | 601 | static int journal_list_still_alive(struct super_block *s, |
602 | unsigned long trans_id) | 602 | unsigned int trans_id) |
603 | { | 603 | { |
604 | struct reiserfs_journal *journal = SB_JOURNAL(s); | 604 | struct reiserfs_journal *journal = SB_JOURNAL(s); |
605 | struct list_head *entry = &journal->j_journal_list; | 605 | struct list_head *entry = &journal->j_journal_list; |
@@ -933,9 +933,9 @@ static int flush_older_commits(struct super_block *s, | |||
933 | struct reiserfs_journal_list *other_jl; | 933 | struct reiserfs_journal_list *other_jl; |
934 | struct reiserfs_journal_list *first_jl; | 934 | struct reiserfs_journal_list *first_jl; |
935 | struct list_head *entry; | 935 | struct list_head *entry; |
936 | unsigned long trans_id = jl->j_trans_id; | 936 | unsigned int trans_id = jl->j_trans_id; |
937 | unsigned long other_trans_id; | 937 | unsigned int other_trans_id; |
938 | unsigned long first_trans_id; | 938 | unsigned int first_trans_id; |
939 | 939 | ||
940 | find_first: | 940 | find_first: |
941 | /* | 941 | /* |
@@ -1014,7 +1014,7 @@ static int flush_commit_list(struct super_block *s, | |||
1014 | int i; | 1014 | int i; |
1015 | b_blocknr_t bn; | 1015 | b_blocknr_t bn; |
1016 | struct buffer_head *tbh = NULL; | 1016 | struct buffer_head *tbh = NULL; |
1017 | unsigned long trans_id = jl->j_trans_id; | 1017 | unsigned int trans_id = jl->j_trans_id; |
1018 | struct reiserfs_journal *journal = SB_JOURNAL(s); | 1018 | struct reiserfs_journal *journal = SB_JOURNAL(s); |
1019 | int barrier = 0; | 1019 | int barrier = 0; |
1020 | int retval = 0; | 1020 | int retval = 0; |
@@ -1275,7 +1275,7 @@ static void remove_all_from_journal_list(struct super_block *p_s_sb, | |||
1275 | */ | 1275 | */ |
1276 | static int _update_journal_header_block(struct super_block *p_s_sb, | 1276 | static int _update_journal_header_block(struct super_block *p_s_sb, |
1277 | unsigned long offset, | 1277 | unsigned long offset, |
1278 | unsigned long trans_id) | 1278 | unsigned int trans_id) |
1279 | { | 1279 | { |
1280 | struct reiserfs_journal_header *jh; | 1280 | struct reiserfs_journal_header *jh; |
1281 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); | 1281 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); |
@@ -1329,7 +1329,7 @@ static int _update_journal_header_block(struct super_block *p_s_sb, | |||
1329 | 1329 | ||
1330 | static int update_journal_header_block(struct super_block *p_s_sb, | 1330 | static int update_journal_header_block(struct super_block *p_s_sb, |
1331 | unsigned long offset, | 1331 | unsigned long offset, |
1332 | unsigned long trans_id) | 1332 | unsigned int trans_id) |
1333 | { | 1333 | { |
1334 | return _update_journal_header_block(p_s_sb, offset, trans_id); | 1334 | return _update_journal_header_block(p_s_sb, offset, trans_id); |
1335 | } | 1335 | } |
@@ -1344,7 +1344,7 @@ static int flush_older_journal_lists(struct super_block *p_s_sb, | |||
1344 | struct list_head *entry; | 1344 | struct list_head *entry; |
1345 | struct reiserfs_journal_list *other_jl; | 1345 | struct reiserfs_journal_list *other_jl; |
1346 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); | 1346 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); |
1347 | unsigned long trans_id = jl->j_trans_id; | 1347 | unsigned int trans_id = jl->j_trans_id; |
1348 | 1348 | ||
1349 | /* we know we are the only ones flushing things, no extra race | 1349 | /* we know we are the only ones flushing things, no extra race |
1350 | * protection is required. | 1350 | * protection is required. |
@@ -1758,13 +1758,13 @@ static int dirty_one_transaction(struct super_block *s, | |||
1758 | static int kupdate_transactions(struct super_block *s, | 1758 | static int kupdate_transactions(struct super_block *s, |
1759 | struct reiserfs_journal_list *jl, | 1759 | struct reiserfs_journal_list *jl, |
1760 | struct reiserfs_journal_list **next_jl, | 1760 | struct reiserfs_journal_list **next_jl, |
1761 | unsigned long *next_trans_id, | 1761 | unsigned int *next_trans_id, |
1762 | int num_blocks, int num_trans) | 1762 | int num_blocks, int num_trans) |
1763 | { | 1763 | { |
1764 | int ret = 0; | 1764 | int ret = 0; |
1765 | int written = 0; | 1765 | int written = 0; |
1766 | int transactions_flushed = 0; | 1766 | int transactions_flushed = 0; |
1767 | unsigned long orig_trans_id = jl->j_trans_id; | 1767 | unsigned int orig_trans_id = jl->j_trans_id; |
1768 | struct buffer_chunk chunk; | 1768 | struct buffer_chunk chunk; |
1769 | struct list_head *entry; | 1769 | struct list_head *entry; |
1770 | struct reiserfs_journal *journal = SB_JOURNAL(s); | 1770 | struct reiserfs_journal *journal = SB_JOURNAL(s); |
@@ -1833,7 +1833,7 @@ static int flush_used_journal_lists(struct super_block *s, | |||
1833 | int limit = 256; | 1833 | int limit = 256; |
1834 | struct reiserfs_journal_list *tjl; | 1834 | struct reiserfs_journal_list *tjl; |
1835 | struct reiserfs_journal_list *flush_jl; | 1835 | struct reiserfs_journal_list *flush_jl; |
1836 | unsigned long trans_id; | 1836 | unsigned int trans_id; |
1837 | struct reiserfs_journal *journal = SB_JOURNAL(s); | 1837 | struct reiserfs_journal *journal = SB_JOURNAL(s); |
1838 | 1838 | ||
1839 | flush_jl = tjl = jl; | 1839 | flush_jl = tjl = jl; |
@@ -2023,7 +2023,7 @@ static int journal_compare_desc_commit(struct super_block *p_s_sb, | |||
2023 | */ | 2023 | */ |
2024 | static int journal_transaction_is_valid(struct super_block *p_s_sb, | 2024 | static int journal_transaction_is_valid(struct super_block *p_s_sb, |
2025 | struct buffer_head *d_bh, | 2025 | struct buffer_head *d_bh, |
2026 | unsigned long *oldest_invalid_trans_id, | 2026 | unsigned int *oldest_invalid_trans_id, |
2027 | unsigned long *newest_mount_id) | 2027 | unsigned long *newest_mount_id) |
2028 | { | 2028 | { |
2029 | struct reiserfs_journal_desc *desc; | 2029 | struct reiserfs_journal_desc *desc; |
@@ -2124,18 +2124,18 @@ static void brelse_array(struct buffer_head **heads, int num) | |||
2124 | static int journal_read_transaction(struct super_block *p_s_sb, | 2124 | static int journal_read_transaction(struct super_block *p_s_sb, |
2125 | unsigned long cur_dblock, | 2125 | unsigned long cur_dblock, |
2126 | unsigned long oldest_start, | 2126 | unsigned long oldest_start, |
2127 | unsigned long oldest_trans_id, | 2127 | unsigned int oldest_trans_id, |
2128 | unsigned long newest_mount_id) | 2128 | unsigned long newest_mount_id) |
2129 | { | 2129 | { |
2130 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); | 2130 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); |
2131 | struct reiserfs_journal_desc *desc; | 2131 | struct reiserfs_journal_desc *desc; |
2132 | struct reiserfs_journal_commit *commit; | 2132 | struct reiserfs_journal_commit *commit; |
2133 | unsigned long trans_id = 0; | 2133 | unsigned int trans_id = 0; |
2134 | struct buffer_head *c_bh; | 2134 | struct buffer_head *c_bh; |
2135 | struct buffer_head *d_bh; | 2135 | struct buffer_head *d_bh; |
2136 | struct buffer_head **log_blocks = NULL; | 2136 | struct buffer_head **log_blocks = NULL; |
2137 | struct buffer_head **real_blocks = NULL; | 2137 | struct buffer_head **real_blocks = NULL; |
2138 | unsigned long trans_offset; | 2138 | unsigned int trans_offset; |
2139 | int i; | 2139 | int i; |
2140 | int trans_half; | 2140 | int trans_half; |
2141 | 2141 | ||
@@ -2356,8 +2356,8 @@ static int journal_read(struct super_block *p_s_sb) | |||
2356 | { | 2356 | { |
2357 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); | 2357 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); |
2358 | struct reiserfs_journal_desc *desc; | 2358 | struct reiserfs_journal_desc *desc; |
2359 | unsigned long oldest_trans_id = 0; | 2359 | unsigned int oldest_trans_id = 0; |
2360 | unsigned long oldest_invalid_trans_id = 0; | 2360 | unsigned int oldest_invalid_trans_id = 0; |
2361 | time_t start; | 2361 | time_t start; |
2362 | unsigned long oldest_start = 0; | 2362 | unsigned long oldest_start = 0; |
2363 | unsigned long cur_dblock = 0; | 2363 | unsigned long cur_dblock = 0; |
@@ -2970,7 +2970,7 @@ static void wake_queued_writers(struct super_block *s) | |||
2970 | wake_up(&journal->j_join_wait); | 2970 | wake_up(&journal->j_join_wait); |
2971 | } | 2971 | } |
2972 | 2972 | ||
2973 | static void let_transaction_grow(struct super_block *sb, unsigned long trans_id) | 2973 | static void let_transaction_grow(struct super_block *sb, unsigned int trans_id) |
2974 | { | 2974 | { |
2975 | struct reiserfs_journal *journal = SB_JOURNAL(sb); | 2975 | struct reiserfs_journal *journal = SB_JOURNAL(sb); |
2976 | unsigned long bcount = journal->j_bcount; | 2976 | unsigned long bcount = journal->j_bcount; |
@@ -3001,7 +3001,7 @@ static int do_journal_begin_r(struct reiserfs_transaction_handle *th, | |||
3001 | int join) | 3001 | int join) |
3002 | { | 3002 | { |
3003 | time_t now = get_seconds(); | 3003 | time_t now = get_seconds(); |
3004 | int old_trans_id; | 3004 | unsigned int old_trans_id; |
3005 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); | 3005 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); |
3006 | struct reiserfs_transaction_handle myth; | 3006 | struct reiserfs_transaction_handle myth; |
3007 | int sched_count = 0; | 3007 | int sched_count = 0; |
@@ -3824,7 +3824,7 @@ static int __commit_trans_jl(struct inode *inode, unsigned long id, | |||
3824 | 3824 | ||
3825 | int reiserfs_commit_for_inode(struct inode *inode) | 3825 | int reiserfs_commit_for_inode(struct inode *inode) |
3826 | { | 3826 | { |
3827 | unsigned long id = REISERFS_I(inode)->i_trans_id; | 3827 | unsigned int id = REISERFS_I(inode)->i_trans_id; |
3828 | struct reiserfs_journal_list *jl = REISERFS_I(inode)->i_jl; | 3828 | struct reiserfs_journal_list *jl = REISERFS_I(inode)->i_jl; |
3829 | 3829 | ||
3830 | /* for the whole inode, assume unset id means it was | 3830 | /* for the whole inode, assume unset id means it was |
@@ -3938,7 +3938,7 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, | |||
3938 | struct reiserfs_journal_list *jl, *temp_jl; | 3938 | struct reiserfs_journal_list *jl, *temp_jl; |
3939 | struct list_head *entry, *safe; | 3939 | struct list_head *entry, *safe; |
3940 | unsigned long jindex; | 3940 | unsigned long jindex; |
3941 | unsigned long commit_trans_id; | 3941 | unsigned int commit_trans_id; |
3942 | int trans_half; | 3942 | int trans_half; |
3943 | 3943 | ||
3944 | BUG_ON(th->t_refcount > 1); | 3944 | BUG_ON(th->t_refcount > 1); |
@@ -3946,7 +3946,7 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, | |||
3946 | 3946 | ||
3947 | /* protect flush_older_commits from doing mistakes if the | 3947 | /* protect flush_older_commits from doing mistakes if the |
3948 | transaction ID counter gets overflowed. */ | 3948 | transaction ID counter gets overflowed. */ |
3949 | if (th->t_trans_id == ~0UL) | 3949 | if (th->t_trans_id == ~0U) |
3950 | flags |= FLUSH_ALL | COMMIT_NOW | WAIT; | 3950 | flags |= FLUSH_ALL | COMMIT_NOW | WAIT; |
3951 | flush = flags & FLUSH_ALL; | 3951 | flush = flags & FLUSH_ALL; |
3952 | wait_on_commit = flags & WAIT; | 3952 | wait_on_commit = flags & WAIT; |
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c index 37173fa07d15..370988efc8ad 100644 --- a/fs/reiserfs/procfs.c +++ b/fs/reiserfs/procfs.c | |||
@@ -321,7 +321,7 @@ static int show_journal(struct seq_file *m, struct super_block *sb) | |||
321 | /* incore fields */ | 321 | /* incore fields */ |
322 | "j_1st_reserved_block: \t%i\n" | 322 | "j_1st_reserved_block: \t%i\n" |
323 | "j_state: \t%li\n" | 323 | "j_state: \t%li\n" |
324 | "j_trans_id: \t%lu\n" | 324 | "j_trans_id: \t%u\n" |
325 | "j_mount_id: \t%lu\n" | 325 | "j_mount_id: \t%lu\n" |
326 | "j_start: \t%lu\n" | 326 | "j_start: \t%lu\n" |
327 | "j_len: \t%lu\n" | 327 | "j_len: \t%lu\n" |
@@ -329,7 +329,7 @@ static int show_journal(struct seq_file *m, struct super_block *sb) | |||
329 | "j_wcount: \t%i\n" | 329 | "j_wcount: \t%i\n" |
330 | "j_bcount: \t%lu\n" | 330 | "j_bcount: \t%lu\n" |
331 | "j_first_unflushed_offset: \t%lu\n" | 331 | "j_first_unflushed_offset: \t%lu\n" |
332 | "j_last_flush_trans_id: \t%lu\n" | 332 | "j_last_flush_trans_id: \t%u\n" |
333 | "j_trans_start_time: \t%li\n" | 333 | "j_trans_start_time: \t%li\n" |
334 | "j_list_bitmap_index: \t%i\n" | 334 | "j_list_bitmap_index: \t%i\n" |
335 | "j_must_wait: \t%i\n" | 335 | "j_must_wait: \t%i\n" |