From: Peng Tao <bergwolf@gmail.com>
To: linux-nfs@vger.kernel.org
Cc: Trond.Myklebust@netapp.com, bhalevy@tonian.com,
Peng Tao <peng_tao@emc.com>
Subject: [PATCH RFC 2/4] nfsv41: add and export pnfs_find_get_layout_locked
Date: Sat, 19 Nov 2011 08:53:14 -0800 [thread overview]
Message-ID: <1321721596-3293-3-git-send-email-bergwolf@gmail.com> (raw)
In-Reply-To: <1321721596-3293-1-git-send-email-bergwolf@gmail.com>
It tries to find the lseg from local cache but not retrive layout from server.
Signed-off-by: Peng Tao <peng_tao@emc.com>
---
fs/nfs/pnfs.c | 25 +++++++++++++++++++++++++
fs/nfs/pnfs.h | 5 +++++
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 3be29c7..734e670 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -933,6 +933,31 @@ pnfs_find_lseg(struct pnfs_layout_hdr *lo,
}
/*
+ * Find and reference lseg with ino->i_lock held.
+ */
+struct pnfs_layout_segment *
+pnfs_find_get_layout_locked(struct inode *ino,
+ loff_t pos,
+ u64 count,
+ enum pnfs_iomode iomode)
+{
+ struct pnfs_layout_segment *lseg = NULL;
+ struct pnfs_layout_range range = {
+ .iomode = iomode,
+ .offset = pos,
+ .length = count,
+ };
+
+ if (NFS_I(ino)->layout == NULL)
+ goto out;
+
+ lseg = pnfs_find_lseg(NFS_I(ino)->layout, &range);
+out:
+ return lseg;
+}
+EXPORT_SYMBOL_GPL(pnfs_find_get_layout_locked);
+
+/*
* Layout segment is retreived from the server if not cached.
* The appropriate layout segment is referenced and returned to the caller.
*/
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 9614ac9..0c55fc1 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -213,6 +213,11 @@ struct pnfs_layout_hdr *
pnfs_find_alloc_layout(struct inode *ino,
struct nfs_open_context *ctx,
gfp_t gfp_flags);
+struct pnfs_layout_segment *
+pnfs_find_get_layout_locked(struct inode *ino,
+ loff_t pos,
+ u64 count,
+ enum pnfs_iomode iomode);
void nfs4_deviceid_mark_client_invalid(struct nfs_client *clp);
--
1.7.1.262.g5ef3d
next prev parent reply other threads:[~2011-11-19 16:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-19 16:53 [PATCH RFC 0/4] nfsv41/pnfsblock: allow block client not to layoutget in pg_init Peng Tao
2011-11-19 16:53 ` [PATCH RFC 1/4] nfsv41: export pnfs_find_alloc_layout Peng Tao
2011-11-19 16:53 ` Peng Tao [this message]
2011-11-19 16:53 ` [PATCH RFC 3/4] nfsv41: get lseg before issue LD IO if pgio doesn't carry one Peng Tao
2011-11-19 16:53 ` [PATCH RFC 4/4] pnfsblock: do ask for layout in pg_init Peng Tao
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=1321721596-3293-3-git-send-email-bergwolf@gmail.com \
--to=bergwolf@gmail.com \
--cc=Trond.Myklebust@netapp.com \
--cc=bhalevy@tonian.com \
--cc=linux-nfs@vger.kernel.org \
--cc=peng_tao@emc.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 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.