From owner-freebsd-hackers Fri Jul 5 12:41:26 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2B48A37B400 for ; Fri, 5 Jul 2002 12:41:23 -0700 (PDT) Received: from ns.aus.com (adsl-64-175-247-226.dsl.sntc01.pacbell.net [64.175.247.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 38C5543E09 for ; Fri, 5 Jul 2002 12:41:22 -0700 (PDT) (envelope-from rsharpe@ns.aus.com) Received: from localhost (rsharpe@localhost) by ns.aus.com (8.11.6/8.11.6) with ESMTP id g65KrPu03831 for ; Sat, 6 Jul 2002 06:23:26 +0930 Date: Sat, 6 Jul 2002 06:23:25 +0930 (CST) From: Richard Sharpe To: Subject: Re: Adding readdir entries to the name cache ... In-Reply-To: <3D2504DC.36D046D7@mindspring.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 4 Jul 2002, Terry Lambert wrote: [major snippage, much useful to think about here ...] > > However, ls seems to call lstat in the same order that the files are in > > the directory, and a normal clock approach to directories would yield > > exactly the same result. Further, in the cases that the user did not want > > a -l, we would avoid adding many potentially useless names to the name > > cache and reducing its performance. > > This is because the sort occurs first. An unsorted "ls" (which is > available -- see the man page) doesn't have this issue. I don't want to start a flame war, but a truss of ls -l shows the following: getdirentries(0x5,0x809d000,0x1000,0x80990b4) = 4096 (0x1000) lstat(".gnome",0x809c248) = 0 (0x0) lstat(".mc",0x809c348) = 0 (0x0) lstat(".xinitrc",0x809c44c) = 0 (0x0) lstat("750B.pdf",0x809c54c) = 0 (0x0) lstat("Mail",0x809c648) = 0 (0x0) lstat("nsmail",0x809c748) = 0 (0x0) lstat(".cshrc",0x809c848) = 0 (0x0) lstat(".ssh",0x809c948) = 0 (0x0) lstat(".gnome_private",0x809ca50) = 0 (0x0) lstat(".xchat",0x809cb48) = 0 (0x0) lstat(".exmh",0x809cc48) = 0 (0x0) lstat(".ICEauthority",0x809cd50) = 0 (0x0) lstat(".netrc",0x809ce48) = 0 (0x0) This is the same order that 'ls -fal' produced. This suggests that the ls is doing an unsorted lookup of the info, and then sorting. That is the way I would have done it as well. Regards ----- Richard Sharpe, rsharpe@ns.aus.com, rsharpe@samba.org, sharpe@ethereal.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message