cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 01/10] GFS2: Separate LRU scanning from shrinker
Date: Tue, 19 Feb 2013 10:07:31 +0000	[thread overview]
Message-ID: <1361268460-3092-2-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1361268460-3092-1-git-send-email-swhiteho@redhat.com>

This breaks out the LRU scanning function from the shrinker in
preparation for adding other callers to the LRU scanner.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 992c5c0..3ad8fd3 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1376,23 +1376,19 @@ void gfs2_glock_complete(struct gfs2_glock *gl, int ret)
 		gfs2_glock_put(gl);
 }
 
+/**
+ * gfs2_scan_glock_lru - Scan the LRU looking for locks to demote
+ * @nr: The number of entries to scan
+ *
+ */
 
-static int gfs2_shrink_glock_memory(struct shrinker *shrink,
-				    struct shrink_control *sc)
+static void gfs2_scan_glock_lru(int nr)
 {
 	struct gfs2_glock *gl;
 	int may_demote;
 	int nr_skipped = 0;
-	int nr = sc->nr_to_scan;
-	gfp_t gfp_mask = sc->gfp_mask;
 	LIST_HEAD(skipped);
 
-	if (nr == 0)
-		goto out;
-
-	if (!(gfp_mask & __GFP_FS))
-		return -1;
-
 	spin_lock(&lru_lock);
 	while(nr && !list_empty(&lru_list)) {
 		gl = list_entry(lru_list.next, struct gfs2_glock, gl_lru);
@@ -1425,7 +1421,17 @@ static int gfs2_shrink_glock_memory(struct shrinker *shrink,
 	list_splice(&skipped, &lru_list);
 	atomic_add(nr_skipped, &lru_count);
 	spin_unlock(&lru_lock);
-out:
+}
+
+static int gfs2_shrink_glock_memory(struct shrinker *shrink,
+				    struct shrink_control *sc)
+{
+	if (sc->nr_to_scan) {
+		if (!(sc->gfp_mask & __GFP_FS))
+			return -1;
+		gfs2_scan_glock_lru(sc->nr_to_scan);
+	}
+
 	return (atomic_read(&lru_count) / 100) * sysctl_vfs_cache_pressure;
 }
 
-- 
1.7.4



  reply	other threads:[~2013-02-19 10:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-19 10:07 [Cluster-devel] GFS2: Pre-pull patch posting (merge window) Steven Whitehouse
2013-02-19 10:07 ` Steven Whitehouse [this message]
2013-02-19 10:07 ` [Cluster-devel] [PATCH 02/10] GFS2: Merge revoke adding functions Steven Whitehouse
2013-02-19 10:07 ` [Cluster-devel] [PATCH 03/10] GFS2: Split gfs2_trans_add_bh() into two Steven Whitehouse
2013-02-19 10:07 ` [Cluster-devel] [PATCH 04/10] GFS2: Copy gfs2_trans_add_bh into new data/meta functions Steven Whitehouse
2013-02-19 10:07 ` [Cluster-devel] [PATCH 05/10] GFS2: Merge gfs2_attach_bufdata() into trans.c Steven Whitehouse
2013-02-19 10:07 ` [Cluster-devel] [PATCH 06/10] GFS2: Clean up freeze code Steven Whitehouse
2013-02-19 10:07 ` [Cluster-devel] [PATCH 07/10] GFS2: Use ->writepages for ordered writes Steven Whitehouse
2013-02-19 10:07 ` [Cluster-devel] [PATCH 08/10] GFS2: Split glock lru processing into two parts Steven Whitehouse
2013-02-19 10:07 ` [Cluster-devel] [PATCH 09/10] GFS2: Get a block reservation before resizing a file Steven Whitehouse
2013-02-19 10:07 ` [Cluster-devel] [PATCH 10/10] GFS2: Reinstate withdraw ack system Steven Whitehouse

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=1361268460-3092-2-git-send-email-swhiteho@redhat.com \
    --to=swhiteho@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).