aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/log.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2014-02-21 10:22:35 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2014-02-24 11:54:54 -0500
commitd69a3c6561362a53d1be908ca343d899161d602c (patch)
tree8e9827ef9c25a21fab641dcaf263f84b026d535e /fs/gfs2/log.c
parent654a6d2f962edb7bf85973cfe93a04e24f56f902 (diff)
GFS2: Move log buffer lists into transaction
Over time, we hope to be able to improve the concurrency available in the log code. This is one small step towards that, by moving the buffer lists from the super block, and into the transaction structure, so that each transaction builds its own buffer lists. At transaction commit time, the buffer lists are merged into the currently accumulating transaction. That transaction then is passed into the before and after commit functions at journal flush time. Thus there should be no change in overall behaviour yet. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/log.c')
-rw-r--r--fs/gfs2/log.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 1e1bda0de43d..975712c6660b 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -712,7 +712,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
712 tr->tr_first = sdp->sd_log_flush_head; 712 tr->tr_first = sdp->sd_log_flush_head;
713 713
714 gfs2_ordered_write(sdp); 714 gfs2_ordered_write(sdp);
715 lops_before_commit(sdp); 715 lops_before_commit(sdp, tr);
716 gfs2_log_flush_bio(sdp, WRITE); 716 gfs2_log_flush_bio(sdp, WRITE);
717 717
718 if (sdp->sd_log_head != sdp->sd_log_flush_head) { 718 if (sdp->sd_log_head != sdp->sd_log_flush_head) {
@@ -744,6 +744,27 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
744 kfree(tr); 744 kfree(tr);
745} 745}
746 746
747/**
748 * gfs2_merge_trans - Merge a new transaction into a cached transaction
749 * @old: Original transaction to be expanded
750 * @new: New transaction to be merged
751 */
752
753static void gfs2_merge_trans(struct gfs2_trans *old, struct gfs2_trans *new)
754{
755 WARN_ON_ONCE(old->tr_attached != 1);
756
757 old->tr_num_buf_new += new->tr_num_buf_new;
758 old->tr_num_databuf_new += new->tr_num_databuf_new;
759 old->tr_num_buf_rm += new->tr_num_buf_rm;
760 old->tr_num_databuf_rm += new->tr_num_databuf_rm;
761 old->tr_num_revoke += new->tr_num_revoke;
762 old->tr_num_revoke_rm += new->tr_num_revoke_rm;
763
764 list_splice_tail_init(&new->tr_databuf, &old->tr_databuf);
765 list_splice_tail_init(&new->tr_buf, &old->tr_buf);
766}
767
747static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) 768static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
748{ 769{
749 unsigned int reserved; 770 unsigned int reserved;
@@ -766,8 +787,9 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
766 sdp->sd_jdesc->jd_blocks); 787 sdp->sd_jdesc->jd_blocks);
767 sdp->sd_log_blks_reserved = reserved; 788 sdp->sd_log_blks_reserved = reserved;
768 789
769 if (sdp->sd_log_tr == NULL && 790 if (sdp->sd_log_tr) {
770 (tr->tr_num_buf_new || tr->tr_num_databuf_new)) { 791 gfs2_merge_trans(sdp->sd_log_tr, tr);
792 } else if (tr->tr_num_buf_new || tr->tr_num_databuf_new) {
771 gfs2_assert_withdraw(sdp, tr->tr_t_gh.gh_gl); 793 gfs2_assert_withdraw(sdp, tr->tr_t_gh.gh_gl);
772 sdp->sd_log_tr = tr; 794 sdp->sd_log_tr = tr;
773 tr->tr_attached = 1; 795 tr->tr_attached = 1;