All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 2/4] pnfs add a common GETDEVICELIST implementation
Date: Mon, 11 Aug 2014 22:06:55 +0200	[thread overview]
Message-ID: <1407787617-26050-3-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1407787617-26050-1-git-send-email-hch@lst.de>

At a simple helper to issue a GETDEVICELIST operation and pre-load
the device id cache based on the result.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/nfs/pnfs.h     |  2 ++
 fs/nfs/pnfs_dev.c | 28 ++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index e145b79..ba468e2 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -274,6 +274,8 @@ bool nfs4_put_deviceid_node(struct nfs4_deviceid_node *);
 void nfs4_mark_deviceid_unavailable(struct nfs4_deviceid_node *node);
 bool nfs4_test_deviceid_unavailable(struct nfs4_deviceid_node *node);
 void nfs4_deviceid_purge_client(const struct nfs_client *);
+int nfs4_deviceid_getdevicelist(struct nfs_server *server,
+		const struct nfs_fh *fh);
 
 static inline struct pnfs_layout_segment *
 pnfs_get_lseg(struct pnfs_layout_segment *lseg)
diff --git a/fs/nfs/pnfs_dev.c b/fs/nfs/pnfs_dev.c
index e3d4fa9..a30e6b2 100644
--- a/fs/nfs/pnfs_dev.c
+++ b/fs/nfs/pnfs_dev.c
@@ -356,3 +356,31 @@ nfs4_deviceid_mark_client_invalid(struct nfs_client *clp)
 	rcu_read_unlock();
 }
 
+int
+nfs4_deviceid_getdevicelist(struct nfs_server *server,
+		const struct nfs_fh *fh)
+{
+	struct pnfs_devicelist *dlist;
+	struct nfs4_deviceid_node *d;
+	int error = 0, i;
+
+	dlist = kzalloc(sizeof(struct pnfs_devicelist), GFP_NOFS);
+	if (!dlist)
+		return -ENOMEM;
+
+	while (!dlist->eof) {
+		error = nfs4_proc_getdevicelist(server, fh, dlist);
+		if (error)
+			break;
+
+		for (i = 0; i < dlist->num_devs; i++) {
+			d = nfs4_find_get_deviceid(server, &dlist->dev_id[i],
+					NULL, GFP_NOFS);
+			if (d)
+				nfs4_put_deviceid_node(d);
+		}
+	}
+
+	return error;
+}
+EXPORT_SYMBOL_GPL(nfs4_deviceid_getdevicelist);
-- 
1.9.1


  parent reply	other threads:[~2014-08-11 20:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-11 20:06 pnfs: factor GETDEVICEINFO implementations Christoph Hellwig
2014-08-11 20:06 ` [PATCH 1/4] " Christoph Hellwig
2014-08-12 11:36   ` Boaz Harrosh
2014-08-12 12:21     ` Christoph Hellwig
2014-08-12 12:33       ` Boaz Harrosh
2014-08-12 15:53       ` Christoph Hellwig
2014-08-21 14:46     ` Christoph Hellwig
2014-08-21 16:39       ` Boaz Harrosh
2014-08-11 20:06 ` Christoph Hellwig [this message]
2014-08-11 20:06 ` [PATCH 3/4] pnfs: add a nfs4_get_deviceid helper Christoph Hellwig
2014-08-11 20:06 ` [PATCH 4/4] pnfs/blocklayout: use the device id cache Christoph Hellwig
2014-08-12  9:35 ` pnfs: factor GETDEVICEINFO implementations Boaz Harrosh
2014-08-12  9:52   ` Christoph Hellwig
2014-08-12 10:57     ` Boaz Harrosh
2014-09-03  4:27 pnfs: factor GETDEVICEINFO implementations V2 Christoph Hellwig
2014-09-03  4:27 ` [PATCH 2/4] pnfs: add a common GETDEVICELIST implementation Christoph Hellwig
2014-09-03 18:57   ` Anna Schumaker
2014-09-03 23:34     ` Christoph Hellwig

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=1407787617-26050-3-git-send-email-hch@lst.de \
    --to=hch@lst.de \
    --cc=linux-nfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.