Current-Users archive

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

fdiscard and posix_fallocate heads up



I've committed new fdiscard() and posix_fallocate() system calls.

Item 1: The back end for fdiscard adds a field to both struct bdevsw
and struct cdevsw. (This is so fdiscard() can do TRIM on SSDs.) I have
updated all the devsw objects I could find but might have missed
some. If this breaks your build, add ".d_discard = nodiscard" or prod
me to.

Item 2: The prior ioctl DIOCDISCARD and its associated ioctl
DIOCGDISCARDPARAMS are deprecated and have been removed. They have
never been in a release, and as they were a bit hackish that's
probably just as well. If you were making DIOCDISCARD calls from a
userlevel program, change them to fdiscard(), and note that fdiscard
takes (block-aligned) byte offsets rather than DEV_BSIZE units.

Item 3: There is currently no fdiscard or fallocate implementation for
ffs. This will be coming eventually, but not immediately.
Consequently, these calls will fail with ENOSYS on regular files. If
this causes problems for third-party software that discovers the
functionality and then fails on it, let me know.

Item 4: There is no native fallocate() yet. The conclusion I came to
after going around on this several times is that I would like to
design a better interface that doesn't share the weaknesses of
posix_fallocate, most notably the fact that in some circumstances if
you try to allocate 100000 blocks and run out of disk space after
99999, it has to free them all again in order to be able to fail and
report an error. So for now the native fallocate() is reserved.

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


Home | Main Index | Thread Index | Old Index