tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

DIOCDISCARD, fdiscard, and fallocate



ok, I have preliminary patches that kill off DIOCDISCARD and
DIOCGDISCARDPARAMS in favor of a fdiscard system call (meant to work
on both files and devices) and add that and also a fallocate system
call.

http://www.netbsd.org/~dholland/tmp/discard/
(includes both the 17-part split patch and a combined patch)

Things that are not in this:
   - posix_fallocate
   - an implementation of either fallocate or fdiscard for ffs
   - discard support for raidframe, ld, ccd, or vnd
   - a fix for PR 47435
   - compat_linux support

With these patches posix_fallocate is the same as native fallocate, so
I'm not sure what the best way to provide it is, and in particular
whether it ought to have its own kernel entry point or not.

The fallocate semantics are: the file size increases if you fallocate
past eof. The fdiscard semantics are: the file size is not affected.
I don't think we can or should support the Linux fallocate that allows
allocating beyond EOF, and after thinking about this for some time
don't see any value in shrinking a file if you fdiscard at the end.

(As people have probably forgotten: I want to get rid of DIOCDISCARD
and particularly DIOCGDISCARDINFO before it appears in a release
because it's a somewhat regrettable interface.)

I have not actually tested this on an SSD yet (I intend to do so
before committing) but it's passed anita.

Comments? Stuff I've overlooked or done wrong?

After I get this committed I'm intending to look into real
fallocate/fdiscard support for ffs, but I'd be more than happy if
someone else wanted to take that up :-)

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index