TRIM support for UFS?

Kirk McKusick mckusick at
Fri Dec 10 00:57:20 UTC 2010

> To: Kirk McKusick <mckusick at>
> cc: Kostik Belousov <kostikbel at>, freebsd-fs at,
>         pjd at, Oliver Fromme <olli at>
> Subject: Re: TRIM support for UFS? 
> Date: Thu, 09 Dec 2010 16:37:48 -0800
> From: Bakul Shah <bakul at>
> X-ASK-Info: Message Queued (2010/12/09 16:37:54)
> X-ASK-Info: Confirmed by User (2010/12/09 16:39:17)
> Would be nice if something like ftrim(fd, offset, size) or
> trim(path, offsetm size) or TRIM file ioctl is added, to free
> up blocks undelying a given range in a file.  ftruncate can
> delete blocks at the end but there is no facility to lose
> blocks in the middle.  Mainly handy for virtual disks and
> databases (and would work nicely with SEEK_DATA, SEEK_HOLE).

We have discussed adding such a system call over the years (actually 
we called it `release' rather than `trim'). If such a call ever does
get added, any blocks that it actually manages to release will get
passed through to BIO_DELETE by the changes that Kostik is soon to
add to the system.

	Kirk McKusick

More information about the freebsd-fs mailing list