lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87wqvge1nt.fsf@flamingspork.com>
Date:	Mon, 14 Jan 2013 17:09:26 +1100
From:	Stewart Smith <stewart@...mingspork.com>
To:	Theodore Ts'o <tytso@....edu>, Radek Pazdera <rpazdera@...hat.com>
Cc:	linux-ext4@...r.kernel.org,
	Lukáš Czerner <lczerner@...hat.com>
Subject: Re: [RFC] Optimizing readdir()

Theodore Ts'o <tytso@....edu> writes:
> I wonder if the better approach is to just simply have some
> easy-to-use library routines that do a readdir/sort in userspace.  The
> spd_readdir does basically this, and as we can see it's good enough
> for most purposes.  The problem is danger when using this in threaded
> programs, or if you have programs doing really strange things with
> telldir/seekdir, etc.
>
> But it wouldn't be that hard to write a generic library function which
> if it were used for find, ls, tar, and a few other key programs, would
> solve the problem for most use cases.

Many times I've used scandir(3) to do this.

(copying out of notmuch/notmuch-new.c):

static int
dirent_sort_inode (const struct dirent **a, const struct dirent **b)
{
    return ((*a)->d_ino < (*b)->d_ino) ? -1 : 1;
}

(as then doing stat() on each file is *much* faster in inode order)

glibc provides alphasort() (POSIX.1-2008) and versionsort() (GNU
extension), it'd probably be great if it also provided inodesort()

-- 
Stewart Smith

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ