lkml.org 
[lkml]   [2003]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH] d_alloc_anon for 2.4.21-pre6

    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))
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:34    [W:2.953 / U:0.976 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site