On Thu, Aug 23, 2012 at 01:33:37PM -0700, Philip Guenther wrote:

> On Thu, Aug 23, 2012 at 12:32 PM, Jan Stary <h...@stare.cz> wrote:
> > cp.c says:
> >
> > /*
> >  * mastercmp --
> >  *      The comparison function for the copy order.  The order is to copy
> >  *      non-directory files before directory files.  The reason for this
> >  *      is because files tend to be in the same cylinder group as their
> >  *      parent directory, whereas directories tend not to be.  Copying the
> >  *      files first reduces seeking.
> >  */
> ...
> > Doesn't the code actually do the opposite?
> > If 'a' is a directory, it comes first?
> 
> Yep.  Nice catch.
> 
> 
> > Should that be FTS_F?
> 
> I think it's correct to do the test against FTS_D, it just should
> return them in the other direction to do what the comment says.
> 
> What I don't know is whether the rule described is actually still
> considered a good and useful thing still.  Otto?
> 
> 
> Philip Guenther

netbsd removed the sorting in 1.52:

"Remove fts sorting.  It was originally put there to copy files
before directories since files (usually) are in the same cylinder
group and subdirectories aren't.  However, this mostly changed with
the new ffs dirpref algorithm in 2001."

I'd have to check which dirpref() we use. And do some tests.

That said, the code might not agree with the comment, but as long as files stick
together as a group I do not think it matters much.

        -Otto

Reply via email to