From: Fred Isaman <iisaman@netapp.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 4/4] pnfs-submit: move get_lseg into pnfs_has_layout, and rename
Date: Mon, 15 Nov 2010 14:00:38 -0500 [thread overview]
Message-ID: <1289847638-12175-4-git-send-email-iisaman@netapp.com> (raw)
In-Reply-To: <1289847638-12175-1-git-send-email-iisaman@netapp.com>
rename pnfs_has_layout to pnfs_find_lseg, and move get_lseg into
the function, only returning valid lsegs. Additionally, make the
function static, as it now has only a single caller.
Signed-off-by: Fred Isaman <iisaman@netapp.com>
---
fs/nfs/pnfs.c | 26 +++++++-------------------
fs/nfs/pnfs.h | 2 --
2 files changed, 7 insertions(+), 21 deletions(-)
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index d06bf16..a21debe 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -860,8 +860,8 @@ is_matching_lseg(struct pnfs_layout_segment *lseg,
/*
* lookup range in layout
*/
-struct pnfs_layout_segment *
-pnfs_has_layout(struct pnfs_layout_hdr *lo,
+static struct pnfs_layout_segment *
+pnfs_find_lseg(struct pnfs_layout_hdr *lo,
struct pnfs_layout_range *range)
{
struct pnfs_layout_segment *lseg, *ret = NULL;
@@ -870,7 +870,8 @@ pnfs_has_layout(struct pnfs_layout_hdr *lo,
assert_spin_locked(&lo->inode->i_lock);
list_for_each_entry(lseg, &lo->segs, fi_list) {
- if (is_matching_lseg(lseg, range)) {
+ if (lseg->valid && is_matching_lseg(lseg, range)) {
+ get_lseg(lseg);
ret = lseg;
break;
}
@@ -913,22 +914,9 @@ pnfs_update_layout(struct inode *ino,
}
/* Check to see if the layout for the given range already exists */
- lseg = pnfs_has_layout(lo, &arg);
- if (lseg) {
- if (lseg->valid) {
- dprintk("%s: Using cached lseg %p for %llu@%llu "
- "iomode %d)\n",
- __func__,
- lseg,
- arg.length,
- arg.offset,
- arg.iomode);
- get_lseg(lseg);
- goto out_unlock;
- }
- /* someone is cleaning the layout */
- lseg = NULL;
- }
+ lseg = pnfs_find_lseg(lo, &arg);
+ if (lseg)
+ goto out_unlock;
/* if LAYOUTGET already failed once we don't try again */
if (test_bit(lo_fail_bit(iomode), &nfsi->layout->plh_flags))
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 3314f64..12fe7ab 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -199,8 +199,6 @@ void put_lseg(struct pnfs_layout_segment *lseg);
bool should_free_lseg(struct pnfs_layout_range *lseg_range,
struct pnfs_layout_range *recall_range);
struct pnfs_layout_segment *
-pnfs_has_layout(struct pnfs_layout_hdr *lo, struct pnfs_layout_range *range);
-struct pnfs_layout_segment *
pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx,
enum pnfs_iomode access_type);
bool pnfs_return_layout_barrier(struct nfs_inode *, struct pnfs_layout_range *);
--
1.7.2.1
next prev parent reply other threads:[~2010-11-15 19:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-15 19:00 [PATCH 1/4] pnfs-submit: remove unused stateid argument from pnfs_return_layout Fred Isaman
2010-11-15 19:00 ` [PATCH 2/4] pnfs-submit: remove type " Fred Isaman
2010-11-15 19:00 ` [PATCH 3/4] pnfs-submit: remove has_layout_to_return() Fred Isaman
2010-11-15 19:00 ` Fred Isaman [this message]
2010-11-17 17:27 ` [PATCH 1/4] pnfs-submit: remove unused stateid argument from pnfs_return_layout Benny Halevy
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=1289847638-12175-4-git-send-email-iisaman@netapp.com \
--to=iisaman@netapp.com \
--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 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).