From: Andreas Dilger Subject: Re: Ext4 slow on links Date: Wed, 20 Jun 2012 23:18:53 -0600 Message-ID: References: <20120620002014.GA25471@gamma.logic.tuwien.ac.at> <4FE14034.6070800@redhat.com> <20120620002014.GA25471@gamma.logic.tuwien.ac.at> <20120620021912.GA26323@thunk.org> <20120620033831.GA2395@gamma.logic.tuwien.ac.at> <20120620051844.GA7829@gamma.logic.tuwien.ac.at> <4FE1D91B.8020707@redhat.com> <20120621022818.GD9669@gamma.logic.tuwien.ac.at> <4FE29DA7.40405@redhat.com> <20120621045004.GD18182@gamma.logic.tuwien.ac.at> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: Eric Sandeen , Ted Ts'o , "linux-ext4@vger.kernel.org" To: Norbert Preining Return-path: Received: from idcmail-mo1so.shaw.ca ([24.71.223.10]:59067 "EHLO idcmail-mo1so.shaw.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754820Ab2FUFSz (ORCPT ); Thu, 21 Jun 2012 01:18:55 -0400 In-Reply-To: <20120621045004.GD18182@gamma.logic.tuwien.ac.at> Sender: linux-ext4-owner@vger.kernel.org List-ID: On 2012-06-20, at 10:50 PM, Norbert Preining wrote: > On Mi, 20 Jun 2012, Eric Sandeen wrote: >> Hm. Upstream coreutils fixed this for rm and some other ops: > > Ok, I see. > >> sorted took 2.6s, unsorted took 52s. > > Got the idea, and tried it now myself not with ls etc, but > with the program that generates the caos, and yes, stracing it > gives the same result, getdents and the followed stats are all > *not* in inode order. > > So that means, it should be fixed in glibc? Right? Ouuchhh... > > That means that this behaviour is for *each* program using getdent > etc ... > > Do you have any suggestions? Is there a way to force readdir (I guess > most people use readdir instead of getdents directly) to iterate > in inode order? That's what the LD_PRELOAD library that Eric referenced does - you can load it for any application, and it will sort the dirents in inode order. It would definitely be better to do this in glibc, though we've also been discussing on occasion doing this inside ext4 for small directories. Cheers, Andreas