diff options
Diffstat (limited to 'fs/gfs2/glops.c')
| -rw-r--r-- | fs/gfs2/glops.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index ef1492e2d445..41a6b6818a50 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c | |||
| @@ -26,7 +26,58 @@ | |||
| 26 | #include "recovery.h" | 26 | #include "recovery.h" |
| 27 | #include "rgrp.h" | 27 | #include "rgrp.h" |
| 28 | #include "util.h" | 28 | #include "util.h" |
| 29 | #include "trans.h" | ||
| 29 | 30 | ||
| 31 | /** | ||
| 32 | * ail_empty_gl - remove all buffers for a given lock from the AIL | ||
| 33 | * @gl: the glock | ||
| 34 | * | ||
| 35 | * None of the buffers should be dirty, locked, or pinned. | ||
| 36 | */ | ||
| 37 | |||
| 38 | static void gfs2_ail_empty_gl(struct gfs2_glock *gl) | ||
| 39 | { | ||
| 40 | struct gfs2_sbd *sdp = gl->gl_sbd; | ||
| 41 | unsigned int blocks; | ||
| 42 | struct list_head *head = &gl->gl_ail_list; | ||
| 43 | struct gfs2_bufdata *bd; | ||
| 44 | struct buffer_head *bh; | ||
| 45 | u64 blkno; | ||
| 46 | int error; | ||
| 47 | |||
| 48 | blocks = atomic_read(&gl->gl_ail_count); | ||
| 49 | if (!blocks) | ||
| 50 | return; | ||
| 51 | |||
| 52 | error = gfs2_trans_begin(sdp, 0, blocks); | ||
| 53 | if (gfs2_assert_withdraw(sdp, !error)) | ||
| 54 | return; | ||
| 55 | |||
| 56 | gfs2_log_lock(sdp); | ||
| 57 | while (!list_empty(head)) { | ||
| 58 | bd = list_entry(head->next, struct gfs2_bufdata, | ||
| 59 | bd_ail_gl_list); | ||
| 60 | bh = bd->bd_bh; | ||
| 61 | blkno = bh->b_blocknr; | ||
| 62 | gfs2_assert_withdraw(sdp, !buffer_busy(bh)); | ||
| 63 | |||
| 64 | bd->bd_ail = NULL; | ||
| 65 | list_del(&bd->bd_ail_st_list); | ||
| 66 | list_del(&bd->bd_ail_gl_list); | ||
| 67 | atomic_dec(&gl->gl_ail_count); | ||
| 68 | brelse(bh); | ||
| 69 | gfs2_log_unlock(sdp); | ||
| 70 | |||
| 71 | gfs2_trans_add_revoke(sdp, blkno); | ||
| 72 | |||
| 73 | gfs2_log_lock(sdp); | ||
| 74 | } | ||
| 75 | gfs2_assert_withdraw(sdp, !atomic_read(&gl->gl_ail_count)); | ||
| 76 | gfs2_log_unlock(sdp); | ||
| 77 | |||
| 78 | gfs2_trans_end(sdp); | ||
| 79 | gfs2_log_flush(sdp, NULL); | ||
| 80 | } | ||
| 30 | 81 | ||
| 31 | /** | 82 | /** |
| 32 | * gfs2_pte_inval - Sync and invalidate all PTEs associated with a glock | 83 | * gfs2_pte_inval - Sync and invalidate all PTEs associated with a glock |
