From: Linus Torvalds <torvalds@osdl.org>
To: Kirill Korotaev <dev@sw.ru>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] adding per sb inode list to make invalidate_inodes() faster
Date: Fri, 10 Sep 2004 07:22:48 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.58.0409100713570.5912@ppc970.osdl.org> (raw)
In-Reply-To: <414166BA.3020804@sw.ru>
On Fri, 10 Sep 2004, Kirill Korotaev wrote:
> >
> > Hmm.. I don't mind the approach per se, but I get very nervous about
> > the fact that I don't see any initialization of "inode->i_sb_list".
>
> inode->i_sb_list is a link list_head, not real list head (real list head
> is sb->s_inodes and it's initialized). i.e. it doesn't require
> initialization.
It _does_ require initialization. And no, there is no difference between a
"real" head and a entry "link" in the list. They both need to be
initialized.
> all the operations I perform on i_sb_list are
> - list_add(&inode->i_sb_list, ...);
This one is ok without initialzing the entry, since it will do so itself.
> - list_del(&inode->i_sb_list);
This one is NOT ok. If list_del() is ever done on a link entry that hasn't
been initialized, you crash. If "list_del()" is ever done twice on an
entry, you will crash and/or corrupt memory elsewhere.
> So it's all safe.
It's not "all safe". You had better explain _why_ it's safe. You do so
later:
> 1. struct inode is allocated only in one place!
> it's alloc_inode(). Next alloc_inode() is static and is called from 3
> places:
> new_inode(), get_new_inode() and get_new_inode_fast().
>
> All 3 above functions do list_add(&inode->i_sb_list, &sb->s_inodes);
> i.e. newly allocated inodes are always in super block list.
Good. _This_ is what I was after.
> 2. list_del(&inode->i_sb_list) doesn't leave super block list invalid!
No, but it leaves _itself_ invalid. There had better not be anything that
touches it ever after without an initialization. That wasn't obvious...
Linus
next prev parent reply other threads:[~2004-09-10 14:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-09 15:39 Kirill Korotaev
2004-09-09 15:51 ` Linus Torvalds
2004-09-09 17:19 ` William Lee Irwin III
2004-09-09 18:06 ` Andrew Morton
2004-09-09 18:18 ` William Lee Irwin III
2004-09-09 19:08 ` Andrew Morton
2004-09-09 19:35 ` William Lee Irwin III
2004-09-10 8:54 ` Kirill Korotaev
2004-09-10 9:05 ` Andrew Morton
2004-09-10 20:14 ` Denis Vlasenko
2004-09-11 9:15 ` Re[2]: " Kirill Korotaev
2004-09-10 8:32 ` Kirill Korotaev
2004-09-10 14:22 ` Linus Torvalds [this message]
2004-09-10 16:56 ` Kirill Korotaev
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=Pine.LNX.4.58.0409100713570.5912@ppc970.osdl.org \
--to=torvalds@osdl.org \
--cc=akpm@osdl.org \
--cc=dev@sw.ru \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®