[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Findutils-patches] [PATCH] Add a -sort option to use fts's sorted t

From: Eric Blake
Subject: Re: [Findutils-patches] [PATCH] Add a -sort option to use fts's sorted traversal functionality
Date: Tue, 06 Jan 2015 09:14:16 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

On 01/05/2015 11:08 PM, Phil Miller wrote:
> On Fri, Jan 2, 2015 at 7:48 PM, Eric Blake <address@hidden> wrote:
>> On 12/29/2014 04:49 PM, Phil Miller wrote:
>>> * find/defs.h (struct options): Add a 'sort' flag.
>> A boolean flag is insufficient.  The default should remain unsorted, but
>> you should offer the ability to sort by either name or inode, which
>> means -sort needs to take an argument to say which sorting method to use.
> The motivating use case for this patch is in enumerating files in a stable
> order, from <>. Sorting by inode doesn't
> offer that benefit, since it will vary every time a given tree is
> generated.

Just because YOU don't plan to sort by inode does not rule it out as a
useful sort.  Coruetils proved that it is MUCH faster to implement 'rm
-r' when visiting a hierarchy sorted in inode order than it is in
unsorted or name order - so there ARE operations where finding names in
inode order will provide speedups to some clients.

> I can imagine a potential performance benefit to downstream
> consumers in sorting by inode (putting subsequent disk access in roughly
> consecutive order), but I don't see much payoff in implementing it without
> some more concrete motivation.  That said, if it will smooth integration,
> it's easy enough for me to just go ahead and implement.

Gnulib's fts module already provides all three sort orders (unsorted,
name, and inode), so it should be fairly easy to wire up all three
(since we are already using unsorted by default).

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]