svn commit: r339120 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys
Alexander Motin
mav at FreeBSD.org
Wed Oct 3 03:14:42 UTC 2018
Author: mav
Date: Wed Oct 3 03:14:40 2018
New Revision: 339120
URL: https://svnweb.freebsd.org/changeset/base/339120
Log:
MFC r337169: MFV r337167: 9442 decrease indirect block size of spacemaps
Updates to indirect blocks of spacemaps can contribute significantly to
write inflation. Therefore we want to reduce the indirect block size of
spacemaps from 128K to 16K.
illumos/illumos-gate at 221813c13b43ef48330b03725e00edee85108cf1
Reviewed by: Serapheim Dimitropoulos <serapheim.dimitro at delphix.com>
Reviewed by: George Wilson <george.wilson at delphix.com>
Reviewed by: Albert Lee <trisk at forkgnu.org>
Reviewed by: Igor Kozhukhov <igor at dilos.org>
Approved by: Dan McDonald <danmcd at joyent.com>
Author: Matthew Ahrens <mahrens at delphix.com>
Modified:
stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c
stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c
stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c
==============================================================================
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Wed Oct 3 03:13:53 2018 (r339119)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c Wed Oct 3 03:14:40 2018 (r339120)
@@ -32,7 +32,8 @@
#include <sys/zfeature.h>
uint64_t
-dmu_object_alloc(objset_t *os, dmu_object_type_t ot, int blocksize,
+dmu_object_alloc_ibs(objset_t *os, dmu_object_type_t ot, int blocksize,
+ int indirect_blockshift,
dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx)
{
uint64_t object;
@@ -92,13 +93,22 @@ dmu_object_alloc(objset_t *os, dmu_object_type_t ot, i
os->os_obj_next = object - 1;
}
- dnode_allocate(dn, ot, blocksize, 0, bonustype, bonuslen, tx);
+ dnode_allocate(dn, ot, blocksize, indirect_blockshift,
+ bonustype, bonuslen, tx);
mutex_exit(&os->os_obj_lock);
dmu_tx_add_new_object(tx, dn);
dnode_rele(dn, FTAG);
return (object);
+}
+
+uint64_t
+dmu_object_alloc(objset_t *os, dmu_object_type_t ot, int blocksize,
+ dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx)
+{
+ return (dmu_object_alloc_ibs(os, ot, blocksize, 0,
+ bonustype, bonuslen, tx));
}
int
Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c
==============================================================================
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c Wed Oct 3 03:13:53 2018 (r339119)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c Wed Oct 3 03:14:40 2018 (r339120)
@@ -54,6 +54,17 @@ SYSCTL_DECL(_vfs_zfs);
*/
boolean_t zfs_force_some_double_word_sm_entries = B_FALSE;
+/*
+ * Override the default indirect block size of 128K, instead using 16K for
+ * spacemaps (2^14 bytes). This dramatically reduces write inflation since
+ * appending to a spacemap typically has to write one data block (4KB) and one
+ * or two indirect blocks (16K-32K, rather than 128K).
+ */
+int space_map_ibs = 14;
+
+SYSCTL_INT(_vfs_zfs, OID_AUTO, space_map_ibs, CTLFLAG_RWTUN,
+ &space_map_ibs, 0, "Space map indirect block shift");
+
boolean_t
sm_entry_is_debug(uint64_t e)
{
@@ -676,8 +687,8 @@ space_map_write_impl(space_map_t *sm, range_tree_t *rt
*
* [1] The feature is enabled.
* [2] The offset or run is too big for a single-word entry,
- * or the vdev_id is set (meaning not equal to
- * SM_NO_VDEVID).
+ * or the vdev_id is set (meaning not equal to
+ * SM_NO_VDEVID).
*
* Note that for purposes of testing we've added the case that
* we write two-word entries occasionally when the feature is
@@ -836,7 +847,8 @@ space_map_truncate(space_map_t *sm, int blocksize, dmu
*/
if ((spa_feature_is_enabled(spa, SPA_FEATURE_SPACEMAP_HISTOGRAM) &&
doi.doi_bonus_size != sizeof (space_map_phys_t)) ||
- doi.doi_data_block_size != blocksize) {
+ doi.doi_data_block_size != blocksize ||
+ doi.doi_metadata_block_size != 1 << space_map_ibs) {
zfs_dbgmsg("txg %llu, spa %s, sm %p, reallocating "
"object[%llu]: old bonus %u, old blocksz %u",
dmu_tx_get_txg(tx), spa_name(spa), sm, sm->sm_object,
@@ -892,8 +904,8 @@ space_map_alloc(objset_t *os, int blocksize, dmu_tx_t
bonuslen = SPACE_MAP_SIZE_V0;
}
- object = dmu_object_alloc(os, DMU_OT_SPACE_MAP, blocksize,
- DMU_OT_SPACE_MAP_HEADER, bonuslen, tx);
+ object = dmu_object_alloc_ibs(os, DMU_OT_SPACE_MAP, blocksize,
+ space_map_ibs, DMU_OT_SPACE_MAP_HEADER, bonuslen, tx);
return (object);
}
Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
==============================================================================
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Oct 3 03:13:53 2018 (r339119)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Wed Oct 3 03:14:40 2018 (r339120)
@@ -356,6 +356,9 @@ typedef struct dmu_buf {
*/
uint64_t dmu_object_alloc(objset_t *os, dmu_object_type_t ot,
int blocksize, dmu_object_type_t bonus_type, int bonus_len, dmu_tx_t *tx);
+uint64_t dmu_object_alloc_ibs(objset_t *os, dmu_object_type_t ot, int blocksize,
+ int indirect_blockshift,
+ dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx);
int dmu_object_claim(objset_t *os, uint64_t object, dmu_object_type_t ot,
int blocksize, dmu_object_type_t bonus_type, int bonus_len, dmu_tx_t *tx);
int dmu_object_reclaim(objset_t *os, uint64_t object, dmu_object_type_t ot,
More information about the svn-src-all
mailing list