Subject: Re: kern/6652: swapping to a sparse file fails unpredictably.
To: Marc Horowitz <>
From: Daniel Carosone <>
List: netbsd-bugs
Date: 01/06/1999 10:50:22
> We discussed this on ICB a bit.  The only issue here is that it would
> be nice if there was a non-O(n) way to determine if a file is sparse.
> I'm not sure how to do this (or if it even makes sense) in a
> filesystem generic way.  I think this might be possible using the
> indirect block macros, but I'm not ffs-clueful enough to know the

I'm not sure there is a problem here, though the "fs generic" issue
might be a problem for some weird case i can't think of right now
(in any case i can think of, the underlying filesystem doesn't
support sparse files and the point is moot).

"ls -ls" will let me determine if a file is sparse, by comparing
the "length" and "number of blocks" columns.  This info comes from
the stat structure and is O(1)..