public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "J.A. Magallon" <jamagallon@able.es>
To: Christoph Hellwig <hch@infradead.org>
Cc: Marcelo Tosatti <marcelo@conectiva.com.br>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] d_alloc_anon for 2.4.21-pre6
Date: Thu, 27 Mar 2003 23:25:59 +0100	[thread overview]
Message-ID: <20030327222559.GA3420@werewolf.able.es> (raw)
In-Reply-To: <20030327165112.A2395@infradead.org>; from hch@infradead.org on Thu, Mar 27, 2003 at 17:51:12 +0100


On 03.27, Christoph Hellwig wrote:
> [$BIGNUM repost since August 2002, still zero feedback]
> 
> The rewritten 2.5 nfsd export handling introduce a funcion,
> d_alloc_anon, to get an dentry for a given inode, either taking
> a well-connected one or allocating a new one.
> 
> In 2.4 we have the functionality that it does in 2.4 duplicated over
> nfsd and all filesystems having their own fh_to_dentry method, and
> XFS needs even more instances of this for other handle to dentry
> conversations.
> 
> This patch adds d_alloc_anon with exactly the same API as in 2.5, but
> the 2.4ish functionality instead to the kernel and switches nfsd, fat
> and reiserfs over to it.
> 

The patch I had from time ago in -jam also included this switch to
list_for_each:

diff -uNr -Xdontdiff -p linux-2.4.20-pre4/fs/dcache.c linux/fs/dcache.c
--- linux-2.4.20-pre4/fs/dcache.c	Sat Aug 17 14:54:38 2002
+++ linux/fs/dcache.c	Tue Aug 20 11:39:48 2002
@@ -247,24 +247,22 @@ struct dentry * dget_locked(struct dentr
 
 struct dentry * d_find_alias(struct inode *inode)
 {
-	struct list_head *head, *next, *tmp;
-	struct dentry *alias;
+	struct dentry *dentry;
+	struct list_head *p;
 
 	spin_lock(&dcache_lock);
-	head = &inode->i_dentry;
-	next = inode->i_dentry.next;
-	while (next != head) {
-		tmp = next;
-		next = tmp->next;
-		alias = list_entry(tmp, struct dentry, d_alias);
-		if (!list_empty(&alias->d_hash)) {
-			__dget_locked(alias);
-			spin_unlock(&dcache_lock);
-			return alias;
-		}
+	list_for_each(p, &inode->i_dentry) {
+		dentry = list_entry(p, struct dentry, d_alias);
+		if (!list_empty(&dentry->d_hash))
+			goto found;
 	}
 	spin_unlock(&dcache_lock);
 	return NULL;
+
+found:
+	__dget_locked(dentry);
+	spin_unlock(&dcache_lock);
+	return dentry;
 }
 
 /*

-- 
J.A. Magallon <jamagallon@able.es>      \                 Software is like sex:
werewolf.able.es                         \           It's better when it's free
Mandrake Linux release 9.1 (Bamboo) for i586
Linux 2.4.21-pre5-jam1 (gcc 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk))

  reply	other threads:[~2003-03-27 22:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-27  0:08 Linux 2.4.21-pre6 Marcelo Tosatti
2003-03-27  1:50 ` [BK] Bluetooth updates for 2.4.21-pre6 Max Krasnyansky
2003-03-27  1:53   ` Johannes Erdfelt
2003-03-27 17:32     ` Max Krasnyansky
2003-03-27  7:53 ` Linux 2.4.21-pre6 Roger Luethi
2003-03-27 13:49   ` Jeff Garzik
2003-03-27  8:48 ` Christoph Hellwig
2003-03-27 10:10   ` mdew
2003-03-27 19:18   ` Linus Torvalds
2003-03-27 10:42 ` Geert Uytterhoeven
2003-03-27 11:56   ` Alan Cox
2003-03-27 12:01   ` Jan Knutar
2003-03-27 12:50     ` Jens Axboe
2003-03-27 13:56     ` DervishD
2003-03-27 11:47 ` Meelis Roos
2003-03-27 10:45   ` Bas Vermeulen
2003-03-27 14:12     ` Jörn Engel
2003-03-27 16:25 ` Stephan von Krawczynski
2003-03-27 16:51 ` [PATCH] d_alloc_anon for 2.4.21-pre6 Christoph Hellwig
2003-03-27 22:25   ` J.A. Magallon [this message]
2003-03-27 22:30     ` Christoph Hellwig
2003-03-27 20:41 ` [2.4 patch] fix multiple definitions of ipv6_ext_hdr Adrian Bunk
2003-03-27 20:42   ` David S. Miller
2003-03-28  1:59 ` [PATCH] alpha ptrace fix Re: Linux 2.4.21-pre6 Tom Vier
2003-03-31 18:16 ` Alvaro Figueroa
2003-03-31 18:35   ` Alan Cox

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=20030327222559.GA3420@werewolf.able.es \
    --to=jamagallon@able.es \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    /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