X-Spam-Checker-Version: SpamAssassin 3.3.0-rupdated (updated) on oss.sgi.com X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.0-rupdated Received: from cuda.sgi.com (cuda2.sgi.com [192.48.176.25]) by oss.sgi.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id nACNkTuT038653 for ; Thu, 12 Nov 2009 17:46:30 -0600 X-ASG-Debug-ID: 1258069606-11b702750000-NocioJ X-Barracuda-URL: http://cuda.sgi.com:80/cgi-bin/mark.cgi Received: from mail.internode.on.net (localhost [127.0.0.1]) by cuda.sgi.com (Spam Firewall) with ESMTP id AD4BC82C68 for ; Thu, 12 Nov 2009 15:46:47 -0800 (PST) Received: from mail.internode.on.net (bld-mail18.adl2.internode.on.net [150.101.137.103]) by cuda.sgi.com with ESMTP id u9DeByGqIVSNOMt1 for ; Thu, 12 Nov 2009 15:46:47 -0800 (PST) Received: from discord (unverified [121.44.122.247]) by mail.internode.on.net (SurgeMail 3.8f2) with ESMTP id 8277882-1927428 for multiple; Fri, 13 Nov 2009 10:16:45 +1030 (CDT) Received: from dave by discord with local (Exim 4.69) (envelope-from ) id 1N8jND-0001PV-AC; Fri, 13 Nov 2009 10:46:43 +1100 Date: Fri, 13 Nov 2009 10:46:43 +1100 From: Dave Chinner To: Christoph Hellwig Cc: Alex Elder , Barry Naujok , xfs@oss.sgi.com X-ASG-Orig-Subj: Re: [PATCH 06/14] repair: use a btree instead of a radix tree for theprefetch queue Subject: Re: [PATCH 06/14] repair: use a btree instead of a radix tree for theprefetch queue Message-ID: <20091112234643.GJ25494@discord.disaster> References: <20090902175840.740632507@bombadil.infradead.org> <1AB9A794DBDDF54A8A81BE2296F7BDFE83ADEB@cf--amer001e--3.americas.sgi.com> <20091112100408.GA25058@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20091112100408.GA25058@infradead.org> User-Agent: Mutt/1.5.18 (2008-05-17) X-Barracuda-Connect: bld-mail18.adl2.internode.on.net[150.101.137.103] X-Barracuda-Start-Time: 1258069608 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Virus-Scanned: by cuda.sgi.com at sgi.com X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using per-user scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=2.1 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.14467 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on oss.sgi.com X-Virus-Status: Clean On Thu, Nov 12, 2009 at 05:04:08AM -0500, Christoph Hellwig wrote: > On Wed, Oct 21, 2009 at 12:12:33PM -0500, Alex Elder wrote: > > - Related to the previous one--it would be good to have > > a little info about why the value 7 was chosen as the > > number of keys per node. Perhaps I just don't know > > enough of the history (or content of the upcoming > > patches). I think I can answer this one: > +/* > + * Maximum number of keys per node. Must be greater than 2 for the code > + * to work. > + */ > +#define BTREE_KEY_MAX 7 > +#define BTREE_KEY_MIN (BTREE_KEY_MAX / 2) > + > +#define BTREE_PTR_MAX (BTREE_KEY_MAX + 1) > + > +struct btree_node { > + unsigned long num_keys; > + unsigned long keys[BTREE_KEY_MAX]; > + struct btree_node *ptrs[BTREE_PTR_MAX]; > +}; BTREE_KEY_MAX = 7 results in a btree_node exactly filling a 64 byte cacheline on 32 bit, and 2 cachelines on 64 bit. Cacheline aligned and sized nodes minimises the number of cache misses when traversing/searching the btree.... Cheers, Dave. -- Dave Chinner david@fromorbit.com