diff options
Diffstat (limited to 'fs/gfs2/glops.c')
-rw-r--r-- | fs/gfs2/glops.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index 8ebff8ebae20..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 | /** |
@@ -284,7 +277,7 @@ static int inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl) | |||
284 | * Returns: 1 if it's ok | 277 | * Returns: 1 if it's ok |
285 | */ | 278 | */ |
286 | 279 | ||
287 | static int rgrp_go_demote_ok(struct gfs2_glock *gl) | 280 | static int rgrp_go_demote_ok(const struct gfs2_glock *gl) |
288 | { | 281 | { |
289 | return !gl->gl_aspace->i_mapping->nrpages; | 282 | return !gl->gl_aspace->i_mapping->nrpages; |
290 | } | 283 | } |
@@ -386,13 +379,25 @@ static int trans_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh) | |||
386 | } | 379 | } |
387 | 380 | ||
388 | /** | 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 | /** | ||
389 | * 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 |
390 | * @gl: the glock | 395 | * @gl: the glock |
391 | * | 396 | * |
392 | * Returns: 1 if it's ok | 397 | * Returns: 1 if it's ok |
393 | */ | 398 | */ |
394 | 399 | ||
395 | static int quota_go_demote_ok(struct gfs2_glock *gl) | 400 | static int quota_go_demote_ok(const struct gfs2_glock *gl) |
396 | { | 401 | { |
397 | return !atomic_read(&gl->gl_lvb_count); | 402 | return !atomic_read(&gl->gl_lvb_count); |
398 | } | 403 | } |
@@ -426,6 +431,7 @@ const struct gfs2_glock_operations gfs2_rgrp_glops = { | |||
426 | const struct gfs2_glock_operations gfs2_trans_glops = { | 431 | const struct gfs2_glock_operations gfs2_trans_glops = { |
427 | .go_xmote_th = trans_go_sync, | 432 | .go_xmote_th = trans_go_sync, |
428 | .go_xmote_bh = trans_go_xmote_bh, | 433 | .go_xmote_bh = trans_go_xmote_bh, |
434 | .go_demote_ok = trans_go_demote_ok, | ||
429 | .go_type = LM_TYPE_NONDISK, | 435 | .go_type = LM_TYPE_NONDISK, |
430 | }; | 436 | }; |
431 | 437 | ||