aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2007-08-27 04:45:26 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2007-10-10 03:55:55 -0400
commit1e1a3d03e927d39282208aed676e49d25129feea (patch)
tree731cca9b4df1a6164c809f002290a3d7fd6af1f4
parent8497a46e178addb27ad1c981befaa17ca788b5c3 (diff)
[GFS2] Introduce gfs2_remove_from_ail
This collects together the operations required to remove a gfs2_bufdata from the ail lists. Its only called from two places to start with, but expect to see more of this function in future. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r--fs/gfs2/glops.c6
-rw-r--r--fs/gfs2/log.c31
-rw-r--r--fs/gfs2/log.h1
3 files changed, 23 insertions, 15 deletions
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 7ef6b23bb38a..b17346a355bf 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -60,11 +60,7 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl)
60 blkno = bh->b_blocknr; 60 blkno = bh->b_blocknr;
61 gfs2_assert_withdraw(sdp, !buffer_busy(bh)); 61 gfs2_assert_withdraw(sdp, !buffer_busy(bh));
62 62
63 bd->bd_ail = NULL; 63 gfs2_remove_from_ail(NULL, bd);
64 list_del(&bd->bd_ail_st_list);
65 list_del(&bd->bd_ail_gl_list);
66 atomic_dec(&gl->gl_ail_count);
67 brelse(bh);
68 gfs2_log_unlock(sdp); 64 gfs2_log_unlock(sdp);
69 65
70 gfs2_trans_add_revoke(sdp, blkno); 66 gfs2_trans_add_revoke(sdp, blkno);
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index d0e6b42c86e1..d8232ec25397 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -60,6 +60,26 @@ unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct,
60} 60}
61 61
62/** 62/**
63 * gfs2_remove_from_ail - Remove an entry from the ail lists, updating counters
64 * @mapping: The associated mapping (maybe NULL)
65 * @bd: The gfs2_bufdata to remove
66 *
67 * The log lock _must_ be held when calling this function
68 *
69 */
70
71void gfs2_remove_from_ail(struct address_space *mapping, struct gfs2_bufdata *bd)
72{
73 bd->bd_ail = NULL;
74 list_del(&bd->bd_ail_st_list);
75 list_del(&bd->bd_ail_gl_list);
76 atomic_dec(&bd->bd_gl->gl_ail_count);
77 if (mapping)
78 gfs2_meta_cache_flush(GFS2_I(mapping->host));
79 brelse(bd->bd_bh);
80}
81
82/**
63 * gfs2_ail1_start_one - Start I/O on a part of the AIL 83 * gfs2_ail1_start_one - Start I/O on a part of the AIL
64 * @sdp: the filesystem 84 * @sdp: the filesystem
65 * @tr: the part of the AIL 85 * @tr: the part of the AIL
@@ -219,21 +239,12 @@ static void gfs2_ail2_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
219{ 239{
220 struct list_head *head = &ai->ai_ail2_list; 240 struct list_head *head = &ai->ai_ail2_list;
221 struct gfs2_bufdata *bd; 241 struct gfs2_bufdata *bd;
222 struct gfs2_inode *bh_ip;
223 242
224 while (!list_empty(head)) { 243 while (!list_empty(head)) {
225 bd = list_entry(head->prev, struct gfs2_bufdata, 244 bd = list_entry(head->prev, struct gfs2_bufdata,
226 bd_ail_st_list); 245 bd_ail_st_list);
227 gfs2_assert(sdp, bd->bd_ail == ai); 246 gfs2_assert(sdp, bd->bd_ail == ai);
228 bd->bd_ail = NULL; 247 gfs2_remove_from_ail(bd->bd_bh->b_page->mapping, bd);
229 list_del(&bd->bd_ail_st_list);
230 list_del(&bd->bd_ail_gl_list);
231 atomic_dec(&bd->bd_gl->gl_ail_count);
232 if (bd->bd_bh->b_page->mapping) {
233 bh_ip = GFS2_I(bd->bd_bh->b_page->mapping->host);
234 gfs2_meta_cache_flush(bh_ip);
235 }
236 brelse(bd->bd_bh);
237 } 248 }
238} 249}
239 250
diff --git a/fs/gfs2/log.h b/fs/gfs2/log.h
index 8e7aa0f29109..639423561b2d 100644
--- a/fs/gfs2/log.h
+++ b/fs/gfs2/log.h
@@ -58,6 +58,7 @@ struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp,
58 struct buffer_head *real); 58 struct buffer_head *real);
59void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl); 59void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl);
60void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans); 60void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans);
61void gfs2_remove_from_ail(struct address_space *mapping, struct gfs2_bufdata *bd);
61 62
62void gfs2_log_shutdown(struct gfs2_sbd *sdp); 63void gfs2_log_shutdown(struct gfs2_sbd *sdp);
63void gfs2_meta_syncfs(struct gfs2_sbd *sdp); 64void gfs2_meta_syncfs(struct gfs2_sbd *sdp);