From 30930fba219642cb1dadf1c8ef60ff799e3dc424 Mon Sep 17 00:00:00 2001 From: Etienne Dechamps Date: Fri, 2 Sep 2011 15:23:12 +0200 Subject: Add support for DISCARD to ZVOLs. DISCARD (REQ_DISCARD, BLKDISCARD) is useful for thin provisioning. It allows ZVOL clients to discard (unmap, trim) block ranges from a ZVOL, thus optimizing disk space usage by allowing a ZVOL to shrink instead of just grow. We can't use zfs_space() or zfs_freesp() here, since these functions only work on regular files, not volumes. Fortunately we can use the low-level function dmu_free_long_range() which does exactly what we want. Currently the discard operation is not added to the log. That's not a big deal since losing discard requests cannot result in data corruption. It would however result in disk space usage higher than it should be. Thus adding log support to zvol_discard() is probably a good idea for a future improvement. Signed-off-by: Brian Behlendorf --- cmd/zinject/Makefile.in | 1 + 1 file changed, 1 insertion(+) (limited to 'cmd/zinject') diff --git a/cmd/zinject/Makefile.in b/cmd/zinject/Makefile.in index 644c0b2a3..08aaa40ed 100644 --- a/cmd/zinject/Makefile.in +++ b/cmd/zinject/Makefile.in @@ -52,6 +52,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/config/kernel-bio-rw-syncio.m4 \ $(top_srcdir)/config/kernel-blk-end-request.m4 \ $(top_srcdir)/config/kernel-blk-fetch-request.m4 \ + $(top_srcdir)/config/kernel-blk-queue-discard.m4 \ $(top_srcdir)/config/kernel-blk-queue-flush.m4 \ $(top_srcdir)/config/kernel-blk-queue-io-opt.m4 \ $(top_srcdir)/config/kernel-blk-queue-max-hw-sectors.m4 \ -- cgit v1.2.3