All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
To: Hillf Danton <dhillf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	Lennart Poettering
	<mzxreary-uLTowLwuiw4b1SvskN2V4Q@public.gmane.org>,
	Kay Sievers <kay.sievers-tD+1rO4QERM@public.gmane.org>,
	Hugh Dickins <hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Cgroups <cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Eric Paris <eparis-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH v2 1/3] xattr: extract kmem_xattr code from tmpfs
Date: Fri, 02 Mar 2012 13:23:03 +0800	[thread overview]
Message-ID: <4F505937.9080904@cn.fujitsu.com> (raw)
In-Reply-To: <CAJd=RBB+2r-Q8K1FQqPh90EdtAdmz3R8FWU48M_ePqyziNfcLw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hillf Danton wrote:
> On Thu, Mar 1, 2012 at 2:17 PM, Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> 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.

WARNING: multiple messages have this Message-ID (diff)
From: Li Zefan <lizf@cn.fujitsu.com>
To: Hillf Danton <dhillf@gmail.com>
Cc: Tejun Heo <tj@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Lennart Poettering <mzxreary@0pointer.de>,
	Kay Sievers <kay.sievers@vrfy.org>,
	Hugh Dickins <hughd@google.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Cgroups <cgroups@vger.kernel.org>, Eric Paris <eparis@redhat.com>
Subject: Re: [PATCH v2 1/3] xattr: extract kmem_xattr code from tmpfs
Date: Fri, 02 Mar 2012 13:23:03 +0800	[thread overview]
Message-ID: <4F505937.9080904@cn.fujitsu.com> (raw)
In-Reply-To: <CAJd=RBB+2r-Q8K1FQqPh90EdtAdmz3R8FWU48M_ePqyziNfcLw@mail.gmail.com>

Hillf Danton wrote:
> On Thu, Mar 1, 2012 at 2:17 PM, Li Zefan <lizf@cn.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.

  parent reply	other threads:[~2012-03-02  5:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-01  6:16 [PATCH v2 0/3] cgroup: add xattr support Li Zefan
2012-03-01  6:17 ` [PATCH v2 3/3] " Li Zefan
     [not found] ` <4F4F1459.4080300-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2012-03-01  6:17   ` [PATCH v2 1/3] xattr: extract kmem_xattr code from tmpfs Li Zefan
2012-03-01  6:17     ` Li Zefan
     [not found]     ` <4F4F146C.9090300-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2012-03-01 12:42       ` Hillf Danton
2012-03-01 12:42         ` Hillf Danton
     [not found]         ` <CAJd=RBB+2r-Q8K1FQqPh90EdtAdmz3R8FWU48M_ePqyziNfcLw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-03-02  5:23           ` Li Zefan [this message]
2012-03-02  5:23             ` Li Zefan
2012-03-01  6:17   ` [PATCH v2 2/3] cgroup: revise how we re-populate root directory Li Zefan
2012-03-01  6:17     ` Li Zefan
     [not found]     ` <4F4F148F.6040808-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2012-03-01 12:48       ` Hillf Danton
2012-03-01 12:48         ` Hillf Danton
     [not found]         ` <CAJd=RBAh-GzsfMiViGzKMeDV+G01K_OHZQHJ=amnp0trVhMABQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-03-02  5:49           ` Li Zefan
2012-03-02  5:49             ` Li Zefan
2012-03-04 18:05   ` [PATCH v2 0/3] cgroup: add xattr support Tejun Heo
2012-03-04 18:05     ` Tejun Heo
     [not found]     ` <20120304180516.GB20787-RcKxWJ4Cfj1J2suj2OqeGauc2jM2gXBXkQQo+JxHRPFibQn6LdNjmg@public.gmane.org>
2012-03-06 21:37       ` Hugh Dickins
2012-03-06 21:37         ` Hugh Dickins
2012-03-08  9:03       ` Li Zefan
2012-03-08  9:03         ` Li Zefan

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=4F505937.9080904@cn.fujitsu.com \
    --to=lizf-bthxqxjhjhxqfuhtdcdx3a@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dhillf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=eparis-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=kay.sievers-tD+1rO4QERM@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mzxreary-uLTowLwuiw4b1SvskN2V4Q@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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 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.