diff options
author | Theodore Ts'o <tytso@mit.edu> | 2010-06-29 14:53:24 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2010-06-29 14:53:24 -0400 |
commit | 90c7201b97bb7ac5a4e2605abc0efb5fdfb957f0 (patch) | |
tree | 76eb6c66e45ae325d6c394b0534289da692fd2af | |
parent | e29136f80e775b0310273932b4297a62f5574a29 (diff) |
ext4: Pass line number to ext4_journal_abort_handle()
This allows the error messages to include the line number
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | fs/ext4/ext4_jbd2.c | 48 | ||||
-rw-r--r-- | fs/ext4/ext4_jbd2.h | 43 | ||||
-rw-r--r-- | fs/ext4/super.c | 9 |
3 files changed, 53 insertions, 47 deletions
diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c index df26a015d043..9de37b9e177a 100644 --- a/fs/ext4/ext4_jbd2.c +++ b/fs/ext4/ext4_jbd2.c | |||
@@ -6,29 +6,29 @@ | |||
6 | 6 | ||
7 | #include <trace/events/ext4.h> | 7 | #include <trace/events/ext4.h> |
8 | 8 | ||
9 | int __ext4_journal_get_undo_access(const char *where, handle_t *handle, | 9 | int __ext4_journal_get_undo_access(const char *where, unsigned int line, |
10 | struct buffer_head *bh) | 10 | handle_t *handle, struct buffer_head *bh) |
11 | { | 11 | { |
12 | int err = 0; | 12 | int err = 0; |
13 | 13 | ||
14 | if (ext4_handle_valid(handle)) { | 14 | if (ext4_handle_valid(handle)) { |
15 | err = jbd2_journal_get_undo_access(handle, bh); | 15 | err = jbd2_journal_get_undo_access(handle, bh); |
16 | if (err) | 16 | if (err) |
17 | ext4_journal_abort_handle(where, __func__, bh, | 17 | ext4_journal_abort_handle(where, line, __func__, bh, |
18 | handle, err); | 18 | handle, err); |
19 | } | 19 | } |
20 | return err; | 20 | return err; |
21 | } | 21 | } |
22 | 22 | ||
23 | int __ext4_journal_get_write_access(const char *where, handle_t *handle, | 23 | int __ext4_journal_get_write_access(const char *where, unsigned int line, |
24 | struct buffer_head *bh) | 24 | handle_t *handle, struct buffer_head *bh) |
25 | { | 25 | { |
26 | int err = 0; | 26 | int err = 0; |
27 | 27 | ||
28 | if (ext4_handle_valid(handle)) { | 28 | if (ext4_handle_valid(handle)) { |
29 | err = jbd2_journal_get_write_access(handle, bh); | 29 | err = jbd2_journal_get_write_access(handle, bh); |
30 | if (err) | 30 | if (err) |
31 | ext4_journal_abort_handle(where, __func__, bh, | 31 | ext4_journal_abort_handle(where, line, __func__, bh, |
32 | handle, err); | 32 | handle, err); |
33 | } | 33 | } |
34 | return err; | 34 | return err; |
@@ -46,9 +46,9 @@ int __ext4_journal_get_write_access(const char *where, handle_t *handle, | |||
46 | * If the handle isn't valid we're not journaling, but we still need to | 46 | * If the handle isn't valid we're not journaling, but we still need to |
47 | * call into ext4_journal_revoke() to put the buffer head. | 47 | * call into ext4_journal_revoke() to put the buffer head. |
48 | */ | 48 | */ |
49 | int __ext4_forget(const char *where, handle_t *handle, int is_metadata, | 49 | int __ext4_forget(const char *where, unsigned int line, handle_t *handle, |
50 | struct inode *inode, struct buffer_head *bh, | 50 | int is_metadata, struct inode *inode, |
51 | ext4_fsblk_t blocknr) | 51 | struct buffer_head *bh, ext4_fsblk_t blocknr) |
52 | { | 52 | { |
53 | int err; | 53 | int err; |
54 | 54 | ||
@@ -79,8 +79,8 @@ int __ext4_forget(const char *where, handle_t *handle, int is_metadata, | |||
79 | BUFFER_TRACE(bh, "call jbd2_journal_forget"); | 79 | BUFFER_TRACE(bh, "call jbd2_journal_forget"); |
80 | err = jbd2_journal_forget(handle, bh); | 80 | err = jbd2_journal_forget(handle, bh); |
81 | if (err) | 81 | if (err) |
82 | ext4_journal_abort_handle(where, __func__, bh, | 82 | ext4_journal_abort_handle(where, line, __func__, |
83 | handle, err); | 83 | bh, handle, err); |
84 | return err; | 84 | return err; |
85 | } | 85 | } |
86 | return 0; | 86 | return 0; |
@@ -92,7 +92,8 @@ int __ext4_forget(const char *where, handle_t *handle, int is_metadata, | |||
92 | BUFFER_TRACE(bh, "call jbd2_journal_revoke"); | 92 | BUFFER_TRACE(bh, "call jbd2_journal_revoke"); |
93 | err = jbd2_journal_revoke(handle, blocknr, bh); | 93 | err = jbd2_journal_revoke(handle, blocknr, bh); |
94 | if (err) { | 94 | if (err) { |
95 | ext4_journal_abort_handle(where, __func__, bh, handle, err); | 95 | ext4_journal_abort_handle(where, line, __func__, |
96 | bh, handle, err); | ||
96 | __ext4_abort(inode->i_sb, where, | 97 | __ext4_abort(inode->i_sb, where, |
97 | "error %d when attempting revoke", err); | 98 | "error %d when attempting revoke", err); |
98 | } | 99 | } |
@@ -100,7 +101,7 @@ int __ext4_forget(const char *where, handle_t *handle, int is_metadata, | |||
100 | return err; | 101 | return err; |
101 | } | 102 | } |
102 | 103 | ||
103 | int __ext4_journal_get_create_access(const char *where, | 104 | int __ext4_journal_get_create_access(const char *where, unsigned int line, |
104 | handle_t *handle, struct buffer_head *bh) | 105 | handle_t *handle, struct buffer_head *bh) |
105 | { | 106 | { |
106 | int err = 0; | 107 | int err = 0; |
@@ -108,22 +109,23 @@ int __ext4_journal_get_create_access(const char *where, | |||
108 | if (ext4_handle_valid(handle)) { | 109 | if (ext4_handle_valid(handle)) { |
109 | err = jbd2_journal_get_create_access(handle, bh); | 110 | err = jbd2_journal_get_create_access(handle, bh); |
110 | if (err) | 111 | if (err) |
111 | ext4_journal_abort_handle(where, __func__, bh, | 112 | ext4_journal_abort_handle(where, line, __func__, |
112 | handle, err); | 113 | bh, handle, err); |
113 | } | 114 | } |
114 | return err; | 115 | return err; |
115 | } | 116 | } |
116 | 117 | ||
117 | int __ext4_handle_dirty_metadata(const char *where, handle_t *handle, | 118 | int __ext4_handle_dirty_metadata(const char *where, unsigned int line, |
118 | struct inode *inode, struct buffer_head *bh) | 119 | handle_t *handle, struct inode *inode, |
120 | struct buffer_head *bh) | ||
119 | { | 121 | { |
120 | int err = 0; | 122 | int err = 0; |
121 | 123 | ||
122 | if (ext4_handle_valid(handle)) { | 124 | if (ext4_handle_valid(handle)) { |
123 | err = jbd2_journal_dirty_metadata(handle, bh); | 125 | err = jbd2_journal_dirty_metadata(handle, bh); |
124 | if (err) | 126 | if (err) |
125 | ext4_journal_abort_handle(where, __func__, bh, | 127 | ext4_journal_abort_handle(where, line, __func__, |
126 | handle, err); | 128 | bh, handle, err); |
127 | } else { | 129 | } else { |
128 | if (inode) | 130 | if (inode) |
129 | mark_buffer_dirty_inode(bh, inode); | 131 | mark_buffer_dirty_inode(bh, inode); |
@@ -144,8 +146,8 @@ int __ext4_handle_dirty_metadata(const char *where, handle_t *handle, | |||
144 | return err; | 146 | return err; |
145 | } | 147 | } |
146 | 148 | ||
147 | int __ext4_handle_dirty_super(const char *where, handle_t *handle, | 149 | int __ext4_handle_dirty_super(const char *where, unsigned int line, |
148 | struct super_block *sb) | 150 | handle_t *handle, struct super_block *sb) |
149 | { | 151 | { |
150 | struct buffer_head *bh = EXT4_SB(sb)->s_sbh; | 152 | struct buffer_head *bh = EXT4_SB(sb)->s_sbh; |
151 | int err = 0; | 153 | int err = 0; |
@@ -153,8 +155,8 @@ int __ext4_handle_dirty_super(const char *where, handle_t *handle, | |||
153 | if (ext4_handle_valid(handle)) { | 155 | if (ext4_handle_valid(handle)) { |
154 | err = jbd2_journal_dirty_metadata(handle, bh); | 156 | err = jbd2_journal_dirty_metadata(handle, bh); |
155 | if (err) | 157 | if (err) |
156 | ext4_journal_abort_handle(where, __func__, bh, | 158 | ext4_journal_abort_handle(where, line, __func__, |
157 | handle, err); | 159 | bh, handle, err); |
158 | } else | 160 | } else |
159 | sb->s_dirt = 1; | 161 | sb->s_dirt = 1; |
160 | return err; | 162 | return err; |
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h index 38d1e66e5843..6883c6be5b8d 100644 --- a/fs/ext4/ext4_jbd2.h +++ b/fs/ext4/ext4_jbd2.h | |||
@@ -122,41 +122,44 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode); | |||
122 | /* | 122 | /* |
123 | * Wrapper functions with which ext4 calls into JBD. | 123 | * Wrapper functions with which ext4 calls into JBD. |
124 | */ | 124 | */ |
125 | void ext4_journal_abort_handle(const char *caller, const char *err_fn, | 125 | void ext4_journal_abort_handle(const char *caller, unsigned int line, |
126 | const char *err_fn, | ||
126 | struct buffer_head *bh, handle_t *handle, int err); | 127 | struct buffer_head *bh, handle_t *handle, int err); |
127 | 128 | ||
128 | int __ext4_journal_get_undo_access(const char *where, handle_t *handle, | 129 | int __ext4_journal_get_undo_access(const char *where, unsigned int line, |
129 | struct buffer_head *bh); | 130 | handle_t *handle, struct buffer_head *bh); |
130 | 131 | ||
131 | int __ext4_journal_get_write_access(const char *where, handle_t *handle, | 132 | int __ext4_journal_get_write_access(const char *where, unsigned int line, |
132 | struct buffer_head *bh); | 133 | handle_t *handle, struct buffer_head *bh); |
133 | 134 | ||
134 | int __ext4_forget(const char *where, handle_t *handle, int is_metadata, | 135 | int __ext4_forget(const char *where, unsigned int line, handle_t *handle, |
135 | struct inode *inode, struct buffer_head *bh, | 136 | int is_metadata, struct inode *inode, |
136 | ext4_fsblk_t blocknr); | 137 | struct buffer_head *bh, ext4_fsblk_t blocknr); |
137 | 138 | ||
138 | int __ext4_journal_get_create_access(const char *where, | 139 | int __ext4_journal_get_create_access(const char *where, unsigned int line, |
139 | handle_t *handle, struct buffer_head *bh); | 140 | handle_t *handle, struct buffer_head *bh); |
140 | 141 | ||
141 | int __ext4_handle_dirty_metadata(const char *where, handle_t *handle, | 142 | int __ext4_handle_dirty_metadata(const char *where, unsigned int line, |
142 | struct inode *inode, struct buffer_head *bh); | 143 | handle_t *handle, struct inode *inode, |
144 | struct buffer_head *bh); | ||
143 | 145 | ||
144 | int __ext4_handle_dirty_super(const char *where, handle_t *handle, | 146 | int __ext4_handle_dirty_super(const char *where, unsigned int line, |
145 | struct super_block *sb); | 147 | handle_t *handle, struct super_block *sb); |
146 | 148 | ||
147 | #define ext4_journal_get_undo_access(handle, bh) \ | 149 | #define ext4_journal_get_undo_access(handle, bh) \ |
148 | __ext4_journal_get_undo_access(__func__, (handle), (bh)) | 150 | __ext4_journal_get_undo_access(__func__, __LINE__, (handle), (bh)) |
149 | #define ext4_journal_get_write_access(handle, bh) \ | 151 | #define ext4_journal_get_write_access(handle, bh) \ |
150 | __ext4_journal_get_write_access(__func__, (handle), (bh)) | 152 | __ext4_journal_get_write_access(__func__, __LINE__, (handle), (bh)) |
151 | #define ext4_forget(handle, is_metadata, inode, bh, block_nr) \ | 153 | #define ext4_forget(handle, is_metadata, inode, bh, block_nr) \ |
152 | __ext4_forget(__func__, (handle), (is_metadata), (inode), (bh),\ | 154 | __ext4_forget(__func__, __LINE__, (handle), (is_metadata), (inode), \ |
153 | (block_nr)) | 155 | (bh), (block_nr)) |
154 | #define ext4_journal_get_create_access(handle, bh) \ | 156 | #define ext4_journal_get_create_access(handle, bh) \ |
155 | __ext4_journal_get_create_access(__func__, (handle), (bh)) | 157 | __ext4_journal_get_create_access(__func__, __LINE__, (handle), (bh)) |
156 | #define ext4_handle_dirty_metadata(handle, inode, bh) \ | 158 | #define ext4_handle_dirty_metadata(handle, inode, bh) \ |
157 | __ext4_handle_dirty_metadata(__func__, (handle), (inode), (bh)) | 159 | __ext4_handle_dirty_metadata(__func__, __LINE__, (handle), (inode), \ |
160 | (bh)) | ||
158 | #define ext4_handle_dirty_super(handle, sb) \ | 161 | #define ext4_handle_dirty_super(handle, sb) \ |
159 | __ext4_handle_dirty_super(__func__, (handle), (sb)) | 162 | __ext4_handle_dirty_super(__func__, __LINE__, (handle), (sb)) |
160 | 163 | ||
161 | handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks); | 164 | handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks); |
162 | int __ext4_journal_stop(const char *where, handle_t *handle); | 165 | int __ext4_journal_stop(const char *where, handle_t *handle); |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 39aeb454bf2c..87db5ecfccb4 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -283,8 +283,9 @@ int __ext4_journal_stop(const char *where, handle_t *handle) | |||
283 | return err; | 283 | return err; |
284 | } | 284 | } |
285 | 285 | ||
286 | void ext4_journal_abort_handle(const char *caller, const char *err_fn, | 286 | void ext4_journal_abort_handle(const char *caller, unsigned int line, |
287 | struct buffer_head *bh, handle_t *handle, int err) | 287 | const char *err_fn, struct buffer_head *bh, |
288 | handle_t *handle, int err) | ||
288 | { | 289 | { |
289 | char nbuf[16]; | 290 | char nbuf[16]; |
290 | const char *errstr = ext4_decode_error(NULL, err, nbuf); | 291 | 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, | |||
300 | if (is_handle_aborted(handle)) | 301 | if (is_handle_aborted(handle)) |
301 | return; | 302 | return; |
302 | 303 | ||
303 | printk(KERN_ERR "%s: aborting transaction: %s in %s\n", | 304 | printk(KERN_ERR "%s:%d: aborting transaction: %s in %s\n", |
304 | caller, errstr, err_fn); | 305 | caller, line, errstr, err_fn); |
305 | 306 | ||
306 | jbd2_journal_abort_handle(handle); | 307 | jbd2_journal_abort_handle(handle); |
307 | } | 308 | } |