cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 7/8] GFS2: Reduce contention on gfs2_log_lock
Date: Mon, 20 Feb 2017 08:44:29 -0500	[thread overview]
Message-ID: <20170220134430.5021-8-rpeterso@redhat.com> (raw)
In-Reply-To: <20170220134430.5021-1-rpeterso@redhat.com>

This patch modifies functions gfs2_trans_add_meta and _data so that
they check whether the buffer_head is already in a transaction,
and if so, avoid taking the gfs2_log_lock.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
 fs/gfs2/trans.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index 483c5a7..affef3c 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -170,6 +170,10 @@ void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh)
 	}
 
 	lock_buffer(bh);
+	if (buffer_pinned(bh)) {
+		set_bit(TR_TOUCHED, &tr->tr_flags);
+		goto out;
+	}
 	gfs2_log_lock(sdp);
 	bd = bh->b_private;
 	if (bd == NULL) {
@@ -192,6 +196,7 @@ void gfs2_trans_add_data(struct gfs2_glock *gl, struct buffer_head *bh)
 		list_add_tail(&bd->bd_list, &tr->tr_databuf);
 	}
 	gfs2_log_unlock(sdp);
+out:
 	unlock_buffer(bh);
 }
 
@@ -201,10 +206,14 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
 	struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
 	struct gfs2_bufdata *bd;
 	struct gfs2_meta_header *mh;
-	struct gfs2_trans *tr;
+	struct gfs2_trans *tr = current->journal_info;
 	enum gfs2_freeze_state state = atomic_read(&sdp->sd_freeze_state);
 
 	lock_buffer(bh);
+	if (buffer_pinned(bh)) {
+		set_bit(TR_TOUCHED, &tr->tr_flags);
+		goto out;
+	}
 	gfs2_log_lock(sdp);
 	bd = bh->b_private;
 	if (bd == NULL) {
@@ -220,7 +229,6 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
 		gfs2_log_lock(sdp);
 	}
 	gfs2_assert(sdp, bd->bd_gl == gl);
-	tr = current->journal_info;
 	set_bit(TR_TOUCHED, &tr->tr_flags);
 	if (!list_empty(&bd->bd_list))
 		goto out_unlock;
@@ -243,6 +251,7 @@ void gfs2_trans_add_meta(struct gfs2_glock *gl, struct buffer_head *bh)
 	tr->tr_num_buf_new++;
 out_unlock:
 	gfs2_log_unlock(sdp);
+out:
 	unlock_buffer(bh);
 }
 
-- 
2.9.3



  parent reply	other threads:[~2017-02-20 13:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-20 13:44 [Cluster-devel] [PATCH 0/8] GFS2: Pre-pull patch posting (merge window) Bob Peterson
2017-02-20 13:44 ` [Cluster-devel] [PATCH 1/8] GFS2: Fix reference to ERR_PTR in gfs2_glock_iter_next Bob Peterson
2017-02-20 13:44 ` [Cluster-devel] [PATCH 2/8] GFS2: Limit number of transaction blocks requested for truncates Bob Peterson
2017-02-20 13:44 ` [Cluster-devel] [PATCH 3/8] GFS2: Made logd daemon take into account log demand Bob Peterson
2017-02-20 13:44 ` [Cluster-devel] [PATCH 4/8] GFS2: Wake up io waiters whenever a flush is done Bob Peterson
2017-02-20 13:44 ` [Cluster-devel] [PATCH 5/8] GFS2: Switch tr_touched to flag in transaction Bob Peterson
2017-02-20 13:44 ` [Cluster-devel] [PATCH 6/8] GFS2: Inline function meta_lo_add Bob Peterson
2017-02-20 13:44 ` Bob Peterson [this message]
2017-02-20 13:44 ` [Cluster-devel] [PATCH 8/8] gfs2: Make gfs2_write_full_page static Bob Peterson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170220134430.5021-8-rpeterso@redhat.com \
    --to=rpeterso@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).