From: Willy Tarreau <w@1wt.eu>
To: Jim Meyering <jim@meyering.net>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: efficient access to "rotational"; new fcntl?
Date: Sat, 19 Sep 2009 13:25:23 +0200 [thread overview]
Message-ID: <20090919112523.GB28315@1wt.eu> (raw)
In-Reply-To: <87vdjgqcbd.fsf@meyering.net>
On Fri, Sep 18, 2009 at 09:31:50PM +0200, Jim Meyering wrote:
> About a year ago, I fixed GNU rm to avoid quadratic readdir/stat seek
> penalties on ext3 and ext4 that became overwhelming on directories with
> many entries (1M entries started to look like infloop or DoS).
>
> From coreutils-7.0 NEWS:
>
> chgrp, chmod, chown, chcon, du, rm: now all display linear performance,
> even when operating on million-entry directories on ext3 and ext4 file
> systems. Before, they would exhibit O(N^2) performance, due to linear
> per-entry seek time cost when operating on entries in readdir order.
> Rm was improved directly, while the others inherit the improvement
> from the newer version of fts in gnulib.
>
> To do that efficiently, I changed the core readdir loop (mainly via
> gnulib's fts.c) to preprocess entries, when needed, by sorting them
> on inode, and *then* processing them. This optimization is enabled
> only when the affected file system is of a type likely to benefit,
> and when the number of directory entries is large enough to matter.
This is excellent. I've been used to play with variations of
'find -printf "%i %p\n"|sort -n|cut -f2|xargs <cmd>' to sort file
operations by inode to speed them up, especially when rm'ing a
kernel tree or when doing a prefetch to build from hot cache.
I think you might notice excellent results on CDs where seeks cost a
lot. That's where I first use the find|sort method above. I'm really
happy to see that such mechanisms are now implemented inside my
everyday tools, and I can't wait to upgrade!
Regards,
Willy
prev parent reply other threads:[~2009-09-19 11:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-18 19:31 Jim Meyering
2009-09-18 22:16 ` Theodore Tso
2009-09-19 8:01 ` Jim Meyering
2009-09-19 8:31 ` Arjan van de Ven
2009-09-19 9:07 ` Jim Meyering
2009-09-19 9:19 ` Arjan van de Ven
2009-09-19 11:11 ` Avi Kivity
2009-09-19 11:30 ` Arjan van de Ven
2009-09-19 11:40 ` Avi Kivity
2009-09-19 11:25 ` Willy Tarreau [this message]
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=20090919112523.GB28315@1wt.eu \
--to=w@1wt.eu \
--cc=jim@meyering.net \
--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®