Date: Sat, 6 Jul 2002 06:23:25 +0930 (CST) From: Richard Sharpe <rsharpe@ns.aus.com> To: <freebsd-hackers@freebsd.org> Subject: Re: Adding readdir entries to the name cache ... Message-ID: <Pine.LNX.4.33.0207060620200.3806-100000@ns.aus.com> In-Reply-To: <3D2504DC.36D046D7@mindspring.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.33.0207060620200.3806-100000>