[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130121083457.GB11592@core.coreip.homeip.net>
Date: Mon, 21 Jan 2013 00:34:57 -0800
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Namjae Jeon <linkinjeon@...il.com>
Cc: Dan Carpenter <dan.carpenter@...cle.com>,
Jaegeuk Kim <jaegeuk.kim@...sung.com>,
linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [patch] f2fs: use _safe() version of list_for_each
On Mon, Jan 21, 2013 at 09:39:43AM +0900, Namjae Jeon wrote:
> 2013/1/21, Dan Carpenter <dan.carpenter@...cle.com>:
> > This is calling list_del() inside a loop which is a problem when we try
> > move to the next item on the list. I've converted it to use the _safe
> > version. And also, as a cleanup, I've converted it to use
> > list_for_each_entry instead of list_for_each.
> >
> Hi Dan.
> I can't understand why this patch is needed yet.
> Could you elaborate more ?
A simple rule of thumb: if you modify list inside the loop you need to
use the _safe variant of the iterator, since once element is deleted you
can't get from it to the next element.
Thanks.
--
Dmitry
--
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