diff options
Diffstat (limited to 'fs/gfs2/glops.c')
-rw-r--r-- | fs/gfs2/glops.c | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index c6c318c2a0f6..8522d3aa64fc 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c | |||
@@ -201,19 +201,12 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags) | |||
201 | * Returns: 1 if it's ok | 201 | * Returns: 1 if it's ok |
202 | */ | 202 | */ |
203 | 203 | ||
204 | static int inode_go_demote_ok(struct gfs2_glock *gl) | 204 | static int inode_go_demote_ok(const struct gfs2_glock *gl) |
205 | { | 205 | { |
206 | struct gfs2_sbd *sdp = gl->gl_sbd; | 206 | struct gfs2_sbd *sdp = gl->gl_sbd; |
207 | int demote = 0; | 207 | if (sdp->sd_jindex == gl->gl_object || sdp->sd_rindex == gl->gl_object) |
208 | 208 | return 0; | |
209 | if (!gl->gl_object && !gl->gl_aspace->i_mapping->nrpages) | 209 | return 1; |
210 | demote = 1; | ||
211 | else if (!sdp->sd_args.ar_localcaching && | ||
212 | time_after_eq(jiffies, gl->gl_stamp + | ||
213 | gfs2_tune_get(sdp, gt_demote_secs) * HZ)) | ||
214 | demote = 1; | ||
215 | |||
216 | return demote; | ||
217 | } | 210 | } |
218 | 211 | ||
219 | /** | 212 | /** |
@@ -227,6 +220,7 @@ static int inode_go_demote_ok(struct gfs2_glock *gl) | |||
227 | static int inode_go_lock(struct gfs2_holder *gh) | 220 | static int inode_go_lock(struct gfs2_holder *gh) |
228 | { | 221 | { |
229 | struct gfs2_glock *gl = gh->gh_gl; | 222 | struct gfs2_glock *gl = gh->gh_gl; |
223 | struct gfs2_sbd *sdp = gl->gl_sbd; | ||
230 | struct gfs2_inode *ip = gl->gl_object; | 224 | struct gfs2_inode *ip = gl->gl_object; |
231 | int error = 0; | 225 | int error = 0; |
232 | 226 | ||
@@ -239,10 +233,16 @@ static int inode_go_lock(struct gfs2_holder *gh) | |||
239 | return error; | 233 | return error; |
240 | } | 234 | } |
241 | 235 | ||
242 | if ((ip->i_di.di_flags & GFS2_DIF_TRUNC_IN_PROG) && | 236 | if ((ip->i_diskflags & GFS2_DIF_TRUNC_IN_PROG) && |
243 | (gl->gl_state == LM_ST_EXCLUSIVE) && | 237 | (gl->gl_state == LM_ST_EXCLUSIVE) && |
244 | (gh->gh_state == LM_ST_EXCLUSIVE)) | 238 | (gh->gh_state == LM_ST_EXCLUSIVE)) { |
245 | error = gfs2_truncatei_resume(ip); | 239 | spin_lock(&sdp->sd_trunc_lock); |
240 | if (list_empty(&ip->i_trunc_list)) | ||
241 | list_add(&sdp->sd_trunc_list, &ip->i_trunc_list); | ||
242 | spin_unlock(&sdp->sd_trunc_lock); | ||
243 | wake_up(&sdp->sd_quota_wait); | ||
244 | return 1; | ||
245 | } | ||
246 | 246 | ||
247 | return error; | 247 | return error; |
248 | } | 248 | } |
@@ -260,10 +260,13 @@ static int inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl) | |||
260 | const struct gfs2_inode *ip = gl->gl_object; | 260 | const struct gfs2_inode *ip = gl->gl_object; |
261 | if (ip == NULL) | 261 | if (ip == NULL) |
262 | return 0; | 262 | return 0; |
263 | gfs2_print_dbg(seq, " I: n:%llu/%llu t:%u f:0x%08lx\n", | 263 | gfs2_print_dbg(seq, " I: n:%llu/%llu t:%u f:0x%02lx d:0x%08x s:%llu/%llu\n", |
264 | (unsigned long long)ip->i_no_formal_ino, | 264 | (unsigned long long)ip->i_no_formal_ino, |
265 | (unsigned long long)ip->i_no_addr, | 265 | (unsigned long long)ip->i_no_addr, |
266 | IF2DT(ip->i_inode.i_mode), ip->i_flags); | 266 | IF2DT(ip->i_inode.i_mode), ip->i_flags, |
267 | (unsigned int)ip->i_diskflags, | ||
268 | (unsigned long long)ip->i_inode.i_size, | ||
269 | (unsigned long long)ip->i_disksize); | ||
267 | return 0; | 270 | return 0; |
268 | } | 271 | } |
269 | 272 | ||
@@ -274,7 +277,7 @@ static int inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl) | |||
274 | * Returns: 1 if it's ok | 277 | * Returns: 1 if it's ok |
275 | */ | 278 | */ |
276 | 279 | ||
277 | static int rgrp_go_demote_ok(struct gfs2_glock *gl) | 280 | static int rgrp_go_demote_ok(const struct gfs2_glock *gl) |
278 | { | 281 | { |
279 | return !gl->gl_aspace->i_mapping->nrpages; | 282 | return !gl->gl_aspace->i_mapping->nrpages; |
280 | } | 283 | } |
@@ -318,7 +321,9 @@ static int rgrp_go_dump(struct seq_file *seq, const struct gfs2_glock *gl) | |||
318 | const struct gfs2_rgrpd *rgd = gl->gl_object; | 321 | const struct gfs2_rgrpd *rgd = gl->gl_object; |
319 | if (rgd == NULL) | 322 | if (rgd == NULL) |
320 | return 0; | 323 | return 0; |
321 | gfs2_print_dbg(seq, " R: n:%llu\n", (unsigned long long)rgd->rd_addr); | 324 | gfs2_print_dbg(seq, " R: n:%llu f:%02x b:%u/%u i:%u\n", |
325 | (unsigned long long)rgd->rd_addr, rgd->rd_flags, | ||
326 | rgd->rd_free, rgd->rd_free_clone, rgd->rd_dinodes); | ||
322 | return 0; | 327 | return 0; |
323 | } | 328 | } |
324 | 329 | ||
@@ -374,13 +379,25 @@ static int trans_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh) | |||
374 | } | 379 | } |
375 | 380 | ||
376 | /** | 381 | /** |
382 | * trans_go_demote_ok | ||
383 | * @gl: the glock | ||
384 | * | ||
385 | * Always returns 0 | ||
386 | */ | ||
387 | |||
388 | static int trans_go_demote_ok(const struct gfs2_glock *gl) | ||
389 | { | ||
390 | return 0; | ||
391 | } | ||
392 | |||
393 | /** | ||
377 | * quota_go_demote_ok - Check to see if it's ok to unlock a quota glock | 394 | * quota_go_demote_ok - Check to see if it's ok to unlock a quota glock |
378 | * @gl: the glock | 395 | * @gl: the glock |
379 | * | 396 | * |
380 | * Returns: 1 if it's ok | 397 | * Returns: 1 if it's ok |
381 | */ | 398 | */ |
382 | 399 | ||
383 | static int quota_go_demote_ok(struct gfs2_glock *gl) | 400 | static int quota_go_demote_ok(const struct gfs2_glock *gl) |
384 | { | 401 | { |
385 | return !atomic_read(&gl->gl_lvb_count); | 402 | return !atomic_read(&gl->gl_lvb_count); |
386 | } | 403 | } |
@@ -414,6 +431,7 @@ const struct gfs2_glock_operations gfs2_rgrp_glops = { | |||
414 | const struct gfs2_glock_operations gfs2_trans_glops = { | 431 | const struct gfs2_glock_operations gfs2_trans_glops = { |
415 | .go_xmote_th = trans_go_sync, | 432 | .go_xmote_th = trans_go_sync, |
416 | .go_xmote_bh = trans_go_xmote_bh, | 433 | .go_xmote_bh = trans_go_xmote_bh, |
434 | .go_demote_ok = trans_go_demote_ok, | ||
417 | .go_type = LM_TYPE_NONDISK, | 435 | .go_type = LM_TYPE_NONDISK, |
418 | }; | 436 | }; |
419 | 437 | ||