]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/reiserfs/journal.c
reiserfs: rework reiserfs_panic
[linux-2.6-omap-h63xx.git] / fs / reiserfs / journal.c
index c21df71943a635c7eedabbf36e0ae3ac6107c770..774f3ba374092f79cbfb8874e756948299307d38 100644 (file)
@@ -300,8 +300,8 @@ int reiserfs_allocate_list_bitmaps(struct super_block *p_s_sb,
                jb->journal_list = NULL;
                jb->bitmaps = vmalloc(mem);
                if (!jb->bitmaps) {
-                       reiserfs_warning(p_s_sb,
-                                        "clm-2000, unable to allocate bitmaps for journal lists");
+                       reiserfs_warning(p_s_sb, "clm-2000", "unable to "
+                                        "allocate bitmaps for journal lists");
                        failed = 1;
                        break;
                }
@@ -436,8 +436,8 @@ void reiserfs_check_lock_depth(struct super_block *sb, char *caller)
 {
 #ifdef CONFIG_SMP
        if (current->lock_depth < 0) {
-               reiserfs_panic(sb, "%s called without kernel lock held",
-                              caller);
+               reiserfs_panic(sb, "journal-1", "%s called without kernel "
+                              "lock held", caller);
        }
 #else
        ;
@@ -574,7 +574,7 @@ static inline void put_journal_list(struct super_block *s,
                                    struct reiserfs_journal_list *jl)
 {
        if (jl->j_refcount < 1) {
-               reiserfs_panic(s, "trans id %lu, refcount at %d",
+               reiserfs_panic(s, "journal-2", "trans id %u, refcount at %d",
                               jl->j_trans_id, jl->j_refcount);
        }
        if (--jl->j_refcount == 0)
@@ -599,7 +599,7 @@ static void cleanup_freed_for_journal_list(struct super_block *p_s_sb,
 }
 
 static int journal_list_still_alive(struct super_block *s,
-                                   unsigned long trans_id)
+                                   unsigned int trans_id)
 {
        struct reiserfs_journal *journal = SB_JOURNAL(s);
        struct list_head *entry = &journal->j_journal_list;
@@ -644,8 +644,8 @@ static void reiserfs_end_buffer_io_sync(struct buffer_head *bh, int uptodate)
        char b[BDEVNAME_SIZE];
 
        if (buffer_journaled(bh)) {
-               reiserfs_warning(NULL,
-                                "clm-2084: pinned buffer %lu:%s sent to disk",
+               reiserfs_warning(NULL, "clm-2084",
+                                "pinned buffer %lu:%s sent to disk",
                                 bh->b_blocknr, bdevname(bh->b_bdev, b));
        }
        if (uptodate)
@@ -933,9 +933,9 @@ static int flush_older_commits(struct super_block *s,
        struct reiserfs_journal_list *other_jl;
        struct reiserfs_journal_list *first_jl;
        struct list_head *entry;
-       unsigned long trans_id = jl->j_trans_id;
-       unsigned long other_trans_id;
-       unsigned long first_trans_id;
+       unsigned int trans_id = jl->j_trans_id;
+       unsigned int other_trans_id;
+       unsigned int first_trans_id;
 
       find_first:
        /*
@@ -1014,7 +1014,7 @@ static int flush_commit_list(struct super_block *s,
        int i;
        b_blocknr_t bn;
        struct buffer_head *tbh = NULL;
-       unsigned long trans_id = jl->j_trans_id;
+       unsigned int trans_id = jl->j_trans_id;
        struct reiserfs_journal *journal = SB_JOURNAL(s);
        int barrier = 0;
        int retval = 0;
@@ -1122,7 +1122,8 @@ static int flush_commit_list(struct super_block *s,
                        sync_dirty_buffer(tbh);
                if (unlikely(!buffer_uptodate(tbh))) {
 #ifdef CONFIG_REISERFS_CHECK
-                       reiserfs_warning(s, "journal-601, buffer write failed");
+                       reiserfs_warning(s, "journal-601",
+                                        "buffer write failed");
 #endif
                        retval = -EIO;
                }
@@ -1154,14 +1155,14 @@ static int flush_commit_list(struct super_block *s,
         * up propagating the write error out to the filesystem. */
        if (unlikely(!buffer_uptodate(jl->j_commit_bh))) {
 #ifdef CONFIG_REISERFS_CHECK
-               reiserfs_warning(s, "journal-615buffer write failed");
+               reiserfs_warning(s, "journal-615", "buffer write failed");
 #endif
                retval = -EIO;
        }
        bforget(jl->j_commit_bh);
        if (journal->j_last_commit_id != 0 &&
            (jl->j_trans_id - journal->j_last_commit_id) != 1) {
-               reiserfs_warning(s, "clm-2200last commit %lu, current %lu",
+               reiserfs_warning(s, "clm-2200", "last commit %lu, current %lu",
                                 journal->j_last_commit_id, jl->j_trans_id);
        }
        journal->j_last_commit_id = jl->j_trans_id;
@@ -1250,7 +1251,7 @@ static void remove_all_from_journal_list(struct super_block *p_s_sb,
        while (cn) {
                if (cn->blocknr != 0) {
                        if (debug) {
-                               reiserfs_warning(p_s_sb,
+                               reiserfs_warning(p_s_sb, "reiserfs-2201",
                                                 "block %u, bh is %d, state %ld",
                                                 cn->blocknr, cn->bh ? 1 : 0,
                                                 cn->state);
@@ -1275,7 +1276,7 @@ static void remove_all_from_journal_list(struct super_block *p_s_sb,
 */
 static int _update_journal_header_block(struct super_block *p_s_sb,
                                        unsigned long offset,
-                                       unsigned long trans_id)
+                                       unsigned int trans_id)
 {
        struct reiserfs_journal_header *jh;
        struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb);
@@ -1288,8 +1289,8 @@ static int _update_journal_header_block(struct super_block *p_s_sb,
                        wait_on_buffer((journal->j_header_bh));
                        if (unlikely(!buffer_uptodate(journal->j_header_bh))) {
 #ifdef CONFIG_REISERFS_CHECK
-                               reiserfs_warning(p_s_sb,
-                                                "journal-699: buffer write failed");
+                               reiserfs_warning(p_s_sb, "journal-699",
+                                                "buffer write failed");
 #endif
                                return -EIO;
                        }
@@ -1319,8 +1320,8 @@ static int _update_journal_header_block(struct super_block *p_s_sb,
                        sync_dirty_buffer(journal->j_header_bh);
                }
                if (!buffer_uptodate(journal->j_header_bh)) {
-                       reiserfs_warning(p_s_sb,
-                                        "journal-837: IO error during journal replay");
+                       reiserfs_warning(p_s_sb, "journal-837",
+                                        "IO error during journal replay");
                        return -EIO;
                }
        }
@@ -1329,7 +1330,7 @@ static int _update_journal_header_block(struct super_block *p_s_sb,
 
 static int update_journal_header_block(struct super_block *p_s_sb,
                                       unsigned long offset,
-                                      unsigned long trans_id)
+                                      unsigned int trans_id)
 {
        return _update_journal_header_block(p_s_sb, offset, trans_id);
 }
@@ -1344,7 +1345,7 @@ static int flush_older_journal_lists(struct super_block *p_s_sb,
        struct list_head *entry;
        struct reiserfs_journal_list *other_jl;
        struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb);
-       unsigned long trans_id = jl->j_trans_id;
+       unsigned int trans_id = jl->j_trans_id;
 
        /* we know we are the only ones flushing things, no extra race
         * protection is required.
@@ -1401,8 +1402,7 @@ static int flush_journal_list(struct super_block *s,
        BUG_ON(j_len_saved <= 0);
 
        if (atomic_read(&journal->j_wcount) != 0) {
-               reiserfs_warning(s,
-                                "clm-2048: flush_journal_list called with wcount %d",
+               reiserfs_warning(s, "clm-2048", "called with wcount %d",
                                 atomic_read(&journal->j_wcount));
        }
        BUG_ON(jl->j_trans_id == 0);
@@ -1416,8 +1416,7 @@ static int flush_journal_list(struct super_block *s,
 
        count = 0;
        if (j_len_saved > journal->j_trans_max) {
-               reiserfs_panic(s,
-                              "journal-715: flush_journal_list, length is %lu, trans id %lu\n",
+               reiserfs_panic(s, "journal-715", "length is %lu, trans id %lu",
                               j_len_saved, jl->j_trans_id);
                return 0;
        }
@@ -1449,8 +1448,8 @@ static int flush_journal_list(struct super_block *s,
         ** or wait on a more recent transaction, or just ignore it 
         */
        if (atomic_read(&(journal->j_wcount)) != 0) {
-               reiserfs_panic(s,
-                              "journal-844: panic journal list is flushing, wcount is not 0\n");
+               reiserfs_panic(s, "journal-844", "journal list is flushing, "
+                              "wcount is not 0");
        }
        cn = jl->j_realblock;
        while (cn) {
@@ -1510,8 +1509,8 @@ static int flush_journal_list(struct super_block *s,
                 ** is not marked JDirty_wait
                 */
                if ((!was_jwait) && !buffer_locked(saved_bh)) {
-                       reiserfs_warning(s,
-                                        "journal-813: BAD! buffer %llu %cdirty %cjwait, "
+                       reiserfs_warning(s, "journal-813",
+                                        "BAD! buffer %llu %cdirty %cjwait, "
                                         "not in a newer tranasction",
                                         (unsigned long long)saved_bh->
                                         b_blocknr, was_dirty ? ' ' : '!',
@@ -1529,8 +1528,8 @@ static int flush_journal_list(struct super_block *s,
                                unlock_buffer(saved_bh);
                        count++;
                } else {
-                       reiserfs_warning(s,
-                                        "clm-2082: Unable to flush buffer %llu in %s",
+                       reiserfs_warning(s, "clm-2082",
+                                        "Unable to flush buffer %llu in %s",
                                         (unsigned long long)saved_bh->
                                         b_blocknr, __func__);
                }
@@ -1541,8 +1540,8 @@ static int flush_journal_list(struct super_block *s,
                        /* we incremented this to keep others from taking the buffer head away */
                        put_bh(saved_bh);
                        if (atomic_read(&(saved_bh->b_count)) < 0) {
-                               reiserfs_warning(s,
-                                                "journal-945: saved_bh->b_count < 0");
+                               reiserfs_warning(s, "journal-945",
+                                                "saved_bh->b_count < 0");
                        }
                }
        }
@@ -1551,18 +1550,18 @@ static int flush_journal_list(struct super_block *s,
                while (cn) {
                        if (test_bit(BLOCK_NEEDS_FLUSH, &cn->state)) {
                                if (!cn->bh) {
-                                       reiserfs_panic(s,
-                                                      "journal-1011: cn->bh is NULL\n");
+                                       reiserfs_panic(s, "journal-1011",
+                                                      "cn->bh is NULL");
                                }
                                wait_on_buffer(cn->bh);
                                if (!cn->bh) {
-                                       reiserfs_panic(s,
-                                                      "journal-1012: cn->bh is NULL\n");
+                                       reiserfs_panic(s, "journal-1012",
+                                                      "cn->bh is NULL");
                                }
                                if (unlikely(!buffer_uptodate(cn->bh))) {
 #ifdef CONFIG_REISERFS_CHECK
-                                       reiserfs_warning(s,
-                                                        "journal-949: buffer write failed\n");
+                                       reiserfs_warning(s, "journal-949",
+                                                        "buffer write failed");
 #endif
                                        err = -EIO;
                                }
@@ -1623,7 +1622,7 @@ static int flush_journal_list(struct super_block *s,
 
        if (journal->j_last_flush_id != 0 &&
            (jl->j_trans_id - journal->j_last_flush_id) != 1) {
-               reiserfs_warning(s, "clm-2201last flush %lu, current %lu",
+               reiserfs_warning(s, "clm-2201", "last flush %lu, current %lu",
                                 journal->j_last_flush_id, jl->j_trans_id);
        }
        journal->j_last_flush_id = jl->j_trans_id;
@@ -1758,13 +1757,13 @@ static int dirty_one_transaction(struct super_block *s,
 static int kupdate_transactions(struct super_block *s,
                                struct reiserfs_journal_list *jl,
                                struct reiserfs_journal_list **next_jl,
-                               unsigned long *next_trans_id,
+                               unsigned int *next_trans_id,
                                int num_blocks, int num_trans)
 {
        int ret = 0;
        int written = 0;
        int transactions_flushed = 0;
-       unsigned long orig_trans_id = jl->j_trans_id;
+       unsigned int orig_trans_id = jl->j_trans_id;
        struct buffer_chunk chunk;
        struct list_head *entry;
        struct reiserfs_journal *journal = SB_JOURNAL(s);
@@ -1833,7 +1832,7 @@ static int flush_used_journal_lists(struct super_block *s,
        int limit = 256;
        struct reiserfs_journal_list *tjl;
        struct reiserfs_journal_list *flush_jl;
-       unsigned long trans_id;
+       unsigned int trans_id;
        struct reiserfs_journal *journal = SB_JOURNAL(s);
 
        flush_jl = tjl = jl;
@@ -2023,7 +2022,7 @@ static int journal_compare_desc_commit(struct super_block *p_s_sb,
 */
 static int journal_transaction_is_valid(struct super_block *p_s_sb,
                                        struct buffer_head *d_bh,
-                                       unsigned long *oldest_invalid_trans_id,
+                                       unsigned int *oldest_invalid_trans_id,
                                        unsigned long *newest_mount_id)
 {
        struct reiserfs_journal_desc *desc;
@@ -2058,8 +2057,9 @@ static int journal_transaction_is_valid(struct super_block *p_s_sb,
                        return -1;
                }
                if (get_desc_trans_len(desc) > SB_JOURNAL(p_s_sb)->j_trans_max) {
-                       reiserfs_warning(p_s_sb,
-                                        "journal-2018: Bad transaction length %d encountered, ignoring transaction",
+                       reiserfs_warning(p_s_sb, "journal-2018",
+                                        "Bad transaction length %d "
+                                        "encountered, ignoring transaction",
                                         get_desc_trans_len(desc));
                        return -1;
                }
@@ -2124,18 +2124,18 @@ static void brelse_array(struct buffer_head **heads, int num)
 static int journal_read_transaction(struct super_block *p_s_sb,
                                    unsigned long cur_dblock,
                                    unsigned long oldest_start,
-                                   unsigned long oldest_trans_id,
+                                   unsigned int oldest_trans_id,
                                    unsigned long newest_mount_id)
 {
        struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb);
        struct reiserfs_journal_desc *desc;
        struct reiserfs_journal_commit *commit;
-       unsigned long trans_id = 0;
+       unsigned int trans_id = 0;
        struct buffer_head *c_bh;
        struct buffer_head *d_bh;
        struct buffer_head **log_blocks = NULL;
        struct buffer_head **real_blocks = NULL;
-       unsigned long trans_offset;
+       unsigned int trans_offset;
        int i;
        int trans_half;
 
@@ -2195,8 +2195,8 @@ static int journal_read_transaction(struct super_block *p_s_sb,
                brelse(d_bh);
                kfree(log_blocks);
                kfree(real_blocks);
-               reiserfs_warning(p_s_sb,
-                                "journal-1169: kmalloc failed, unable to mount FS");
+               reiserfs_warning(p_s_sb, "journal-1169",
+                                "kmalloc failed, unable to mount FS");
                return -1;
        }
        /* get all the buffer heads */
@@ -2218,15 +2218,18 @@ static int journal_read_transaction(struct super_block *p_s_sb,
                                                  j_realblock[i - trans_half]));
                }
                if (real_blocks[i]->b_blocknr > SB_BLOCK_COUNT(p_s_sb)) {
-                       reiserfs_warning(p_s_sb,
-                                        "journal-1207: REPLAY FAILURE fsck required! Block to replay is outside of filesystem");
+                       reiserfs_warning(p_s_sb, "journal-1207",
+                                        "REPLAY FAILURE fsck required! "
+                                        "Block to replay is outside of "
+                                        "filesystem");
                        goto abort_replay;
                }
                /* make sure we don't try to replay onto log or reserved area */
                if (is_block_in_log_or_reserved_area
                    (p_s_sb, real_blocks[i]->b_blocknr)) {
-                       reiserfs_warning(p_s_sb,
-                                        "journal-1204: REPLAY FAILURE fsck required! Trying to replay onto a log block");
+                       reiserfs_warning(p_s_sb, "journal-1204",
+                                        "REPLAY FAILURE fsck required! "
+                                        "Trying to replay onto a log block");
                      abort_replay:
                        brelse_array(log_blocks, i);
                        brelse_array(real_blocks, i);
@@ -2242,8 +2245,9 @@ static int journal_read_transaction(struct super_block *p_s_sb,
        for (i = 0; i < get_desc_trans_len(desc); i++) {
                wait_on_buffer(log_blocks[i]);
                if (!buffer_uptodate(log_blocks[i])) {
-                       reiserfs_warning(p_s_sb,
-                                        "journal-1212: REPLAY FAILURE fsck required! buffer write failed");
+                       reiserfs_warning(p_s_sb, "journal-1212",
+                                        "REPLAY FAILURE fsck required! "
+                                        "buffer write failed");
                        brelse_array(log_blocks + i,
                                     get_desc_trans_len(desc) - i);
                        brelse_array(real_blocks, get_desc_trans_len(desc));
@@ -2266,8 +2270,9 @@ static int journal_read_transaction(struct super_block *p_s_sb,
        for (i = 0; i < get_desc_trans_len(desc); i++) {
                wait_on_buffer(real_blocks[i]);
                if (!buffer_uptodate(real_blocks[i])) {
-                       reiserfs_warning(p_s_sb,
-                                        "journal-1226: REPLAY FAILURE, fsck required! buffer write failed");
+                       reiserfs_warning(p_s_sb, "journal-1226",
+                                        "REPLAY FAILURE, fsck required! "
+                                        "buffer write failed");
                        brelse_array(real_blocks + i,
                                     get_desc_trans_len(desc) - i);
                        brelse(c_bh);
@@ -2356,8 +2361,8 @@ static int journal_read(struct super_block *p_s_sb)
 {
        struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb);
        struct reiserfs_journal_desc *desc;
-       unsigned long oldest_trans_id = 0;
-       unsigned long oldest_invalid_trans_id = 0;
+       unsigned int oldest_trans_id = 0;
+       unsigned int oldest_invalid_trans_id = 0;
        time_t start;
        unsigned long oldest_start = 0;
        unsigned long cur_dblock = 0;
@@ -2418,8 +2423,8 @@ static int journal_read(struct super_block *p_s_sb)
        }
 
        if (continue_replay && bdev_read_only(p_s_sb->s_bdev)) {
-               reiserfs_warning(p_s_sb,
-                                "clm-2076: device is readonly, unable to replay log");
+               reiserfs_warning(p_s_sb, "clm-2076",
+                                "device is readonly, unable to replay log");
                return -1;
        }
 
@@ -2575,14 +2580,13 @@ static int release_journal_dev(struct super_block *super,
        if (journal->j_dev_bd != NULL) {
                if (journal->j_dev_bd->bd_dev != super->s_dev)
                        bd_release(journal->j_dev_bd);
-               result = blkdev_put(journal->j_dev_bd);
+               result = blkdev_put(journal->j_dev_bd, journal->j_dev_mode);
                journal->j_dev_bd = NULL;
        }
 
        if (result != 0) {
-               reiserfs_warning(super,
-                                "sh-457: release_journal_dev: Cannot release journal device: %i",
-                                result);
+               reiserfs_warning(super, "sh-457",
+                                "Cannot release journal device: %i", result);
        }
        return result;
 }
@@ -2593,7 +2597,7 @@ static int journal_init_dev(struct super_block *super,
 {
        int result;
        dev_t jdev;
-       int blkdev_mode = FMODE_READ | FMODE_WRITE;
+       fmode_t blkdev_mode = FMODE_READ | FMODE_WRITE;
        char b[BDEVNAME_SIZE];
 
        result = 0;
@@ -2608,17 +2612,18 @@ static int journal_init_dev(struct super_block *super,
        /* there is no "jdev" option and journal is on separate device */
        if ((!jdev_name || !jdev_name[0])) {
                journal->j_dev_bd = open_by_devnum(jdev, blkdev_mode);
+               journal->j_dev_mode = blkdev_mode;
                if (IS_ERR(journal->j_dev_bd)) {
                        result = PTR_ERR(journal->j_dev_bd);
                        journal->j_dev_bd = NULL;
-                       reiserfs_warning(super, "sh-458: journal_init_dev: "
+                       reiserfs_warning(super, "sh-458",
                                         "cannot init journal device '%s': %i",
                                         __bdevname(jdev, b), result);
                        return result;
                } else if (jdev != super->s_dev) {
                        result = bd_claim(journal->j_dev_bd, journal);
                        if (result) {
-                               blkdev_put(journal->j_dev_bd);
+                               blkdev_put(journal->j_dev_bd, blkdev_mode);
                                return result;
                        }
 
@@ -2628,7 +2633,9 @@ static int journal_init_dev(struct super_block *super,
                return 0;
        }
 
-       journal->j_dev_bd = open_bdev_excl(jdev_name, 0, journal);
+       journal->j_dev_mode = blkdev_mode;
+       journal->j_dev_bd = open_bdev_exclusive(jdev_name,
+                                               blkdev_mode, journal);
        if (IS_ERR(journal->j_dev_bd)) {
                result = PTR_ERR(journal->j_dev_bd);
                journal->j_dev_bd = NULL;
@@ -2673,16 +2680,16 @@ static int check_advise_trans_params(struct super_block *p_s_sb,
                    journal->j_trans_max < JOURNAL_TRANS_MIN_DEFAULT / ratio ||
                    SB_ONDISK_JOURNAL_SIZE(p_s_sb) / journal->j_trans_max <
                    JOURNAL_MIN_RATIO) {
-                       reiserfs_warning(p_s_sb,
-                                "sh-462: bad transaction max size (%u). FSCK?",
-                                journal->j_trans_max);
+                       reiserfs_warning(p_s_sb, "sh-462",
+                                        "bad transaction max size (%u). "
+                                        "FSCK?", journal->j_trans_max);
                        return 1;
                }
                if (journal->j_max_batch != (journal->j_trans_max) *
                        JOURNAL_MAX_BATCH_DEFAULT/JOURNAL_TRANS_MAX_DEFAULT) {
-                       reiserfs_warning(p_s_sb,
-                               "sh-463: bad transaction max batch (%u). FSCK?",
-                               journal->j_max_batch);
+                       reiserfs_warning(p_s_sb, "sh-463",
+                                        "bad transaction max batch (%u). "
+                                        "FSCK?", journal->j_max_batch);
                        return 1;
                }
        } else {
@@ -2690,9 +2697,11 @@ static int check_advise_trans_params(struct super_block *p_s_sb,
                    The file system was created by old version
                   of mkreiserfs, so some fields contain zeros,
                   and we need to advise proper values for them */
-               if (p_s_sb->s_blocksize != REISERFS_STANDARD_BLKSIZE)
-                       reiserfs_panic(p_s_sb, "sh-464: bad blocksize (%u)",
-                                      p_s_sb->s_blocksize);
+               if (p_s_sb->s_blocksize != REISERFS_STANDARD_BLKSIZE) {
+                       reiserfs_warning(p_s_sb, "sh-464", "bad blocksize (%u)",
+                                        p_s_sb->s_blocksize);
+                       return 1;
+               }
                journal->j_trans_max = JOURNAL_TRANS_MAX_DEFAULT;
                journal->j_max_batch = JOURNAL_MAX_BATCH_DEFAULT;
                journal->j_max_commit_age = JOURNAL_MAX_COMMIT_AGE;
@@ -2716,8 +2725,8 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name,
 
        journal = SB_JOURNAL(p_s_sb) = vmalloc(sizeof(struct reiserfs_journal));
        if (!journal) {
-               reiserfs_warning(p_s_sb,
-                                "journal-1256: unable to get memory for journal structure");
+               reiserfs_warning(p_s_sb, "journal-1256",
+                                "unable to get memory for journal structure");
                return 1;
        }
        memset(journal, 0, sizeof(struct reiserfs_journal));
@@ -2746,9 +2755,9 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name,
        if (!SB_ONDISK_JOURNAL_DEVICE(p_s_sb) &&
            (SB_JOURNAL_1st_RESERVED_BLOCK(p_s_sb) +
             SB_ONDISK_JOURNAL_SIZE(p_s_sb) > p_s_sb->s_blocksize * 8)) {
-               reiserfs_warning(p_s_sb,
-                                "journal-1393: journal does not fit for area "
-                                "addressed by first of bitmap blocks. It starts at "
+               reiserfs_warning(p_s_sb, "journal-1393",
+                                "journal does not fit for area addressed "
+                                "by first of bitmap blocks. It starts at "
                                 "%u and its size is %u. Block size %ld",
                                 SB_JOURNAL_1st_RESERVED_BLOCK(p_s_sb),
                                 SB_ONDISK_JOURNAL_SIZE(p_s_sb),
@@ -2757,8 +2766,8 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name,
        }
 
        if (journal_init_dev(p_s_sb, journal, j_dev_name) != 0) {
-               reiserfs_warning(p_s_sb,
-                                "sh-462: unable to initialize jornal device");
+               reiserfs_warning(p_s_sb, "sh-462",
+                                "unable to initialize jornal device");
                goto free_and_return;
        }
 
@@ -2769,8 +2778,8 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name,
                             SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb) +
                             SB_ONDISK_JOURNAL_SIZE(p_s_sb));
        if (!bhjh) {
-               reiserfs_warning(p_s_sb,
-                                "sh-459: unable to read journal header");
+               reiserfs_warning(p_s_sb, "sh-459",
+                                "unable to read journal header");
                goto free_and_return;
        }
        jh = (struct reiserfs_journal_header *)(bhjh->b_data);
@@ -2779,10 +2788,10 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name,
        if (is_reiserfs_jr(rs)
            && (le32_to_cpu(jh->jh_journal.jp_journal_magic) !=
                sb_jp_journal_magic(rs))) {
-               reiserfs_warning(p_s_sb,
-                                "sh-460: journal header magic %x "
-                                "(device %s) does not match to magic found in super "
-                                "block %x", jh->jh_journal.jp_journal_magic,
+               reiserfs_warning(p_s_sb, "sh-460",
+                                "journal header magic %x (device %s) does "
+                                "not match to magic found in super block %x",
+                                jh->jh_journal.jp_journal_magic,
                                 bdevname(journal->j_dev_bd, b),
                                 sb_jp_journal_magic(rs));
                brelse(bhjh);
@@ -2849,7 +2858,7 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name,
        journal->j_must_wait = 0;
 
        if (journal->j_cnode_free == 0) {
-               reiserfs_warning(p_s_sb, "journal-2004Journal cnode memory "
+               reiserfs_warning(p_s_sb, "journal-2004", "Journal cnode memory "
                                 "allocation failed (%ld bytes). Journal is "
                                 "too large for available memory. Usually "
                                 "this is due to a journal that is too large.",
@@ -2861,12 +2870,13 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name,
        jl = journal->j_current_jl;
        jl->j_list_bitmap = get_list_bitmap(p_s_sb, jl);
        if (!jl->j_list_bitmap) {
-               reiserfs_warning(p_s_sb,
-                                "journal-2005, get_list_bitmap failed for journal list 0");
+               reiserfs_warning(p_s_sb, "journal-2005",
+                                "get_list_bitmap failed for journal list 0");
                goto free_and_return;
        }
        if (journal_read(p_s_sb) < 0) {
-               reiserfs_warning(p_s_sb, "Replay Failure, unable to mount");
+               reiserfs_warning(p_s_sb, "reiserfs-2006",
+                                "Replay Failure, unable to mount");
                goto free_and_return;
        }
 
@@ -2967,7 +2977,7 @@ static void wake_queued_writers(struct super_block *s)
                wake_up(&journal->j_join_wait);
 }
 
-static void let_transaction_grow(struct super_block *sb, unsigned long trans_id)
+static void let_transaction_grow(struct super_block *sb, unsigned int trans_id)
 {
        struct reiserfs_journal *journal = SB_JOURNAL(sb);
        unsigned long bcount = journal->j_bcount;
@@ -2998,7 +3008,7 @@ static int do_journal_begin_r(struct reiserfs_transaction_handle *th,
                              int join)
 {
        time_t now = get_seconds();
-       int old_trans_id;
+       unsigned int old_trans_id;
        struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb);
        struct reiserfs_transaction_handle myth;
        int sched_count = 0;
@@ -3193,16 +3203,17 @@ int journal_begin(struct reiserfs_transaction_handle *th,
                        cur_th->t_refcount++;
                        memcpy(th, cur_th, sizeof(*th));
                        if (th->t_refcount <= 1)
-                               reiserfs_warning(p_s_sb,
-                                                "BAD: refcount <= 1, but journal_info != 0");
+                               reiserfs_warning(p_s_sb, "reiserfs-2005",
+                                                "BAD: refcount <= 1, but "
+                                                "journal_info != 0");
                        return 0;
                } else {
                        /* we've ended up with a handle from a different filesystem.
                         ** save it and restore on journal_end.  This should never
                         ** really happen...
                         */
-                       reiserfs_warning(p_s_sb,
-                                        "clm-2100: nesting info a different FS");
+                       reiserfs_warning(p_s_sb, "clm-2100",
+                                        "nesting info a different FS");
                        th->t_handle_save = current->journal_info;
                        current->journal_info = th;
                }
@@ -3243,8 +3254,8 @@ int journal_mark_dirty(struct reiserfs_transaction_handle *th,
 
        PROC_INFO_INC(p_s_sb, journal.mark_dirty);
        if (th->t_trans_id != journal->j_trans_id) {
-               reiserfs_panic(th->t_super,
-                              "journal-1577: handle trans id %ld != current trans id %ld\n",
+               reiserfs_panic(th->t_super, "journal-1577",
+                              "handle trans id %ld != current trans id %ld",
                               th->t_trans_id, journal->j_trans_id);
        }
 
@@ -3263,7 +3274,8 @@ int journal_mark_dirty(struct reiserfs_transaction_handle *th,
         ** could get to disk too early.  NOT GOOD.
         */
        if (!prepared || buffer_dirty(bh)) {
-               reiserfs_warning(p_s_sb, "journal-1777: buffer %llu bad state "
+               reiserfs_warning(p_s_sb, "journal-1777",
+                                "buffer %llu bad state "
                                 "%cPREPARED %cLOCKED %cDIRTY %cJDIRTY_WAIT",
                                 (unsigned long long)bh->b_blocknr,
                                 prepared ? ' ' : '!',
@@ -3273,8 +3285,8 @@ int journal_mark_dirty(struct reiserfs_transaction_handle *th,
        }
 
        if (atomic_read(&(journal->j_wcount)) <= 0) {
-               reiserfs_warning(p_s_sb,
-                                "journal-1409: journal_mark_dirty returning because j_wcount was %d",
+               reiserfs_warning(p_s_sb, "journal-1409",
+                                "returning because j_wcount was %d",
                                 atomic_read(&(journal->j_wcount)));
                return 1;
        }
@@ -3282,8 +3294,8 @@ int journal_mark_dirty(struct reiserfs_transaction_handle *th,
         ** Nothing can be done here, except make the FS readonly or panic.
         */
        if (journal->j_len >= journal->j_trans_max) {
-               reiserfs_panic(th->t_super,
-                              "journal-1413: journal_mark_dirty: j_len (%lu) is too big\n",
+               reiserfs_panic(th->t_super, "journal-1413",
+                              "j_len (%lu) is too big",
                               journal->j_len);
        }
 
@@ -3303,7 +3315,8 @@ int journal_mark_dirty(struct reiserfs_transaction_handle *th,
        if (!cn) {
                cn = get_cnode(p_s_sb);
                if (!cn) {
-                       reiserfs_panic(p_s_sb, "get_cnode failed!\n");
+                       reiserfs_panic(p_s_sb, "journal-4",
+                                      "get_cnode failed!");
                }
 
                if (th->t_blocks_logged == th->t_blocks_allocated) {
@@ -3339,8 +3352,8 @@ int journal_end(struct reiserfs_transaction_handle *th,
                struct super_block *p_s_sb, unsigned long nblocks)
 {
        if (!current->journal_info && th->t_refcount > 1)
-               reiserfs_warning(p_s_sb, "REISER-NESTING: th NULL, refcount %d",
-                                th->t_refcount);
+               reiserfs_warning(p_s_sb, "REISER-NESTING",
+                                "th NULL, refcount %d", th->t_refcount);
 
        if (!th->t_trans_id) {
                WARN_ON(1);
@@ -3410,8 +3423,8 @@ static int remove_from_transaction(struct super_block *p_s_sb,
                clear_buffer_journal_test(bh);
                put_bh(bh);
                if (atomic_read(&(bh->b_count)) < 0) {
-                       reiserfs_warning(p_s_sb,
-                                        "journal-1752: remove from trans, b_count < 0");
+                       reiserfs_warning(p_s_sb, "journal-1752",
+                                        "b_count < 0");
                }
                ret = 1;
        }
@@ -3571,8 +3584,8 @@ static int check_journal_end(struct reiserfs_transaction_handle *th,
        BUG_ON(!th->t_trans_id);
 
        if (th->t_trans_id != journal->j_trans_id) {
-               reiserfs_panic(th->t_super,
-                              "journal-1577: handle trans id %ld != current trans id %ld\n",
+               reiserfs_panic(th->t_super, "journal-1577",
+                              "handle trans id %ld != current trans id %ld",
                               th->t_trans_id, journal->j_trans_id);
        }
 
@@ -3651,8 +3664,8 @@ static int check_journal_end(struct reiserfs_transaction_handle *th,
        }
 
        if (journal->j_start > SB_ONDISK_JOURNAL_SIZE(p_s_sb)) {
-               reiserfs_panic(p_s_sb,
-                              "journal-003: journal_end: j_start (%ld) is too high\n",
+               reiserfs_panic(p_s_sb, "journal-003",
+                              "j_start (%ld) is too high",
                               journal->j_start);
        }
        return 1;
@@ -3697,8 +3710,8 @@ int journal_mark_freed(struct reiserfs_transaction_handle *th,
                /* set the bit for this block in the journal bitmap for this transaction */
                jb = journal->j_current_jl->j_list_bitmap;
                if (!jb) {
-                       reiserfs_panic(p_s_sb,
-                                      "journal-1702: journal_mark_freed, journal_list_bitmap is NULL\n");
+                       reiserfs_panic(p_s_sb, "journal-1702",
+                                      "journal_list_bitmap is NULL");
                }
                set_bit_in_list_bitmap(p_s_sb, blocknr, jb);
 
@@ -3731,7 +3744,8 @@ int journal_mark_freed(struct reiserfs_transaction_handle *th,
                                                if (atomic_read
                                                    (&(cn->bh->b_count)) < 0) {
                                                        reiserfs_warning(p_s_sb,
-                                                                        "journal-2138: cn->bh->b_count < 0");
+                                                                "journal-2138",
+                                                                "cn->bh->b_count < 0");
                                                }
                                        }
                                        if (cn->jlist) {        /* since we are clearing the bh, we MUST dec nonzerolen */
@@ -3821,7 +3835,7 @@ static int __commit_trans_jl(struct inode *inode, unsigned long id,
 
 int reiserfs_commit_for_inode(struct inode *inode)
 {
-       unsigned long id = REISERFS_I(inode)->i_trans_id;
+       unsigned int id = REISERFS_I(inode)->i_trans_id;
        struct reiserfs_journal_list *jl = REISERFS_I(inode)->i_jl;
 
        /* for the whole inode, assume unset id means it was
@@ -3935,7 +3949,7 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
        struct reiserfs_journal_list *jl, *temp_jl;
        struct list_head *entry, *safe;
        unsigned long jindex;
-       unsigned long commit_trans_id;
+       unsigned int commit_trans_id;
        int trans_half;
 
        BUG_ON(th->t_refcount > 1);
@@ -3943,7 +3957,7 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
 
        /* protect flush_older_commits from doing mistakes if the
            transaction ID counter gets overflowed.  */
-       if (th->t_trans_id == ~0UL)
+       if (th->t_trans_id == ~0U)
                flags |= FLUSH_ALL | COMMIT_NOW | WAIT;
        flush = flags & FLUSH_ALL;
        wait_on_commit = flags & WAIT;
@@ -4052,8 +4066,8 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
                if (buffer_journaled(cn->bh)) {
                        jl_cn = get_cnode(p_s_sb);
                        if (!jl_cn) {
-                               reiserfs_panic(p_s_sb,
-                                              "journal-1676, get_cnode returned NULL\n");
+                               reiserfs_panic(p_s_sb, "journal-1676",
+                                              "get_cnode returned NULL");
                        }
                        if (i == 0) {
                                jl->j_realblock = jl_cn;
@@ -4069,8 +4083,9 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
 
                        if (is_block_in_log_or_reserved_area
                            (p_s_sb, cn->bh->b_blocknr)) {
-                               reiserfs_panic(p_s_sb,
-                                              "journal-2332: Trying to log block %lu, which is a log block\n",
+                               reiserfs_panic(p_s_sb, "journal-2332",
+                                              "Trying to log block %lu, "
+                                              "which is a log block",
                                               cn->bh->b_blocknr);
                        }
                        jl_cn->blocknr = cn->bh->b_blocknr;
@@ -4134,8 +4149,9 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
                        clear_buffer_journaled(cn->bh);
                } else {
                        /* JDirty cleared sometime during transaction.  don't log this one */
-                       reiserfs_warning(p_s_sb,
-                                        "journal-2048: do_journal_end: BAD, buffer in journal hash, but not JDirty!");
+                       reiserfs_warning(p_s_sb, "journal-2048",
+                                        "BAD, buffer in journal hash, "
+                                        "but not JDirty!");
                        brelse(cn->bh);
                }
                next = cn->next;
@@ -4253,8 +4269,8 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
            get_list_bitmap(p_s_sb, journal->j_current_jl);
 
        if (!(journal->j_current_jl->j_list_bitmap)) {
-               reiserfs_panic(p_s_sb,
-                              "journal-1996: do_journal_end, could not get a list bitmap\n");
+               reiserfs_panic(p_s_sb, "journal-1996",
+                              "could not get a list bitmap");
        }
 
        atomic_set(&(journal->j_jlock), 0);