diff options
author | Etienne Dechamps <[email protected]> | 2011-09-02 15:23:12 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2012-02-09 16:19:38 -0800 |
commit | 30930fba219642cb1dadf1c8ef60ff799e3dc424 (patch) | |
tree | 093f2c5c254768e859f8307d77d393e9668b5e1f /lib | |
parent | cb2d19010d8fbcf6c22585cd8763fad3ba7db724 (diff) |
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 <[email protected]>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libavl/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libefi/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libnvpair/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libshare/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libspl/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libspl/asm-generic/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libspl/asm-i386/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libspl/asm-x86_64/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libspl/include/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libspl/include/ia32/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libspl/include/ia32/sys/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libspl/include/rpc/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libspl/include/sys/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libspl/include/sys/dktp/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libspl/include/sys/sysevent/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libspl/include/util/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libunicode/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libuutil/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libzfs/Makefile.in | 1 | ||||
-rw-r--r-- | lib/libzpool/Makefile.in | 1 |
21 files changed, 21 insertions, 0 deletions
diff --git a/lib/Makefile.in b/lib/Makefile.in index 43bdf0dc2..daaf306b1 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -49,6 +49,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 \ diff --git a/lib/libavl/Makefile.in b/lib/libavl/Makefile.in index d909fa66a..d28c6acde 100644 --- a/lib/libavl/Makefile.in +++ b/lib/libavl/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libefi/Makefile.in b/lib/libefi/Makefile.in index a0595ce5d..4a935784a 100644 --- a/lib/libefi/Makefile.in +++ b/lib/libefi/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libnvpair/Makefile.in b/lib/libnvpair/Makefile.in index 533d96235..e982a68bd 100644 --- a/lib/libnvpair/Makefile.in +++ b/lib/libnvpair/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libshare/Makefile.in b/lib/libshare/Makefile.in index 8390ce835..61b61a700 100644 --- a/lib/libshare/Makefile.in +++ b/lib/libshare/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libspl/Makefile.in b/lib/libspl/Makefile.in index 541f72b9d..2d1a8ad17 100644 --- a/lib/libspl/Makefile.in +++ b/lib/libspl/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libspl/asm-generic/Makefile.in b/lib/libspl/asm-generic/Makefile.in index 974f489ad..63b0ef392 100644 --- a/lib/libspl/asm-generic/Makefile.in +++ b/lib/libspl/asm-generic/Makefile.in @@ -50,6 +50,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 \ diff --git a/lib/libspl/asm-i386/Makefile.in b/lib/libspl/asm-i386/Makefile.in index f84cd39d9..2d43d8918 100644 --- a/lib/libspl/asm-i386/Makefile.in +++ b/lib/libspl/asm-i386/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libspl/asm-x86_64/Makefile.in b/lib/libspl/asm-x86_64/Makefile.in index 23c4b2917..c6d61a5fa 100644 --- a/lib/libspl/asm-x86_64/Makefile.in +++ b/lib/libspl/asm-x86_64/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libspl/include/Makefile.in b/lib/libspl/include/Makefile.in index 043f0fe1e..ab1d8511e 100644 --- a/lib/libspl/include/Makefile.in +++ b/lib/libspl/include/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libspl/include/ia32/Makefile.in b/lib/libspl/include/ia32/Makefile.in index dad5d8561..f1f6cb87f 100644 --- a/lib/libspl/include/ia32/Makefile.in +++ b/lib/libspl/include/ia32/Makefile.in @@ -49,6 +49,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 \ diff --git a/lib/libspl/include/ia32/sys/Makefile.in b/lib/libspl/include/ia32/sys/Makefile.in index d7ea24fff..70eb6a35d 100644 --- a/lib/libspl/include/ia32/sys/Makefile.in +++ b/lib/libspl/include/ia32/sys/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libspl/include/rpc/Makefile.in b/lib/libspl/include/rpc/Makefile.in index 3a0b3a1af..a217ab6dc 100644 --- a/lib/libspl/include/rpc/Makefile.in +++ b/lib/libspl/include/rpc/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libspl/include/sys/Makefile.in b/lib/libspl/include/sys/Makefile.in index b8663bdd2..efa77adc6 100644 --- a/lib/libspl/include/sys/Makefile.in +++ b/lib/libspl/include/sys/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libspl/include/sys/dktp/Makefile.in b/lib/libspl/include/sys/dktp/Makefile.in index e5c353795..1656d9d4e 100644 --- a/lib/libspl/include/sys/dktp/Makefile.in +++ b/lib/libspl/include/sys/dktp/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libspl/include/sys/sysevent/Makefile.in b/lib/libspl/include/sys/sysevent/Makefile.in index edb36b071..5a37394e3 100644 --- a/lib/libspl/include/sys/sysevent/Makefile.in +++ b/lib/libspl/include/sys/sysevent/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libspl/include/util/Makefile.in b/lib/libspl/include/util/Makefile.in index 301fde587..8894eb57a 100644 --- a/lib/libspl/include/util/Makefile.in +++ b/lib/libspl/include/util/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libunicode/Makefile.in b/lib/libunicode/Makefile.in index 3e3cb2df1..6135529f8 100644 --- a/lib/libunicode/Makefile.in +++ b/lib/libunicode/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libuutil/Makefile.in b/lib/libuutil/Makefile.in index 1fb5e573d..e10118898 100644 --- a/lib/libuutil/Makefile.in +++ b/lib/libuutil/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libzfs/Makefile.in b/lib/libzfs/Makefile.in index 9ba47ca73..84e9e2a7e 100644 --- a/lib/libzfs/Makefile.in +++ b/lib/libzfs/Makefile.in @@ -51,6 +51,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 \ diff --git a/lib/libzpool/Makefile.in b/lib/libzpool/Makefile.in index fc071e22a..6c6b3b1e7 100644 --- a/lib/libzpool/Makefile.in +++ b/lib/libzpool/Makefile.in @@ -51,6 +51,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 \ |