aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2012-04-16 11:40:56 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2012-04-24 11:44:36 -0400
commitc50b91c4bd511dfe844e2aa7be429b6b88406353 (patch)
tree0a9584ec238036b599bb717db5bd1a7df5c616ca /fs/gfs2
parentdad30e9031c5927c30b402f73ac57ffbe09dc9ee (diff)
GFS2: Remove bd_list_tr
This is another clean up in the logging code. This per-transaction list was largely unused. Its main function was to ensure that the number of buffers in a transaction was correct, however that counter was only used to check the number of buffers in the bd_list_tr, plus an assert at the end of each transaction. With the assert now changed to use the calculated buffer counts, we can remove both bd_list_tr and its associated counter. This should make the code easier to understand as well as shrinking a couple of structures. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/aops.c1
-rw-r--r--fs/gfs2/glops.c1
-rw-r--r--fs/gfs2/incore.h11
-rw-r--r--fs/gfs2/log.c17
-rw-r--r--fs/gfs2/lops.c14
-rw-r--r--fs/gfs2/meta_io.c1
-rw-r--r--fs/gfs2/trans.c32
7 files changed, 21 insertions, 56 deletions
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 56dc1f0084ba..a627b3ee5c9f 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -1084,7 +1084,6 @@ int gfs2_releasepage(struct page *page, gfp_t gfp_mask)
1084 bd = bh->b_private; 1084 bd = bh->b_private;
1085 if (bd) { 1085 if (bd) {
1086 gfs2_assert_warn(sdp, bd->bd_bh == bh); 1086 gfs2_assert_warn(sdp, bd->bd_bh == bh);
1087 gfs2_assert_warn(sdp, list_empty(&bd->bd_list_tr));
1088 if (!list_empty(&bd->bd_le.le_list)) { 1087 if (!list_empty(&bd->bd_le.le_list)) {
1089 if (!buffer_pinned(bh)) 1088 if (!buffer_pinned(bh))
1090 list_del_init(&bd->bd_le.le_list); 1089 list_del_init(&bd->bd_le.le_list);
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 1656df7aacd2..cd3e6fbf111b 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -94,7 +94,6 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl)
94 /* A shortened, inline version of gfs2_trans_begin() */ 94 /* A shortened, inline version of gfs2_trans_begin() */
95 tr.tr_reserved = 1 + gfs2_struct2blk(sdp, tr.tr_revokes, sizeof(u64)); 95 tr.tr_reserved = 1 + gfs2_struct2blk(sdp, tr.tr_revokes, sizeof(u64));
96 tr.tr_ip = (unsigned long)__builtin_return_address(0); 96 tr.tr_ip = (unsigned long)__builtin_return_address(0);
97 INIT_LIST_HEAD(&tr.tr_list_buf);
98 gfs2_log_reserve(sdp, tr.tr_reserved); 97 gfs2_log_reserve(sdp, tr.tr_reserved);
99 BUG_ON(current->journal_info); 98 BUG_ON(current->journal_info);
100 current->journal_info = &tr; 99 current->journal_info = &tr;
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index dd97f64a8bd4..e773fbc28f95 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -118,13 +118,7 @@ TAS_BUFFER_FNS(Zeronew, zeronew)
118struct gfs2_bufdata { 118struct gfs2_bufdata {
119 struct buffer_head *bd_bh; 119 struct buffer_head *bd_bh;
120 struct gfs2_glock *bd_gl; 120 struct gfs2_glock *bd_gl;
121 121 u64 bd_blkno;
122 union {
123 struct list_head list_tr;
124 u64 blkno;
125 } u;
126#define bd_list_tr u.list_tr
127#define bd_blkno u.blkno
128 122
129 struct gfs2_log_element bd_le; 123 struct gfs2_log_element bd_le;
130 124
@@ -411,13 +405,10 @@ struct gfs2_trans {
411 405
412 int tr_touched; 406 int tr_touched;
413 407
414 unsigned int tr_num_buf;
415 unsigned int tr_num_buf_new; 408 unsigned int tr_num_buf_new;
416 unsigned int tr_num_databuf_new; 409 unsigned int tr_num_databuf_new;
417 unsigned int tr_num_buf_rm; 410 unsigned int tr_num_buf_rm;
418 unsigned int tr_num_databuf_rm; 411 unsigned int tr_num_databuf_rm;
419 struct list_head tr_list_buf;
420
421 unsigned int tr_num_revoke; 412 unsigned int tr_num_revoke;
422 unsigned int tr_num_revoke_rm; 413 unsigned int tr_num_revoke_rm;
423}; 414};
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index f5eacb3589ba..2307218de6e4 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -696,21 +696,6 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
696 gfs2_log_unlock(sdp); 696 gfs2_log_unlock(sdp);
697} 697}
698 698
699static void buf_lo_incore_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
700{
701 struct list_head *head = &tr->tr_list_buf;
702 struct gfs2_bufdata *bd;
703
704 gfs2_log_lock(sdp);
705 while (!list_empty(head)) {
706 bd = list_entry(head->next, struct gfs2_bufdata, bd_list_tr);
707 list_del_init(&bd->bd_list_tr);
708 tr->tr_num_buf--;
709 }
710 gfs2_log_unlock(sdp);
711 gfs2_assert_warn(sdp, !tr->tr_num_buf);
712}
713
714/** 699/**
715 * gfs2_log_commit - Commit a transaction to the log 700 * gfs2_log_commit - Commit a transaction to the log
716 * @sdp: the filesystem 701 * @sdp: the filesystem
@@ -729,8 +714,6 @@ static void buf_lo_incore_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
729void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) 714void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
730{ 715{
731 log_refund(sdp, tr); 716 log_refund(sdp, tr);
732 buf_lo_incore_commit(sdp, tr);
733
734 up_read(&sdp->sd_log_flush_lock); 717 up_read(&sdp->sd_log_flush_lock);
735 718
736 if (atomic_read(&sdp->sd_log_pinned) > atomic_read(&sdp->sd_log_thresh1) || 719 if (atomic_read(&sdp->sd_log_pinned) > atomic_read(&sdp->sd_log_thresh1) ||
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index 7882671bfe09..e9709dabc267 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -396,12 +396,8 @@ static void buf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
396 396
397 lock_buffer(bd->bd_bh); 397 lock_buffer(bd->bd_bh);
398 gfs2_log_lock(sdp); 398 gfs2_log_lock(sdp);
399 if (!list_empty(&bd->bd_list_tr))
400 goto out;
401 tr = current->journal_info; 399 tr = current->journal_info;
402 tr->tr_touched = 1; 400 tr->tr_touched = 1;
403 tr->tr_num_buf++;
404 list_add(&bd->bd_list_tr, &tr->tr_list_buf);
405 if (!list_empty(&le->le_list)) 401 if (!list_empty(&le->le_list))
406 goto out; 402 goto out;
407 set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags); 403 set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags);
@@ -781,18 +777,10 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
781 777
782 lock_buffer(bd->bd_bh); 778 lock_buffer(bd->bd_bh);
783 gfs2_log_lock(sdp); 779 gfs2_log_lock(sdp);
784 if (tr) { 780 if (tr)
785 if (!list_empty(&bd->bd_list_tr))
786 goto out;
787 tr->tr_touched = 1; 781 tr->tr_touched = 1;
788 if (gfs2_is_jdata(ip)) {
789 tr->tr_num_buf++;
790 list_add(&bd->bd_list_tr, &tr->tr_list_buf);
791 }
792 }
793 if (!list_empty(&le->le_list)) 782 if (!list_empty(&le->le_list))
794 goto out; 783 goto out;
795
796 set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags); 784 set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags);
797 set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags); 785 set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
798 if (gfs2_is_jdata(ip)) { 786 if (gfs2_is_jdata(ip)) {
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 181586e673f9..8a82a4dc711f 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -293,7 +293,6 @@ void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh,
293 bd->bd_bh = bh; 293 bd->bd_bh = bh;
294 bd->bd_gl = gl; 294 bd->bd_gl = gl;
295 295
296 INIT_LIST_HEAD(&bd->bd_list_tr);
297 if (meta) 296 if (meta)
298 lops_init_le(&bd->bd_le, &gfs2_buf_lops); 297 lops_init_le(&bd->bd_le, &gfs2_buf_lops);
299 else 298 else
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index 86ac75d99d31..8fb631769172 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -50,8 +50,6 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,
50 if (revokes) 50 if (revokes)
51 tr->tr_reserved += gfs2_struct2blk(sdp, revokes, 51 tr->tr_reserved += gfs2_struct2blk(sdp, revokes,
52 sizeof(u64)); 52 sizeof(u64));
53 INIT_LIST_HEAD(&tr->tr_list_buf);
54
55 gfs2_holder_init(sdp->sd_trans_gl, LM_ST_SHARED, 0, &tr->tr_t_gh); 53 gfs2_holder_init(sdp->sd_trans_gl, LM_ST_SHARED, 0, &tr->tr_t_gh);
56 54
57 error = gfs2_glock_nq(&tr->tr_t_gh); 55 error = gfs2_glock_nq(&tr->tr_t_gh);
@@ -93,10 +91,21 @@ static void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks)
93 up_read(&sdp->sd_log_flush_lock); 91 up_read(&sdp->sd_log_flush_lock);
94} 92}
95 93
94static void gfs2_print_trans(const struct gfs2_trans *tr)
95{
96 print_symbol(KERN_WARNING "GFS2: Transaction created at: %s\n", tr->tr_ip);
97 printk(KERN_WARNING "GFS2: blocks=%u revokes=%u reserved=%u touched=%d\n",
98 tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_touched);
99 printk(KERN_WARNING "GFS2: Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
100 tr->tr_num_buf_new, tr->tr_num_buf_rm,
101 tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
102 tr->tr_num_revoke, tr->tr_num_revoke_rm);
103}
104
96void gfs2_trans_end(struct gfs2_sbd *sdp) 105void gfs2_trans_end(struct gfs2_sbd *sdp)
97{ 106{
98 struct gfs2_trans *tr = current->journal_info; 107 struct gfs2_trans *tr = current->journal_info;
99 108 s64 nbuf;
100 BUG_ON(!tr); 109 BUG_ON(!tr);
101 current->journal_info = NULL; 110 current->journal_info = NULL;
102 111
@@ -110,16 +119,13 @@ void gfs2_trans_end(struct gfs2_sbd *sdp)
110 return; 119 return;
111 } 120 }
112 121
113 if (gfs2_assert_withdraw(sdp, tr->tr_num_buf <= tr->tr_blocks)) { 122 nbuf = tr->tr_num_buf_new + tr->tr_num_databuf_new;
114 fs_err(sdp, "tr_num_buf = %u, tr_blocks = %u ", 123 nbuf -= tr->tr_num_buf_rm;
115 tr->tr_num_buf, tr->tr_blocks); 124 nbuf -= tr->tr_num_databuf_rm;
116 print_symbol(KERN_WARNING "GFS2: Transaction created at: %s\n", tr->tr_ip); 125
117 } 126 if (gfs2_assert_withdraw(sdp, (nbuf <= tr->tr_blocks) &&
118 if (gfs2_assert_withdraw(sdp, tr->tr_num_revoke <= tr->tr_revokes)) { 127 (tr->tr_num_revoke <= tr->tr_revokes)))
119 fs_err(sdp, "tr_num_revoke = %u, tr_revokes = %u ", 128 gfs2_print_trans(tr);
120 tr->tr_num_revoke, tr->tr_revokes);
121 print_symbol(KERN_WARNING "GFS2: Transaction created at: %s\n", tr->tr_ip);
122 }
123 129
124 gfs2_log_commit(sdp, tr); 130 gfs2_log_commit(sdp, tr);
125 if (tr->tr_t_gh.gh_gl) { 131 if (tr->tr_t_gh.gh_gl) {