#7876: TRIM support for SSDs --------------------------------+---------------------------- Reporter: polari | Owner: axeld Type: enhancement | Status: new Priority: normal | Milestone: R1 Component: File Systems/BFS | Version: R1/Development Resolution: | Keywords: Blocked By: | Blocking: Has a Patch: 0 | Platform: All --------------------------------+---------------------------- Comment (by bonefish): Only the file system knows, when it no longer uses a block. So an API must be provided that can be used by the file system. The file cache doesn't know about disks at all, so you don't want to touch that one at all. The block cache does, but its use is optional. So, for convenience, the block cache API can be extended (or maybe doesn't even need to -- there already is a `block_cache_discard()`), but it cannot be the only API. What is needed in either case is a new ioctl operation (maybe plus a nicer-to-use wrapper function) that gets propagated to the driver which can issue the command to the hardware. I'm not really familiar with the disk I/O stack (several modules are involved). I believe the simplified call chain is "device -> bus manager -> driver", but since both the ATA and the SCSI stack are involved plus (IIRC) a few helper modules, the chain is probably more than twice as long. Maybe someone who is more familiar with this stuff can give some further hints. It might also be worthwhile to have a way to query whether trimming is supported, so the invocations can be omitted when not needed. In the case either a second ioctl operation could be added or an existing querying operation could be extended (there isn't any usable padding in the `device_geometry` structure used by `B_GET_GEOMETRY`, though). -- Ticket URL: <http://dev.haiku-os.org/ticket/7876#comment:2> Haiku <http://dev.haiku-os.org> Haiku - the operating system.