All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Christoph Hellwig <hch@infradead.org>, Neil Brown <neilb@suse.de>,
	nfs@lists.sourceforge.net, linux-kernel@vger.kernel.org,
	Christoph Hellwig <hch@lst.de>
Subject: [PATCH 006 of 8] knfsd: exportfs: move acceptable check into find_acceptable_alias
Date: Tue, 15 May 2007 17:16:43 +1000	[thread overview]
Message-ID: <1070515071643.16331@suse.de> (raw)
In-Reply-To: 20070515170405.15621.patches@notabene


From: Christoph Hellwig <hch@infradead.org>

All callers of find_acceptable_alias check if the current dentry
is acceptable before looking for other acceptable aliases using
find_acceptable_alias.  Move the check into find_acceptable_alias
to make the code a little more dense and add a comment to
find_acceptable_alias that documents its intent.


Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./fs/exportfs/expfs.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff .prev/fs/exportfs/expfs.c ./fs/exportfs/expfs.c
--- .prev/fs/exportfs/expfs.c	2007-05-14 11:15:37.000000000 +1000
+++ ./fs/exportfs/expfs.c	2007-05-14 11:15:46.000000000 +1000
@@ -37,6 +37,9 @@ static int exportfs_get_name(struct dent
 		return get_name(dir, name, child);
 }
 
+/*
+ * Check if the dentry or any of it's aliases is acceptable.
+ */
 static struct dentry *
 find_acceptable_alias(struct dentry *result,
 		int (*acceptable)(void *context, struct dentry *dentry),
@@ -44,6 +47,9 @@ find_acceptable_alias(struct dentry *res
 {
 	struct dentry *dentry, *toput = NULL;
 
+	if (acceptable(context, result))
+		return result;
+
 	spin_lock(&dcache_lock);
 	list_for_each_entry(dentry, &result->d_inode->i_dentry, d_alias) {
 		dget_locked(dentry);
@@ -126,9 +132,6 @@ find_exported_dentry(struct super_block 
 
 		target_dir = dget(result);
 	} else {
-		if (acceptable(context, result))
-			return result;
-
 		alias = find_acceptable_alias(result, acceptable, context);
 		if (alias)
 			return alias;
@@ -289,9 +292,6 @@ find_exported_dentry(struct super_block 
 		}
 	}
 	dput(target_dir);
-	/* now result is properly connected, it is our best bet */
-	if (acceptable(context, result))
-		return result;
 
 	alias = find_acceptable_alias(result, acceptable, context);
 	if (alias)

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

WARNING: multiple messages have this Message-ID (diff)
From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: nfs@lists.sourceforge.net, linux-kernel@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Neil Brown <neilb@suse.de>
Subject: [PATCH 006 of 8] knfsd: exportfs: move acceptable check into find_acceptable_alias
Date: Tue, 15 May 2007 17:16:43 +1000	[thread overview]
Message-ID: <1070515071643.16331@suse.de> (raw)
In-Reply-To: 20070515170405.15621.patches@notabene


From: Christoph Hellwig <hch@infradead.org>

All callers of find_acceptable_alias check if the current dentry
is acceptable before looking for other acceptable aliases using
find_acceptable_alias.  Move the check into find_acceptable_alias
to make the code a little more dense and add a comment to
find_acceptable_alias that documents its intent.


Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./fs/exportfs/expfs.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff .prev/fs/exportfs/expfs.c ./fs/exportfs/expfs.c
--- .prev/fs/exportfs/expfs.c	2007-05-14 11:15:37.000000000 +1000
+++ ./fs/exportfs/expfs.c	2007-05-14 11:15:46.000000000 +1000
@@ -37,6 +37,9 @@ static int exportfs_get_name(struct dent
 		return get_name(dir, name, child);
 }
 
+/*
+ * Check if the dentry or any of it's aliases is acceptable.
+ */
 static struct dentry *
 find_acceptable_alias(struct dentry *result,
 		int (*acceptable)(void *context, struct dentry *dentry),
@@ -44,6 +47,9 @@ find_acceptable_alias(struct dentry *res
 {
 	struct dentry *dentry, *toput = NULL;
 
+	if (acceptable(context, result))
+		return result;
+
 	spin_lock(&dcache_lock);
 	list_for_each_entry(dentry, &result->d_inode->i_dentry, d_alias) {
 		dget_locked(dentry);
@@ -126,9 +132,6 @@ find_exported_dentry(struct super_block 
 
 		target_dir = dget(result);
 	} else {
-		if (acceptable(context, result))
-			return result;
-
 		alias = find_acceptable_alias(result, acceptable, context);
 		if (alias)
 			return alias;
@@ -289,9 +292,6 @@ find_exported_dentry(struct super_block 
 		}
 	}
 	dput(target_dir);
-	/* now result is properly connected, it is our best bet */
-	if (acceptable(context, result))
-		return result;
 
 	alias = find_acceptable_alias(result, acceptable, context);
 	if (alias)

  parent reply	other threads:[~2007-05-15  7:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-15  7:15 [PATCH 000 of 8] knfsd: cleanups for exportfs code NeilBrown
2007-05-15  7:16 ` [PATCH 001 of 8] knfsd: exportfs: add exportfs.h header NeilBrown
2007-05-15  7:16   ` NeilBrown
2007-05-15  7:16 ` [PATCH 002 of 8] knfsd: exportfs: remove iget abuse NeilBrown
2007-05-15  7:16   ` NeilBrown
2007-05-15 12:30   ` Dave Kleikamp
2007-05-15  7:16 ` [PATCH 003 of 8] knfsd: exportfs: add procedural interface for NFSD NeilBrown
2007-05-15  7:16   ` NeilBrown
2007-05-15  7:16 ` [PATCH 004 of 8] knfsd: exportfs: remove CALL macro NeilBrown
2007-05-15  7:16   ` NeilBrown
2007-05-15  7:16 ` [PATCH 005 of 8] knfsd: exportfs: untangle ISDIR logic in find_exported_dentry NeilBrown
2007-05-15  7:16 ` NeilBrown [this message]
2007-05-15  7:16   ` [PATCH 006 of 8] knfsd: exportfs: move acceptable check into find_acceptable_alias NeilBrown
2007-05-15  7:16 ` [PATCH 007 of 8] knfsd: exportfs: add find_disconnected_root helper NeilBrown
2007-05-15  7:16   ` NeilBrown
2007-05-15  7:16 ` [PATCH 008 of 8] knfsd: exportfs: split out reconnecting a dentry from find_exported_dentry NeilBrown
2007-05-15  7:16   ` NeilBrown

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=1070515071643.16331@suse.de \
    --to=neilb@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nfs@lists.sourceforge.net \
    /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.