]> git.karo-electronics.de Git - karo-tx-linux.git/commit
nbd: handle discard requests
authorPaul Clements <paul.clements@steeleye.com>
Fri, 28 Sep 2012 00:22:21 +0000 (10:22 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 5 Oct 2012 04:01:42 +0000 (14:01 +1000)
commit6ca8a093c869856c53f31e394c789ceca9c19054
treeacff6f505a624e65f05208f7baf5ebeeed525779
parentae2ff4bf2ed446fa66e1cbe359daa7fe31232c07
nbd: handle discard requests

Add discard support to nbd.  If the nbd-server supports discard, it will
send NBD_FLAG_SEND_TRIM to the client.  The client will then set the flag
in the kernel via NBD_SET_FLAGS, which tells the kernel to enable discards
for the device (QUEUE_FLAG_DISCARD).

If discard support is enabled, then when the nbd client system receives a
discard request, this will be passed along to the nbd-server.  When the
discard request is received by the nbd-server, it will perform:

fallocate(.. FALLOC_FL_PUNCH_HOLE ..)

To punch a hole in the backend storage, which is no longer needed.

Signed-off-by: Paul Clements <paul.clements@steeleye.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/block/nbd.c
include/linux/nbd.h