Otherwise, the request goes onto the queue, and the end_io() function will be called when the discard request completes. Most of the time, though, the filesystem will not really care about completion - it's just passing advice to the driver, after all - so end_io() can be NULL and the right thing will happen.
Time for my naive questions: Is there ever a race condition where you could free some number of sectors, and then reallocate them, such that the writes for those sectors somehow get ahead of the trim operation? Is there anything that guarantees the ordering?
I ask because I was under the impression that I/O schedulers like CFQ try to balance among processes, and so it's not clear that a truncate operation from process A remains strongly ordered relative to a file written by process B.
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds