LKML Archive on
 help / color / Atom feed
From: Linus Torvalds <>
To: "Darrick J. Wong" <>
Cc: linux-fsdevel <>,
	linux-xfs <>,
	Dave Chinner <>,
	Linux Kernel Mailing List <>,
	Eric Sandeen <>,
	Christoph Hellwig <>,
	Andreas Gruenbacher <>,
	Bob Peterson <>,
	cluster-devel <>
Subject: Re: [GIT PULL] iomap: new code for 5.4
Date: Wed, 18 Sep 2019 19:07:56 -0700
Message-ID: <> (raw)
In-Reply-To: <>

On Wed, Sep 18, 2019 at 6:31 PM Linus Torvalds
<> wrote:
> Why would anybody use that odd "list_pop()" thing in a loop, when what
> it really seems to just want is that bog-standard
> "list_for_each_entry_safe()"

Side note: I do agree that the list_for_each_entry_safe() thing isn't
exactly beautiful, particularly since you need that extra variable for
the temporary "next" pointer.

It's one of the C++ features I'd really like to use in the kernel -
the whole "declare new variable in a for (;;) statement" thing.

In fact, it made it into C - it's there in C99 -  but we still use
"-std=gnu89" because of other problems with the c99 updates.

Anyway, I *would* be interested in cleaning up
list_for_each_entry_safe() if somebody has the energy and figures out
what we could do to get the c99 behavior without the breakage from
other sources.

For some background: the reason we use "gnu89" is because we use the
GNU extension with type cast initializers quite a bit, ie things like

    #define __RAW_SPIN_LOCK_UNLOCKED(lockname)      \
        (raw_spinlock_t) __RAW_SPIN_LOCK_INITIALIZER(lockname)

and that broke in c99 and gnu99, which considers those compound
literals and you can no longer use them as initializers.


for some of the historical discussion about this. It really _is_ sad,
because variable declarations inside for-loops are very useful, and
would have the potential to make some of our "for_each_xyz()" macros a
lot prettier (and easier to use too).

So our list_for_each_entry_safe() thing isn't perfect, but that's no
reason to try to then make up completely new things.


  reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-17 15:21 Darrick J. Wong
2019-09-19  1:31 ` Linus Torvalds
2019-09-19  2:07   ` Linus Torvalds [this message]
2019-09-19  3:45   ` Darrick J. Wong
2019-09-19 17:03     ` Linus Torvalds
2019-09-19 17:04       ` Linus Torvalds
2019-09-19 17:07       ` Christoph Hellwig
2019-09-19 17:41         ` Linus Torvalds
2019-09-19 17:01   ` Christoph Hellwig

Reply instructions:

You may reply publically 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='' \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on

Archives are clonable:
	git clone --mirror lkml/git/0.git
	git clone --mirror lkml/git/1.git
	git clone --mirror lkml/git/2.git
	git clone --mirror lkml/git/3.git
	git clone --mirror lkml/git/4.git
	git clone --mirror lkml/git/5.git
	git clone --mirror lkml/git/6.git
	git clone --mirror lkml/git/7.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ \
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone