ext4: Pass line number to ext4_journal_abort_handle()
authorTheodore Ts'o <tytso@mit.edu>
Tue, 29 Jun 2010 18:53:24 +0000 (14:53 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 29 Jun 2010 18:53:24 +0000 (14:53 -0400)
This allows the error messages to include the line number

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/ext4_jbd2.c
fs/ext4/ext4_jbd2.h
fs/ext4/super.c

index df26a015d043519267ada1a07e4c476829493422..9de37b9e177a26417c9068337ac0a38404c6cd41 100644 (file)
@@ -6,29 +6,29 @@
 
 #include <trace/events/ext4.h>
 
-int __ext4_journal_get_undo_access(const char *where, handle_t *handle,
-                               struct buffer_head *bh)
+int __ext4_journal_get_undo_access(const char *where, unsigned int line,
+                                  handle_t *handle, struct buffer_head *bh)
 {
        int err = 0;
 
        if (ext4_handle_valid(handle)) {
                err = jbd2_journal_get_undo_access(handle, bh);
                if (err)
-                       ext4_journal_abort_handle(where, __func__, bh,
+                       ext4_journal_abort_handle(where, line, __func__, bh,
                                                  handle, err);
        }
        return err;
 }
 
-int __ext4_journal_get_write_access(const char *where, handle_t *handle,
-                               struct buffer_head *bh)
+int __ext4_journal_get_write_access(const char *where, unsigned int line,
+                                   handle_t *handle, struct buffer_head *bh)
 {
        int err = 0;
 
        if (ext4_handle_valid(handle)) {
                err = jbd2_journal_get_write_access(handle, bh);
                if (err)
-                       ext4_journal_abort_handle(where, __func__, bh,
+                       ext4_journal_abort_handle(where, line, __func__, bh,
                                                  handle, err);
        }
        return err;
@@ -46,9 +46,9 @@ int __ext4_journal_get_write_access(const char *where, handle_t *handle,
  * If the handle isn't valid we're not journaling, but we still need to
  * call into ext4_journal_revoke() to put the buffer head.
  */
-int __ext4_forget(const char *where, handle_t *handle, int is_metadata,
-                 struct inode *inode, struct buffer_head *bh,
-                 ext4_fsblk_t blocknr)
+int __ext4_forget(const char *where, unsigned int line, handle_t *handle,
+                 int is_metadata, struct inode *inode,
+                 struct buffer_head *bh, ext4_fsblk_t blocknr)
 {
        int err;
 
@@ -79,8 +79,8 @@ int __ext4_forget(const char *where, handle_t *handle, int is_metadata,
                        BUFFER_TRACE(bh, "call jbd2_journal_forget");
                        err = jbd2_journal_forget(handle, bh);
                        if (err)
-                               ext4_journal_abort_handle(where, __func__, bh,
-                                                         handle, err);
+                               ext4_journal_abort_handle(where, line, __func__,
+                                                         bh, handle, err);
                        return err;
                }
                return 0;
@@ -92,7 +92,8 @@ int __ext4_forget(const char *where, handle_t *handle, int is_metadata,
        BUFFER_TRACE(bh, "call jbd2_journal_revoke");
        err = jbd2_journal_revoke(handle, blocknr, bh);
        if (err) {
-               ext4_journal_abort_handle(where, __func__, bh, handle, err);
+               ext4_journal_abort_handle(where, line, __func__,
+                                         bh, handle, err);
                __ext4_abort(inode->i_sb, where,
                             "error %d when attempting revoke", err);
        }
@@ -100,7 +101,7 @@ int __ext4_forget(const char *where, handle_t *handle, int is_metadata,
        return err;
 }
 
-int __ext4_journal_get_create_access(const char *where,
+int __ext4_journal_get_create_access(const char *where, unsigned int line,
                                handle_t *handle, struct buffer_head *bh)
 {
        int err = 0;
@@ -108,22 +109,23 @@ int __ext4_journal_get_create_access(const char *where,
        if (ext4_handle_valid(handle)) {
                err = jbd2_journal_get_create_access(handle, bh);
                if (err)
-                       ext4_journal_abort_handle(where, __func__, bh,
-                                                 handle, err);
+                       ext4_journal_abort_handle(where, line, __func__,
+                                                 bh, handle, err);
        }
        return err;
 }
 
-int __ext4_handle_dirty_metadata(const char *where, handle_t *handle,
-                                struct inode *inode, struct buffer_head *bh)
+int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
+                                handle_t *handle, struct inode *inode,
+                                struct buffer_head *bh)
 {
        int err = 0;
 
        if (ext4_handle_valid(handle)) {
                err = jbd2_journal_dirty_metadata(handle, bh);
                if (err)
-                       ext4_journal_abort_handle(where, __func__, bh,
-                                                 handle, err);
+                       ext4_journal_abort_handle(where, line, __func__,
+                                                 bh, handle, err);
        } else {
                if (inode)
                        mark_buffer_dirty_inode(bh, inode);
@@ -144,8 +146,8 @@ int __ext4_handle_dirty_metadata(const char *where, handle_t *handle,
        return err;
 }
 
-int __ext4_handle_dirty_super(const char *where, handle_t *handle,
-                             struct super_block *sb)
+int __ext4_handle_dirty_super(const char *where, unsigned int line,
+                             handle_t *handle, struct super_block *sb)
 {
        struct buffer_head *bh = EXT4_SB(sb)->s_sbh;
        int err = 0;
@@ -153,8 +155,8 @@ int __ext4_handle_dirty_super(const char *where, handle_t *handle,
        if (ext4_handle_valid(handle)) {
                err = jbd2_journal_dirty_metadata(handle, bh);
                if (err)
-                       ext4_journal_abort_handle(where, __func__, bh,
-                                                 handle, err);
+                       ext4_journal_abort_handle(where, line, __func__,
+                                                 bh, handle, err);
        } else
                sb->s_dirt = 1;
        return err;
index 38d1e66e58430432e171bd1b6f12314a41b695bb..6883c6be5b8d75bd069953719a5dc7a999273677 100644 (file)
@@ -122,41 +122,44 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode);
 /*
  * Wrapper functions with which ext4 calls into JBD.
  */
-void ext4_journal_abort_handle(const char *caller, const char *err_fn,
+void ext4_journal_abort_handle(const char *caller, unsigned int line,
+                              const char *err_fn,
                struct buffer_head *bh, handle_t *handle, int err);
 
-int __ext4_journal_get_undo_access(const char *where, handle_t *handle,
-                               struct buffer_head *bh);
+int __ext4_journal_get_undo_access(const char *where, unsigned int line,
+                                  handle_t *handle, struct buffer_head *bh);
 
-int __ext4_journal_get_write_access(const char *where, handle_t *handle,
-                               struct buffer_head *bh);
+int __ext4_journal_get_write_access(const char *where, unsigned int line,
+                                   handle_t *handle, struct buffer_head *bh);
 
-int __ext4_forget(const char *where, handle_t *handle, int is_metadata,
-                 struct inode *inode, struct buffer_head *bh,
-                 ext4_fsblk_t blocknr);
+int __ext4_forget(const char *where, unsigned int line, handle_t *handle,
+                 int is_metadata, struct inode *inode,
+                 struct buffer_head *bh, ext4_fsblk_t blocknr);
 
-int __ext4_journal_get_create_access(const char *where,
+int __ext4_journal_get_create_access(const char *where, unsigned int line,
                                handle_t *handle, struct buffer_head *bh);
 
-int __ext4_handle_dirty_metadata(const char *where, handle_t *handle,
-                                struct inode *inode, struct buffer_head *bh);
+int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
+                                handle_t *handle, struct inode *inode,
+                                struct buffer_head *bh);
 
-int __ext4_handle_dirty_super(const char *where, handle_t *handle,
-                             struct super_block *sb);
+int __ext4_handle_dirty_super(const char *where, unsigned int line,
+                             handle_t *handle, struct super_block *sb);
 
 #define ext4_journal_get_undo_access(handle, bh) \
-       __ext4_journal_get_undo_access(__func__, (handle), (bh))
+       __ext4_journal_get_undo_access(__func__, __LINE__, (handle), (bh))
 #define ext4_journal_get_write_access(handle, bh) \
-       __ext4_journal_get_write_access(__func__, (handle), (bh))
+       __ext4_journal_get_write_access(__func__, __LINE__, (handle), (bh))
 #define ext4_forget(handle, is_metadata, inode, bh, block_nr) \
-       __ext4_forget(__func__, (handle), (is_metadata), (inode), (bh),\
-                     (block_nr))
+       __ext4_forget(__func__, __LINE__, (handle), (is_metadata), (inode), \
+                     (bh), (block_nr))
 #define ext4_journal_get_create_access(handle, bh) \
-       __ext4_journal_get_create_access(__func__, (handle), (bh))
+       __ext4_journal_get_create_access(__func__, __LINE__, (handle), (bh))
 #define ext4_handle_dirty_metadata(handle, inode, bh) \
-       __ext4_handle_dirty_metadata(__func__, (handle), (inode), (bh))
+       __ext4_handle_dirty_metadata(__func__, __LINE__, (handle), (inode), \
+                                    (bh))
 #define ext4_handle_dirty_super(handle, sb) \
-       __ext4_handle_dirty_super(__func__, (handle), (sb))
+       __ext4_handle_dirty_super(__func__, __LINE__, (handle), (sb))
 
 handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks);
 int __ext4_journal_stop(const char *where, handle_t *handle);
index 39aeb454bf2cd6cd080e14c868c997205c633693..87db5ecfccb474049eddbe711a6d7ae3639ce684 100644 (file)
@@ -283,8 +283,9 @@ int __ext4_journal_stop(const char *where, handle_t *handle)
        return err;
 }
 
-void ext4_journal_abort_handle(const char *caller, const char *err_fn,
-               struct buffer_head *bh, handle_t *handle, int err)
+void ext4_journal_abort_handle(const char *caller, unsigned int line,
+                              const char *err_fn, struct buffer_head *bh,
+                              handle_t *handle, int err)
 {
        char nbuf[16];
        const char *errstr = ext4_decode_error(NULL, err, nbuf);
@@ -300,8 +301,8 @@ void ext4_journal_abort_handle(const char *caller, const char *err_fn,
        if (is_handle_aborted(handle))
                return;
 
-       printk(KERN_ERR "%s: aborting transaction: %s in %s\n",
-              caller, errstr, err_fn);
+       printk(KERN_ERR "%s:%d: aborting transaction: %s in %s\n",
+              caller, line, errstr, err_fn);
 
        jbd2_journal_abort_handle(handle);
 }