aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-03-06 15:17:21 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2014-03-07 04:39:18 -0500
commitcb94eb066e089da461d37fea39779606512e144a (patch)
tree12d2f26274a32d80fc46c394c5aefa49f374cdc4 /fs/gfs2
parent8382e26b2c8ba3c4be552d887eed1969dc1a95b8 (diff)
GFS2: Convert gfs2_lm_withdraw to use fs_err
vprintk use is not prefixed by a KERN_<LEVEL>, so emit these messages at KERN_ERR level. Using %pV can save some code and allow fs_err to be used, so do it. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/sys.c5
-rw-r--r--fs/gfs2/util.c87
-rw-r--r--fs/gfs2/util.h4
3 files changed, 46 insertions, 50 deletions
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 256354cba4dd..de25d5577e5d 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -140,9 +140,8 @@ static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
140 if (simple_strtol(buf, NULL, 0) != 1) 140 if (simple_strtol(buf, NULL, 0) != 1)
141 return -EINVAL; 141 return -EINVAL;
142 142
143 gfs2_lm_withdraw(sdp, 143 gfs2_lm_withdraw(sdp, "withdrawing from cluster at user's request\n");
144 "GFS2: fsid=%s: withdrawing from cluster at user's request\n", 144
145 sdp->sd_fsname);
146 return len; 145 return len;
147} 146}
148 147
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
index 84bf853046ae..86d2035ac669 100644
--- a/fs/gfs2/util.c
+++ b/fs/gfs2/util.c
@@ -35,18 +35,24 @@ void gfs2_assert_i(struct gfs2_sbd *sdp)
35 fs_emerg(sdp, "fatal assertion failed\n"); 35 fs_emerg(sdp, "fatal assertion failed\n");
36} 36}
37 37
38int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...) 38int gfs2_lm_withdraw(struct gfs2_sbd *sdp, const char *fmt, ...)
39{ 39{
40 struct lm_lockstruct *ls = &sdp->sd_lockstruct; 40 struct lm_lockstruct *ls = &sdp->sd_lockstruct;
41 const struct lm_lockops *lm = ls->ls_ops; 41 const struct lm_lockops *lm = ls->ls_ops;
42 va_list args; 42 va_list args;
43 struct va_format vaf;
43 44
44 if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW && 45 if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW &&
45 test_and_set_bit(SDF_SHUTDOWN, &sdp->sd_flags)) 46 test_and_set_bit(SDF_SHUTDOWN, &sdp->sd_flags))
46 return 0; 47 return 0;
47 48
48 va_start(args, fmt); 49 va_start(args, fmt);
49 vprintk(fmt, args); 50
51 vaf.fmt = fmt;
52 vaf.va = &args;
53
54 fs_err(sdp, "%pV", &vaf);
55
50 va_end(args); 56 va_end(args);
51 57
52 if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW) { 58 if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW) {
@@ -83,10 +89,9 @@ int gfs2_assert_withdraw_i(struct gfs2_sbd *sdp, char *assertion,
83{ 89{
84 int me; 90 int me;
85 me = gfs2_lm_withdraw(sdp, 91 me = gfs2_lm_withdraw(sdp,
86 "GFS2: fsid=%s: fatal: assertion \"%s\" failed\n" 92 "fatal: assertion \"%s\" failed\n"
87 "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", 93 " function = %s, file = %s, line = %u\n",
88 sdp->sd_fsname, assertion, 94 assertion, function, file, line);
89 sdp->sd_fsname, function, file, line);
90 dump_stack(); 95 dump_stack();
91 return (me) ? -1 : -2; 96 return (me) ? -1 : -2;
92} 97}
@@ -136,10 +141,8 @@ int gfs2_consist_i(struct gfs2_sbd *sdp, int cluster_wide, const char *function,
136{ 141{
137 int rv; 142 int rv;
138 rv = gfs2_lm_withdraw(sdp, 143 rv = gfs2_lm_withdraw(sdp,
139 "GFS2: fsid=%s: fatal: filesystem consistency error\n" 144 "fatal: filesystem consistency error - function = %s, file = %s, line = %u\n",
140 "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", 145 function, file, line);
141 sdp->sd_fsname,
142 sdp->sd_fsname, function, file, line);
143 return rv; 146 return rv;
144} 147}
145 148
@@ -155,13 +158,12 @@ int gfs2_consist_inode_i(struct gfs2_inode *ip, int cluster_wide,
155 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 158 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
156 int rv; 159 int rv;
157 rv = gfs2_lm_withdraw(sdp, 160 rv = gfs2_lm_withdraw(sdp,
158 "GFS2: fsid=%s: fatal: filesystem consistency error\n" 161 "fatal: filesystem consistency error\n"
159 "GFS2: fsid=%s: inode = %llu %llu\n" 162 " inode = %llu %llu\n"
160 "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", 163 " function = %s, file = %s, line = %u\n",
161 sdp->sd_fsname, 164 (unsigned long long)ip->i_no_formal_ino,
162 sdp->sd_fsname, (unsigned long long)ip->i_no_formal_ino, 165 (unsigned long long)ip->i_no_addr,
163 (unsigned long long)ip->i_no_addr, 166 function, file, line);
164 sdp->sd_fsname, function, file, line);
165 return rv; 167 return rv;
166} 168}
167 169
@@ -177,12 +179,11 @@ int gfs2_consist_rgrpd_i(struct gfs2_rgrpd *rgd, int cluster_wide,
177 struct gfs2_sbd *sdp = rgd->rd_sbd; 179 struct gfs2_sbd *sdp = rgd->rd_sbd;
178 int rv; 180 int rv;
179 rv = gfs2_lm_withdraw(sdp, 181 rv = gfs2_lm_withdraw(sdp,
180 "GFS2: fsid=%s: fatal: filesystem consistency error\n" 182 "fatal: filesystem consistency error\n"
181 "GFS2: fsid=%s: RG = %llu\n" 183 " RG = %llu\n"
182 "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", 184 " function = %s, file = %s, line = %u\n",
183 sdp->sd_fsname, 185 (unsigned long long)rgd->rd_addr,
184 sdp->sd_fsname, (unsigned long long)rgd->rd_addr, 186 function, file, line);
185 sdp->sd_fsname, function, file, line);
186 return rv; 187 return rv;
187} 188}
188 189
@@ -198,12 +199,11 @@ int gfs2_meta_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh,
198{ 199{
199 int me; 200 int me;
200 me = gfs2_lm_withdraw(sdp, 201 me = gfs2_lm_withdraw(sdp,
201 "GFS2: fsid=%s: fatal: invalid metadata block\n" 202 "fatal: invalid metadata block\n"
202 "GFS2: fsid=%s: bh = %llu (%s)\n" 203 " bh = %llu (%s)\n"
203 "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", 204 " function = %s, file = %s, line = %u\n",
204 sdp->sd_fsname, 205 (unsigned long long)bh->b_blocknr, type,
205 sdp->sd_fsname, (unsigned long long)bh->b_blocknr, type, 206 function, file, line);
206 sdp->sd_fsname, function, file, line);
207 return (me) ? -1 : -2; 207 return (me) ? -1 : -2;
208} 208}
209 209
@@ -219,12 +219,11 @@ int gfs2_metatype_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh,
219{ 219{
220 int me; 220 int me;
221 me = gfs2_lm_withdraw(sdp, 221 me = gfs2_lm_withdraw(sdp,
222 "GFS2: fsid=%s: fatal: invalid metadata block\n" 222 "fatal: invalid metadata block\n"
223 "GFS2: fsid=%s: bh = %llu (type: exp=%u, found=%u)\n" 223 " bh = %llu (type: exp=%u, found=%u)\n"
224 "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", 224 " function = %s, file = %s, line = %u\n",
225 sdp->sd_fsname, 225 (unsigned long long)bh->b_blocknr, type, t,
226 sdp->sd_fsname, (unsigned long long)bh->b_blocknr, type, t, 226 function, file, line);
227 sdp->sd_fsname, function, file, line);
228 return (me) ? -1 : -2; 227 return (me) ? -1 : -2;
229} 228}
230 229
@@ -239,10 +238,9 @@ int gfs2_io_error_i(struct gfs2_sbd *sdp, const char *function, char *file,
239{ 238{
240 int rv; 239 int rv;
241 rv = gfs2_lm_withdraw(sdp, 240 rv = gfs2_lm_withdraw(sdp,
242 "GFS2: fsid=%s: fatal: I/O error\n" 241 "fatal: I/O error\n"
243 "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", 242 " function = %s, file = %s, line = %u\n",
244 sdp->sd_fsname, 243 function, file, line);
245 sdp->sd_fsname, function, file, line);
246 return rv; 244 return rv;
247} 245}
248 246
@@ -257,12 +255,11 @@ int gfs2_io_error_bh_i(struct gfs2_sbd *sdp, struct buffer_head *bh,
257{ 255{
258 int rv; 256 int rv;
259 rv = gfs2_lm_withdraw(sdp, 257 rv = gfs2_lm_withdraw(sdp,
260 "GFS2: fsid=%s: fatal: I/O error\n" 258 "fatal: I/O error\n"
261 "GFS2: fsid=%s: block = %llu\n" 259 " block = %llu\n"
262 "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", 260 " function = %s, file = %s, line = %u\n",
263 sdp->sd_fsname, 261 (unsigned long long)bh->b_blocknr,
264 sdp->sd_fsname, (unsigned long long)bh->b_blocknr, 262 function, file, line);
265 sdp->sd_fsname, function, file, line);
266 return rv; 263 return rv;
267} 264}
268 265
diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
index 515cce2d7131..cbdcbdf39614 100644
--- a/fs/gfs2/util.h
+++ b/fs/gfs2/util.h
@@ -165,7 +165,7 @@ static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt,
165#define gfs2_tune_get(sdp, field) \ 165#define gfs2_tune_get(sdp, field) \
166gfs2_tune_get_i(&(sdp)->sd_tune, &(sdp)->sd_tune.field) 166gfs2_tune_get_i(&(sdp)->sd_tune, &(sdp)->sd_tune.field)
167 167
168int gfs2_lm_withdraw(struct gfs2_sbd *sdp, char *fmt, ...); 168__printf(2, 3)
169int gfs2_lm_withdraw(struct gfs2_sbd *sdp, const char *fmt, ...);
169 170
170#endif /* __UTIL_DOT_H__ */ 171#endif /* __UTIL_DOT_H__ */
171