7104 increase indirect block size

illumos/illumos-gate@4b5c8e93ca
4b5c8e93ca

https://www.illumos.org/issues/7104
  The current default indirect block size is 16KB. We can improve
  performance by increasing it to 128KB. This is especially helpful for
  any workload that needs to read most of the metadata, e.g.
  scrub/resilver, file deletion, filesystem deletion, and zfs send.
  We also need to fix a few space estimation errors to make the tests
  pass.

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Matthew Ahrens <mahrens@delphix.com>
This commit is contained in:
Andriy Gapon 2016-07-18 07:03:39 +00:00
parent 869ea71a92
commit 6155b9e07c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor-sys/illumos/dist/; revision=302993
4 changed files with 27 additions and 7 deletions

View File

@ -787,11 +787,17 @@ dmu_objset_create_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp,
/* /*
* Determine the number of levels necessary for the meta-dnode * Determine the number of levels necessary for the meta-dnode
* to contain DN_MAX_OBJECT dnodes. * to contain DN_MAX_OBJECT dnodes. Note that in order to
* ensure that we do not overflow 64 bits, there has to be
* a nlevels that gives us a number of blocks > DN_MAX_OBJECT
* but < 2^64. Therefore,
* (mdn->dn_indblkshift - SPA_BLKPTRSHIFT) (10) must be
* less than (64 - log2(DN_MAX_OBJECT)) (16).
*/ */
while ((uint64_t)mdn->dn_nblkptr << (mdn->dn_datablkshift + while ((uint64_t)mdn->dn_nblkptr <<
(mdn->dn_datablkshift - DNODE_SHIFT +
(levels - 1) * (mdn->dn_indblkshift - SPA_BLKPTRSHIFT)) < (levels - 1) * (mdn->dn_indblkshift - SPA_BLKPTRSHIFT)) <
DN_MAX_OBJECT * sizeof (dnode_phys_t)) DN_MAX_OBJECT)
levels++; levels++;
mdn->dn_next_nlevels[tx->tx_txg & TXG_MASK] = mdn->dn_next_nlevels[tx->tx_txg & TXG_MASK] =

View File

@ -341,9 +341,14 @@ int spa_asize_inflation = 24;
* it is possible to run the pool completely out of space, causing it to * it is possible to run the pool completely out of space, causing it to
* be permanently read-only. * be permanently read-only.
* *
* Note that on very small pools, the slop space will be larger than
* 3.2%, in an effort to have it be at least spa_min_slop (128MB),
* but we never allow it to be more than half the pool size.
*
* See also the comments in zfs_space_check_t. * See also the comments in zfs_space_check_t.
*/ */
int spa_slop_shift = 5; int spa_slop_shift = 5;
uint64_t spa_min_slop = 128 * 1024 * 1024;
/* /*
* ========================================================================== * ==========================================================================
@ -1637,14 +1642,16 @@ spa_get_asize(spa_t *spa, uint64_t lsize)
/* /*
* Return the amount of slop space in bytes. It is 1/32 of the pool (3.2%), * Return the amount of slop space in bytes. It is 1/32 of the pool (3.2%),
* or at least 32MB. * or at least 128MB, unless that would cause it to be more than half the
* pool size.
* *
* See the comment above spa_slop_shift for details. * See the comment above spa_slop_shift for details.
*/ */
uint64_t uint64_t
spa_get_slop_space(spa_t *spa) { spa_get_slop_space(spa_t *spa)
{
uint64_t space = spa_get_dspace(spa); uint64_t space = spa_get_dspace(spa);
return (MAX(space >> spa_slop_shift, SPA_MINDEVSIZE >> 1)); return (MAX(space >> spa_slop_shift, MIN(space >> 1, spa_min_slop)));
} }
uint64_t uint64_t

View File

@ -58,7 +58,7 @@ extern "C" {
*/ */
#define DNODE_SHIFT 9 /* 512 bytes */ #define DNODE_SHIFT 9 /* 512 bytes */
#define DN_MIN_INDBLKSHIFT 12 /* 4k */ #define DN_MIN_INDBLKSHIFT 12 /* 4k */
#define DN_MAX_INDBLKSHIFT 14 /* 16k */ #define DN_MAX_INDBLKSHIFT 17 /* 128k */
#define DNODE_BLOCK_SHIFT 14 /* 16k */ #define DNODE_BLOCK_SHIFT 14 /* 16k */
#define DNODE_CORE_SIZE 64 /* 64 bytes for dnode sans blkptrs */ #define DNODE_CORE_SIZE 64 /* 64 bytes for dnode sans blkptrs */
#define DN_MAX_OBJECT_SHIFT 48 /* 256 trillion (zfs_fid_t limit) */ #define DN_MAX_OBJECT_SHIFT 48 /* 256 trillion (zfs_fid_t limit) */
@ -88,6 +88,11 @@ extern "C" {
#define DNODES_PER_BLOCK_SHIFT (DNODE_BLOCK_SHIFT - DNODE_SHIFT) #define DNODES_PER_BLOCK_SHIFT (DNODE_BLOCK_SHIFT - DNODE_SHIFT)
#define DNODES_PER_BLOCK (1ULL << DNODES_PER_BLOCK_SHIFT) #define DNODES_PER_BLOCK (1ULL << DNODES_PER_BLOCK_SHIFT)
/*
* This is inaccurate if the indblkshift of the particular object is not the
* max. But it's only used by userland to calculate the zvol reservation.
*/
#define DNODES_PER_LEVEL_SHIFT (DN_MAX_INDBLKSHIFT - SPA_BLKPTRSHIFT) #define DNODES_PER_LEVEL_SHIFT (DN_MAX_INDBLKSHIFT - SPA_BLKPTRSHIFT)
#define DNODES_PER_LEVEL (1ULL << DNODES_PER_LEVEL_SHIFT) #define DNODES_PER_LEVEL (1ULL << DNODES_PER_LEVEL_SHIFT)

View File

@ -600,6 +600,8 @@ typedef struct zpool_rewind_policy {
/* /*
* This is needed in userland to report the minimum necessary device size. * This is needed in userland to report the minimum necessary device size.
*
* Note that the zfs test suite uses 64MB vdevs.
*/ */
#define SPA_MINDEVSIZE (64ULL << 20) #define SPA_MINDEVSIZE (64ULL << 20)