LWN.net Logo

Block layer discard requests

Block layer discard requests

Posted Aug 15, 2008 23:09 UTC (Fri) by giraffedata (subscriber, #1954)
Parent article: Block layer discard requests

there is a new ioctl() call (BLKDISCARD) which creates a discard request.

This is the oft-discussed file punch/clear/freespace system call -- on a block device special file. Why doesn't linux have this yet? Other OSes do. This new ioctl class seems to be actively avoiding it.

Needless to say, applications using this feature should be rare and very carefully written.

No, I don't see it. These would be approximately the same applications that write to block device special files today and their use of the discard ioctl would be no more careful than their use of write().


(Log in to post comments)

Block layer discard requests

Posted Aug 16, 2008 9:33 UTC (Sat) by dwmw2 (subscriber, #2063) [Link]

This is the oft-discussed file punch/clear/freespace system call -- on a block device special file. Why doesn't linux have this yet? Other OSes do. This new ioctl class seems to be actively avoiding it.
Actually, Linux already has it in one form — madvise(MADV_REMOVE) can do this for inodes with a ->truncate_range() method (which is currently only tmpfs and shmpfs, but I plan to add JFFS2).

I didn't actively avoid it — I did take a look at what it would take to hook up something similar, but it was decidedly non-trivial. I'll probably come back to it, but it doesn't live in a patch sequence of primarily block-layer modifications.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds