mirror_zfs/module/zfs
Etienne Dechamps 7c0e570888 Limit the number of blocks to discard at once.
The number of blocks that can be discarded in one BLKDISCARD ioctl on a
zvol is currently unlimited. Some applications, such as mkfs, discard
the whole volume at once and they use the maximum possible discard size
to do that. As a result, several gigabytes discard requests are not
uncommon.

Unfortunately, if a large amount of data is allocated in the zvol, ZFS
can be quite slow to process discard requests. This is especially true
if the volblocksize is low (e.g. the 8K default). As a result, very
large discard requests can take a very long time (seconds to minutes
under heavy load) to complete. This can cause a number of problems, most
notably if the zvol is accessed remotely (e.g. via iSCSI), in which case
the client has a high probability of timing out on the request.

This patch solves the issue by adding a new tunable module parameter:
zvol_max_discard_blocks. This indicates the maximum possible range, in
zvol blocks, of one discard operation. It is set by default to 16384
blocks, which appears to be a good tradeoff. Using the default
volblocksize of 8K this is equivalent to 128 MB. When using the maximum
volblocksize of 128K this is equivalent to 2 GB.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #858
2012-07-31 09:46:09 -07:00
..
arc.c Illumos #1748: desire support for reguid in zfs 2012-07-11 13:08:56 -07:00
bplist.c Fix gcc missing parenthesis warnings 2010-08-31 08:38:35 -07:00
bpobj.c Illumos #1644, #1645, #1646, #1647, #1708 2012-07-31 09:25:30 -07:00
dbuf.c Illumos #764: panic in zfs:dbuf_sync_list 2011-08-01 12:09:11 -07:00
ddt_zap.c Update incorrect ddt_zap_lookup() assertion 2012-07-03 15:14:34 -07:00
ddt.c Add ddt_object_load() error handling 2012-07-20 10:36:21 -07:00
dmu_diff.c Update to onnv_147 2010-08-26 14:24:34 -07:00
dmu_object.c Add linux kernel module support 2010-08-31 13:41:58 -07:00
dmu_objset.c Export additional dsl symbols 2012-04-11 09:26:55 -07:00
dmu_send.c Illumos #1644, #1645, #1646, #1647, #1708 2012-07-31 09:25:30 -07:00
dmu_traverse.c Revert "Fix stack traverse_visitbp()" 2011-05-31 12:17:27 -07:00
dmu_tx.c Illumos #1475: zfs spill block hold can access invalid spill blkptr 2012-04-11 11:46:30 -07:00
dmu_zfetch.c Add missing ZFS tunables 2011-05-04 10:02:37 -07:00
dmu.c Add zfs_mdcomp_disable module option 2012-04-27 16:28:02 -07:00
dnode_sync.c Fix dbuf eviction assertion 2010-08-31 08:38:45 -07:00
dnode.c Improve meta data performance 2011-11-03 10:19:21 -07:00
dsl_dataset.c Illumos #1644, #1645, #1646, #1647, #1708 2012-07-31 09:25:30 -07:00
dsl_deadlist.c Illumos #1644, #1645, #1646, #1647, #1708 2012-07-31 09:25:30 -07:00
dsl_deleg.c Illumos #1644, #1645, #1646, #1647, #1708 2012-07-31 09:25:30 -07:00
dsl_dir.c Add linux kernel module support 2010-08-31 13:41:58 -07:00
dsl_pool.c Illumos #1644, #1645, #1646, #1647, #1708 2012-07-31 09:25:30 -07:00
dsl_prop.c Export additional dsl symbols 2012-04-11 09:26:55 -07:00
dsl_scan.c Add 'inline' keyword 2012-07-19 13:41:00 -07:00
dsl_synctask.c Add linux kernel module support 2010-08-31 13:41:58 -07:00
fm.c Add missing ZFS tunables 2011-05-04 10:02:37 -07:00
gzip.c Fix zmod.h usage in userspace 2010-08-31 08:38:46 -07:00
lzjb.c Fix stack lzjb 2010-08-31 08:38:49 -07:00
Makefile.in Add script for builtin module building. 2012-07-26 13:45:09 -07:00
metaslab.c Illumos #1909: disk sync write perf regression when slog is used post oi_148 2012-04-19 16:26:29 -07:00
refcount.c Fix gcc uninitialized variable warnings 2010-08-31 08:38:43 -07:00
rrwlock.c Enable rrwlock.c compilation 2010-12-07 16:05:25 -08:00
sa.c Add sa_spill_rele() interface 2012-03-07 16:28:00 -08:00
sha256.c Add linux sha2 support 2010-08-31 13:41:59 -07:00
spa_boot.c Add linux kernel module support 2010-08-31 13:41:58 -07:00
spa_config.c Prototype/structure update for Linux 2011-02-10 09:27:21 -08:00
spa_errlog.c Add linux kernel module support 2010-08-31 13:41:58 -07:00
spa_history.c Illumos #1644, #1645, #1646, #1647, #1708 2012-07-31 09:25:30 -07:00
spa_misc.c Illumos #1748: desire support for reguid in zfs 2012-07-11 13:08:56 -07:00
spa.c Illumos #1949, #1953 2012-07-11 13:33:31 -07:00
space_map.c Update core ZFS code from build 121 to build 141. 2010-05-28 13:45:14 -07:00
txg.c Add 'dmu_tx' kstats entry 2012-02-27 08:59:10 -08:00
uberblock.c Update core ZFS code from build 121 to build 141. 2010-05-28 13:45:14 -07:00
unique.c Fix gcc ident pragma warnings 2010-08-27 15:34:02 -07:00
vdev_cache.c Illumos #175: zfs vdev cache consumes excessive memory 2011-08-01 12:09:11 -07:00
vdev_disk.c Move partition scanning from userspace to module. 2012-07-17 09:17:31 -07:00
vdev_file.c Illumos #1680: zfs vdev_file_io_start: validate vdev before using vdev_tsd 2012-04-11 11:23:18 -07:00
vdev_label.c Fix gcc uninitialized variable warnings 2010-08-31 08:38:43 -07:00
vdev_mirror.c Fix gcc c90 compliance warnings 2010-08-27 15:28:32 -07:00
vdev_missing.c Update core ZFS code from build 121 to build 141. 2010-05-28 13:45:14 -07:00
vdev_queue.c Add missing ZFS tunables 2011-05-04 10:02:37 -07:00
vdev_raidz.c Fix variables named current 2010-08-31 08:38:44 -07:00
vdev_root.c Fix gcc c90 compliance warnings 2010-08-27 15:28:32 -07:00
vdev.c Illumos #1949, #1953 2012-07-11 13:33:31 -07:00
zap_leaf.c Fix gcc uninitialized variable warnings 2010-08-31 08:38:43 -07:00
zap_micro.c Illumos #1644, #1645, #1646, #1647, #1708 2012-07-31 09:25:30 -07:00
zap.c Fix rw_init() usage 2010-08-31 08:38:46 -07:00
zfs_acl.c Fix build failures on PaX/GRSecurity patched kernels 2012-07-17 09:22:43 -07:00
zfs_byteswap.c Add linux kernel module support 2010-08-31 13:41:58 -07:00
zfs_ctldir.c Disable .zfs directory on 32-bit systems 2012-07-20 12:20:57 -07:00
zfs_debug.c Use spl_debug_* helpers 2012-02-09 16:37:48 -08:00
zfs_dir.c Add .zfs control directory 2012-03-22 13:03:47 -07:00
zfs_fm.c Illumos #1951: leaking a vdev when removing an l2cache device 2012-04-11 11:32:06 -07:00
zfs_fuid.c Drop HAVE_XVATTR macros 2011-03-02 11:44:34 -08:00
zfs_ioctl.c Illumos #1644, #1645, #1646, #1647, #1708 2012-07-31 09:25:30 -07:00
zfs_log.c Drop HAVE_XVATTR macros 2011-03-02 11:44:34 -08:00
zfs_onexit.c Add linux kernel device support 2010-08-31 13:41:50 -07:00
zfs_replay.c Use Linux ATTR_ versions 2011-03-03 11:29:15 -08:00
zfs_rlock.c Range lock performance improvements 2011-03-08 12:44:06 -08:00
zfs_sa.c Use SA_HDL_PRIVATE for SA xattrs 2012-03-02 13:20:48 -08:00
zfs_vfsops.c Linux 3.4 compat, d_make_root() replaces d_alloc_root() 2012-06-11 10:04:49 -07:00
zfs_vnops.c Add .zfs control directory 2012-03-22 13:03:47 -07:00
zfs_znode.c Add .zfs control directory 2012-03-22 13:03:47 -07:00
zil.c Add ZIL statistics. 2012-06-29 09:56:51 -07:00
zio_checksum.c Update core ZFS code from build 121 to build 141. 2010-05-28 13:45:14 -07:00
zio_compress.c Update core ZFS code from build 121 to build 141. 2010-05-28 13:45:14 -07:00
zio_inject.c Add missing ZFS tunables 2011-05-04 10:02:37 -07:00
zio.c Illumos #1909: disk sync write perf regression when slog is used post oi_148 2012-04-19 16:26:29 -07:00
zle.c Update core ZFS code from build 121 to build 141. 2010-05-28 13:45:14 -07:00
zpl_ctldir.c Linux 3.3 compat, iops->create()/mkdir()/mknod() 2012-04-30 12:52:38 -07:00
zpl_export.c Linux 3.5 compat, eops->encode_fh() takes inodes 2012-07-23 12:29:23 -07:00
zpl_file.c Support the fallocate() file operation. 2012-02-09 16:19:32 -08:00
zpl_inode.c Linux 3.5 compat, iops->truncate_range() removed 2012-07-23 12:29:32 -07:00
zpl_super.c Linux 3.5 compat, end_writeback() changed to clear_inode() 2012-07-23 12:29:36 -07:00
zpl_xattr.c Add missing NULL in zpl_xattr_handlers 2012-03-15 15:18:29 -07:00
zrlock.c Export ZFS symbols needed by Lustre. 2010-09-17 16:24:15 -07:00
zvol.c Limit the number of blocks to discard at once. 2012-07-31 09:46:09 -07:00