* [PATCH] Btrfs: simplify iteration codes
@ 2009-01-16 7:25 Qinghuang Feng
2009-01-16 12:50 ` Qinghuang Feng
2009-01-16 14:31 ` Chris Mason
0 siblings, 2 replies; 5+ messages in thread
From: Qinghuang Feng @ 2009-01-16 7:25 UTC (permalink / raw)
To: chris.mason; +Cc: linux-kernel, linux-btrfs
merge list_for_each and list_entry to list_for_each_entry.
Signed-off-by: Qinghuang Feng <qhfeng.kernel@gmail.com>
---
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index b187b53..70f0248 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -104,10 +104,8 @@ static noinline struct btrfs_device *__find_device(struct list_head *head,
u64 devid, u8 *uuid)
{
struct btrfs_device *dev;
- struct list_head *cur;
- list_for_each(cur, head) {
- dev = list_entry(cur, struct btrfs_device, dev_list);
+ list_for_each_entry(dev, head, dev_list) {
if (dev->devid == devid &&
(!uuid || !memcmp(dev->uuid, uuid, BTRFS_UUID_SIZE))) {
return dev;
@@ -118,11 +116,9 @@ static noinline struct btrfs_device *__find_device(struct list_head *head,
static noinline struct btrfs_fs_devices *find_fsid(u8 *fsid)
{
- struct list_head *cur;
struct btrfs_fs_devices *fs_devices;
- list_for_each(cur, &fs_uuids) {
- fs_devices = list_entry(cur, struct btrfs_fs_devices, list);
+ list_for_each_entry(fs_devices, &fs_uuids, list) {
if (memcmp(fsid, fs_devices->fsid, BTRFS_FSID_SIZE) == 0)
return fs_devices;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Btrfs: simplify iteration codes
2009-01-16 7:25 [PATCH] Btrfs: simplify iteration codes Qinghuang Feng
@ 2009-01-16 12:50 ` Qinghuang Feng
2009-01-16 14:31 ` Chris Mason
1 sibling, 0 replies; 5+ messages in thread
From: Qinghuang Feng @ 2009-01-16 12:50 UTC (permalink / raw)
To: chris.mason; +Cc: linux-kernel, linux-btrfs
On Fri, Jan 16, 2009 at 3:25 PM, Qinghuang Feng <qhfeng.kernel@gmail.com> wrote:
> merge list_for_each and list_entry to list_for_each_entry.
>
Please ignore this patch, I will resend a patch to cleanup all the
similar codes in btrfs.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Btrfs: simplify iteration codes
2009-01-16 7:25 [PATCH] Btrfs: simplify iteration codes Qinghuang Feng
2009-01-16 12:50 ` Qinghuang Feng
@ 2009-01-16 14:31 ` Chris Mason
2009-01-16 15:20 ` sniper
1 sibling, 1 reply; 5+ messages in thread
From: Chris Mason @ 2009-01-16 14:31 UTC (permalink / raw)
To: Qinghuang Feng; +Cc: linux-kernel, linux-btrfs
On Fri, 2009-01-16 at 15:25 +0800, Qinghuang Feng wrote:
> merge list_for_each and list_entry to list_for_each_entry.
>
Thanks, I've queued this up.
-chris
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Btrfs: simplify iteration codes
2009-01-16 14:31 ` Chris Mason
@ 2009-01-16 15:20 ` sniper
2009-01-16 15:23 ` Chris Mason
0 siblings, 1 reply; 5+ messages in thread
From: sniper @ 2009-01-16 15:20 UTC (permalink / raw)
To: Chris Mason; +Cc: Qinghuang Feng, linux-kernel, linux-btrfs
On Fri, Jan 16, 2009 at 10:31 PM, Chris Mason <chris.mason@oracle.com> wrote:
> On Fri, 2009-01-16 at 15:25 +0800, Qinghuang Feng wrote:
>> merge list_for_each and list_entry to list_for_each_entry.
>>
>
> Thanks, I've queued this up.
>
Good, but....
Now I have made a new patch for cleanupping all the similar codes in btrfs.
This patch has been tested in VM, it seems ok.
Now should I rebuild another patch which based the previous patch,
or could you be able to reverse the previous patch then I just post
this new patch including all stuff?
Sorry I am not much familiar with the posting flow, and I am not sure
the meaning of "queued".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Btrfs: simplify iteration codes
2009-01-16 15:20 ` sniper
@ 2009-01-16 15:23 ` Chris Mason
0 siblings, 0 replies; 5+ messages in thread
From: Chris Mason @ 2009-01-16 15:23 UTC (permalink / raw)
To: sniper; +Cc: Qinghuang Feng, linux-kernel, linux-btrfs
On Fri, 2009-01-16 at 23:20 +0800, sniper wrote:
> On Fri, Jan 16, 2009 at 10:31 PM, Chris Mason <chris.mason@oracle.com> wrote:
> > On Fri, 2009-01-16 at 15:25 +0800, Qinghuang Feng wrote:
> >> merge list_for_each and list_entry to list_for_each_entry.
> >>
> >
> > Thanks, I've queued this up.
> >
> Good, but....
>
> Now I have made a new patch for cleanupping all the similar codes in btrfs.
> This patch has been tested in VM, it seems ok.
>
> Now should I rebuild another patch which based the previous patch,
> or could you be able to reverse the previous patch then I just post
> this new patch including all stuff?
>
> Sorry I am not much familiar with the posting flow, and I am not sure
> the meaning of "queued".
It means this one looks right and I've put it into my internal testing
tree. It should be in my next pull request.
But, I'll hold off on this one if there is a larger set of fixes coming
that contain it.
-chris
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-01-16 15:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-16 7:25 [PATCH] Btrfs: simplify iteration codes Qinghuang Feng
2009-01-16 12:50 ` Qinghuang Feng
2009-01-16 14:31 ` Chris Mason
2009-01-16 15:20 ` sniper
2009-01-16 15:23 ` Chris Mason
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox