From: "Josef 'Jeff' Sipek" <jeffpc@josefsipek.net>
To: NeilBrown <neilb@suse.de>
Cc: "J. Bruce Fields" <bfields@fieldses.org>,
xfs@oss.sgi.com, Adam Schrotenboer <adam@m2000.com>,
Jesper Juhl <jesper.juhl@gmail.com>,
Trond Myklebust <trond.myklebust@netapp.com>,
linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org,
Thomas Daniel <tdaniel@m2000.com>,
Frederic Revenu <frevenu@m2000.com>, Jeff Doan <jdoan@m2000.com>
Subject: Re: [opensuse] nfs_update_inode: inode X mode changed, Y to Z
Date: Tue, 25 Mar 2008 18:13:21 -0400 [thread overview]
Message-ID: <20080325221321.GC20257@josefsipek.net> (raw)
In-Reply-To: <34178.192.168.1.70.1206481102.squirrel@neil.brown.name>
On Wed, Mar 26, 2008 at 08:38:22AM +1100, NeilBrown wrote:
...
> However you still need to do something about the generation number. It
> must be set to something.
Right.
> When you allocate an inode that doesn't currently exist on the device,
> you obviously cannot increment the old value and use that.
Makes sense.
> However you can do a lot better than always using 0.
I looked at the code (xfs_ialloc.c:xfs_ialloc_ag_alloc)
290 /*
291 * Set initial values for the inodes in this buffer.
292 */
293 xfs_biozero(fbuf, 0, ninodes << args.mp->m_sb.sb_inodelog);
294 for (i = 0; i < ninodes; i++) {
295 free = XFS_MAKE_IPTR(args.mp, fbuf, i);
296 free->di_core.di_magic = cpu_to_be16(XFS_DINODE_MAGIC);
297 free->di_core.di_version = version;
298 free->di_next_unlinked = cpu_to_be32(NULLAGINO);
299 xfs_ialloc_log_di(tp, fbuf, i,
300 XFS_DI_CORE_BITS | XFS_DI_NEXT_UNLINKED);
301 }
xfs_biozero(...) turns into a memset(buf, 0, len), and since the loop that
follows doesn't change the generation number, it'll stay 0.
> The simplest would be to generate a 'random' number (get_random_bytes).
> Slightly better would be to generate a random number at boot time
> and use that, incrementing it each time it is used to set the
> generation number for an inode.
I'm not familiar enough with NFS, do you want something that's monotonically
increasing or do you just test for inequality? If it is inequality, why not
just use something like the jiffies - that should be unique enough.
> Even better would be store store that 'next generation number' in the
> superblock so there would be even less risk of the 'random' generation
> producing repeats.
> This is what ext3 does. It doesn't dynamically allocate inodes,
> but it doesn't want to pay the cost of reading an old inode from
> storage just to see what the generation number is. So it has
> a number in the superblock which is incremented on each inode allocation
> and is used as the generation number.
Something tells me that the SGI folks might not be all too happy with the
in-sb number...XFS tries to be as parallel as possible, and this would cause
the counter variable to bounce around their NUMA systems. Perhaps a per-ag
variable would be better, but I remember reading that parallelizing updates
to some inode count variable (I forget which) in the superblock
\cite{dchinner-ols2006} led to a rather big improvement. It's almost
morning down under, so I guess we'll get their comments on this soon.
Josef 'Jeff' Sipek.
--
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan
next prev parent reply other threads:[~2008-03-25 22:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <47CF157B.1010908@m2000.com>
[not found] ` <18383.24847.381754.517731@notabene.brown>
[not found] ` <47CF62C5.7000908@m2000.com>
[not found] ` <18384.50909.866848.966192@notabene.brown>
[not found] ` <9a8748490803121513w285cd45rb6b26a3d842cac1b@mail.gmail.com>
[not found] ` <20080312221511.GC31632@fieldses.org>
[not found] ` <9a8748490803121516u36395872i70cc88b0439adc74@mail.gmail.com>
[not found] ` <18394.1501.991087.80264@notabene.brown>
[not found] ` <47DAEFD0.9020407@m2000.com>
[not found] ` <47E92F8E.7030504@m2000.com>
[not found] ` <20080325190943.GF2237@fieldses.org>
2008-03-25 20:32 ` [opensuse] nfs_update_inode: inode X mode changed, Y to Z NeilBrown
2008-03-25 21:24 ` Josef 'Jeff' Sipek
2008-03-25 21:38 ` NeilBrown
2008-03-25 22:13 ` Josef 'Jeff' Sipek [this message]
2008-03-25 23:09 ` NeilBrown
2008-03-26 3:37 ` David Chinner
2008-03-26 5:02 ` David Chinner
2008-04-17 19:37 ` Adam Schrotenboer
2008-03-26 3:27 ` Timothy Shimmin
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=20080325221321.GC20257@josefsipek.net \
--to=jeffpc@josefsipek.net \
--cc=adam@m2000.com \
--cc=bfields@fieldses.org \
--cc=frevenu@m2000.com \
--cc=jdoan@m2000.com \
--cc=jesper.juhl@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=tdaniel@m2000.com \
--cc=trond.myklebust@netapp.com \
--cc=xfs@oss.sgi.com \
/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