[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4F505937.9080904@cn.fujitsu.com>
Date: Fri, 02 Mar 2012 13:23:03 +0800
From: Li Zefan <lizf@...fujitsu.com>
To: Hillf Danton <dhillf@...il.com>
CC: Tejun Heo <tj@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Lennart Poettering <mzxreary@...inter.de>,
Kay Sievers <kay.sievers@...y.org>,
Hugh Dickins <hughd@...gle.com>,
LKML <linux-kernel@...r.kernel.org>,
Cgroups <cgroups@...r.kernel.org>, Eric Paris <eparis@...hat.com>
Subject: Re: [PATCH v2 1/3] xattr: extract kmem_xattr code from tmpfs
Hillf Danton wrote:
> On Thu, Mar 1, 2012 at 2:17 PM, Li Zefan <lizf@...fujitsu.com> wrote:
>> +/*
>> + * free all the xattrs
>> + */
>> +void kmem_xattrs_free(struct kmem_xattrs *xattrs)
>> +{
>> + struct kmem_xattr *xattr, *node;
>> +
>> + spin_lock(&xattrs->lock);
>> + list_for_each_entry_safe(xattr, node, &xattrs->head, list) {
>> + kfree(xattr->name);
>> + kfree(xattr);
>> + }
>> + spin_unlock(&xattrs->lock);
>
> In your work it is a library function, operations on &xattrs->head
> are no longer allowed, say list_empty(), after it called, though I
> dunno if such operations exist.
>
I'd prefer to make it safer to use, so I'll re-init the list head
after freeing all the list items.
> And kmem_xattrs is too close to kmem_xattr, kmem_xattr_list
> is not pron of typo.
>
Then you won't pass compile. ;)
kmem_xattr_list exposed the data structure we used internally.
We might change to use an rbtree.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists