]> git.baikalelectronics.ru Git - kernel.git/commit
nbd: handle discard requests
authorPaul Clements <paul.clements@steeleye.com>
Fri, 5 Oct 2012 00:16:18 +0000 (17:16 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Oct 2012 18:05:24 +0000 (03:05 +0900)
commit639f28e79a3ae6fed0e5b121bf164ee9c74d9713
tree9957b7a2dbdc5047fe1f2be7907f90f5bdb6fbf0
parentaace90c6cbba2eb9fbe640031a405025e8f43e51
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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/block/nbd.c
include/linux/nbd.h