Skip to content

Commit

Permalink
OpenZFS 7104 - increase indirect block size
Browse files Browse the repository at this point in the history
Authored by: Matthew Ahrens <[email protected]>
Reviewed by: George Wilson <[email protected]>
Reviewed by: Paul Dagnelie <[email protected]>
Reviewed by: Dan McDonald <[email protected]>
Approved by: Robert Mustacchi <[email protected]>
Ported-by: George Melikov <[email protected]>

OpenZFS-issue: https://www.illumos.org/issues/7104
OpenZFS-commit: openzfs/openzfs@4b5c8e9

TEST_ZILTEST_SKIP="yes"
TEST_ZFSTESTS_DISKSIZE=4G
  • Loading branch information
ahrens authored and gmelikov committed Feb 2, 2017
1 parent fc386db commit d4dc1d9
Show file tree
Hide file tree
Showing 52 changed files with 211 additions and 152 deletions.
7 changes: 6 additions & 1 deletion include/sys/dnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ extern "C" {
* 4 levels of indirect blocks would not be able to guarantee addressing an
* entire object, so 5 levels will be used, but 5 * (20 - 7) = 65.
*/
#define DN_MAX_INDBLKSHIFT 14 /* 16k */
#define DN_MAX_INDBLKSHIFT 17 /* 128k */
#define DNODE_BLOCK_SHIFT 14 /* 16k */
#define DNODE_CORE_SIZE 64 /* 64 bytes for dnode sans blkptrs */
#define DN_MAX_OBJECT_SHIFT 48 /* 256 trillion (zfs_fid_t limit) */
Expand Down Expand Up @@ -101,6 +101,11 @@ extern "C" {

#define DNODES_PER_BLOCK_SHIFT (DNODE_BLOCK_SHIFT - DNODE_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 (1ULL << DNODES_PER_LEVEL_SHIFT)

Expand Down
12 changes: 9 additions & 3 deletions module/zfs/dmu_objset.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,11 +858,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
* 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)) <
DN_MAX_OBJECT * sizeof (dnode_phys_t))
DN_MAX_OBJECT)
levels++;

mdn->dn_next_nlevels[tx->tx_txg & TXG_MASK] =
Expand Down
10 changes: 8 additions & 2 deletions module/zfs/spa_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,14 @@ int spa_asize_inflation = 24;
* it is possible to run the pool completely out of space, causing it to
* 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.
*/
int spa_slop_shift = 5;
uint64_t spa_min_slop = 128 * 1024 * 1024;

/*
* ==========================================================================
Expand Down Expand Up @@ -1617,15 +1622,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%),
* 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.
*/
uint64_t
spa_get_slop_space(spa_t *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
Expand Down
2 changes: 1 addition & 1 deletion scripts/zconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ test_6() {
# Create a pool and volume.
${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 1
${ZPOOL_CREATE_SH} -p ${POOL_NAME} -c lo-raid0 || fail 2
${ZFS} create -V 800M ${FULL_ZVOL_NAME} || fail 3
${ZFS} create -s -V 800M ${FULL_ZVOL_NAME} || fail 3
${ZFS} set snapdev=visible ${FULL_ZVOL_NAME} || fail 3
label /dev/zvol/${FULL_ZVOL_NAME} msdos || fail 4
partition /dev/zvol/${FULL_ZVOL_NAME} primary 1 -1 || fail 4
Expand Down
4 changes: 2 additions & 2 deletions scripts/zfs-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ QUIET=
CLEANUP=1
CLEANUPALL=0
LOOPBACK=1
FILESIZE="2G"
FILESIZE="4G"
RUNFILE=${RUNFILE:-"linux.run"}
FILEDIR=${FILEDIR:-/var/tmp}
DISKS=${DISKS:-""}
Expand Down Expand Up @@ -165,7 +165,7 @@ OPTIONS:
-k Disable cleanup after test failure
-f Use files only, disables block device tests
-d DIR Use DIR for files and loopback devices
-s SIZE Use vdevs of SIZE (default: 2G)
-s SIZE Use vdevs of SIZE (default: 4G)
-r RUNFILE Run tests in RUNFILE (default: linux.run)
EXAMPLES:
Expand Down
3 changes: 2 additions & 1 deletion tests/runfiles/linux.run
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,8 @@ tests = ['quota_001_pos', 'quota_002_pos', 'quota_003_pos',
tests = ['raidz_001_neg', 'raidz_002_pos']

[tests/functional/redundancy]
tests = ['redundancy_001_pos', 'redundancy_002_pos', 'redundancy_003_pos']
tests = ['redundancy_001_pos', 'redundancy_002_pos', 'redundancy_003_pos',
'redundancy_004_neg']

[tests/functional/refquota]
tests = ['refquota_001_pos', 'refquota_002_pos', 'refquota_003_pos',
Expand Down
6 changes: 6 additions & 0 deletions tests/zfs-tests/include/default.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ export BIGVOLSIZE=1eb
# Default to limit disks to be checked
export MAX_FINDDISKSNUM=6

# Default minimum size for file based vdevs in the test suite
export MINVDEVSIZE=$((256 * 1024 * 1024))

# Minimum vdev size possible as defined in the OS
export SPA_MINDEVSIZE=$((64 * 1024 * 1024))

# For iscsi target support
export ISCSITGTFILE=/tmp/iscsitgt_file
export ISCSITGT_FMRI=svc:/system/iscsitgt:default
Expand Down
4 changes: 2 additions & 2 deletions tests/zfs-tests/include/libtest.shlib
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,7 @@ function zfs_zones_setup #zone_name zone_root zone_ip
#
if verify_slog_support ; then
typeset sdevs="/var/tmp/sdev1 /var/tmp/sdev2"
log_must $MKFILE 100M $sdevs
log_must $MKFILE $MINVDEVSIZE $sdevs
log_must $ZPOOL add $pool_name log mirror $sdevs
fi

Expand Down Expand Up @@ -2512,7 +2512,7 @@ function verify_slog_support
typeset sdev=$dir/b

$MKDIR -p $dir
$MKFILE 64M $vdev $sdev
$MKFILE $MINVDEVSIZE $vdev $sdev

typeset -i ret=0
if ! $ZPOOL create -n $pool $vdev log $sdev > /dev/null 2>&1; then
Expand Down
6 changes: 5 additions & 1 deletion tests/zfs-tests/tests/functional/bootfs/bootfs_001_pos.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
# Copyright 2015 Nexenta Systems, Inc.
#

#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
#

. $STF_SUITE/include/libtest.shlib

#
Expand Down Expand Up @@ -62,7 +66,7 @@ log_onexit cleanup

typeset VDEV=$TESTDIR/bootfs_001_pos_a.$$.dat

log_must $MKFILE 400m $VDEV
log_must $MKFILE $MINVDEVSIZE $VDEV
create_pool "$TESTPOOL" "$VDEV"
log_must $ZFS create $TESTPOOL/$TESTFS

Expand Down
4 changes: 4 additions & 0 deletions tests/zfs-tests/tests/functional/bootfs/bootfs_002_neg.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
# Copyright 2015 Nexenta Systems, Inc.
#

#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
#

. $STF_SUITE/include/libtest.shlib

#
Expand Down
6 changes: 5 additions & 1 deletion tests/zfs-tests/tests/functional/bootfs/bootfs_003_pos.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
# Use is subject to license terms.
#

#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
#

. $STF_SUITE/include/libtest.shlib

#
Expand Down Expand Up @@ -59,7 +63,7 @@ fi
log_onexit cleanup

log_assert "Valid pool names are accepted by zpool set bootfs"
$MKFILE 64m $TESTDIR/bootfs_003.$$.dat
$MKFILE $MINVDEVSIZE $TESTDIR/bootfs_003.$$.dat

typeset -i i=0;

Expand Down
6 changes: 5 additions & 1 deletion tests/zfs-tests/tests/functional/bootfs/bootfs_004_neg.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
# Use is subject to license terms.
#

#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
#

. $STF_SUITE/include/libtest.shlib

#
Expand Down Expand Up @@ -74,7 +78,7 @@ pools[${#pools[@]}]="$bigname"



$MKFILE 64m $TESTDIR/bootfs_004.$$.dat
$MKFILE $MINVDEVSIZE $TESTDIR/bootfs_004.$$.dat

typeset -i i=0;

Expand Down
4 changes: 4 additions & 0 deletions tests/zfs-tests/tests/functional/bootfs/bootfs_005_neg.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
# Use is subject to license terms.
#

#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zpool_upgrade/zpool_upgrade.kshlib

Expand Down
6 changes: 5 additions & 1 deletion tests/zfs-tests/tests/functional/bootfs/bootfs_006_pos.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
# Use is subject to license terms.
#

#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
#

. $STF_SUITE/include/libtest.shlib

#
Expand Down Expand Up @@ -92,7 +96,7 @@ log_assert "Pools of correct vdev types accept boot property"


log_onexit cleanup
log_must $MKFILE 64m $VDEV1 $VDEV2 $VDEV3 $VDEV4
log_must $MKFILE $MINVDEVSIZE $VDEV1 $VDEV2 $VDEV3 $VDEV4


## the following configurations are supported bootable pools
Expand Down
6 changes: 5 additions & 1 deletion tests/zfs-tests/tests/functional/bootfs/bootfs_008_neg.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
# Use is subject to license terms.
#

#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
#

. $STF_SUITE/include/libtest.shlib

#
Expand Down Expand Up @@ -60,7 +64,7 @@ typeset COMP_FS=$TESTPOOL/COMP_FS
log_onexit cleanup
log_assert $assert_msg

log_must $MKFILE 300m $VDEV
log_must $MKFILE $MINVDEVSIZE $VDEV
log_must $ZPOOL create $TESTPOOL $VDEV
log_must $ZFS create $COMP_FS

Expand Down
4 changes: 2 additions & 2 deletions tests/zfs-tests/tests/functional/cache/cache.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#

#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
#

. $STF_SUITE/include/libtest.shlib
Expand Down Expand Up @@ -60,7 +60,7 @@ function set_disks
set_disks
set_device_dir

export SIZE=64M
export SIZE=$MINVDEVSIZE

export VDIR=$TESTDIR/disk.cache
export VDIR2=$TESTDIR/disk2.cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#

#
# Copyright (c) 2013 by Delphix. All rights reserved.
# Copyright (c) 2013, 2015 by Delphix. All rights reserved.
#

. $STF_SUITE/include/libtest.shlib
Expand Down Expand Up @@ -84,7 +84,7 @@ log_must $ZPOOL create $TESTPOOL $DISKS
mntpnt=$(get_prop mountpoint $TESTPOOL)
typeset -i i=0
while ((i < 2)); do
log_must $MKFILE 64M $mntpnt/vdev$i
log_must $MKFILE $MINVDEVSIZE $mntpnt/vdev$i
eval vdev$i=$mntpnt/vdev$i
((i += 1))
done
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#

#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
#

# DESCRIPTION
Expand Down Expand Up @@ -139,7 +139,7 @@ log_must snapexists $TESTPOOL/$TESTFS1@snap3

log_note "zfs destroy for snapshots from different pools"
VIRTUAL_DISK=/var/tmp/disk
log_must $DD if=/dev/urandom of=$VIRTUAL_DISK bs=1M count=64
log_must $MKFILE $MINVDEVSIZE $VIRTUAL_DISK
log_must $ZPOOL create $TESTPOOL2 $VIRTUAL_DISK
log_must poolexists $TESTPOOL2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#

#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
#

. $STF_SUITE/include/libtest.shlib
Expand Down Expand Up @@ -107,9 +107,9 @@ allds="$fs $clone $fssnap $volsnap"

#create pool and datasets to guarantee testing under multiple pools and datasets.
file=$TESTDIR1/poolfile
typeset -i FILESIZE=104857600 #100M
(( DFILESIZE = FILESIZE * 2 )) # double of FILESIZE
typeset -i VOLSIZE=10485760 #10M
typeset FILESIZE=$MINVDEVSIZE
(( DFILESIZE = $FILESIZE * 2 ))
typeset -i VOLSIZE=10485760
availspace=$(get_prop available $TESTPOOL)
typeset -i i=0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#

#
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/cli_root/zfs_rename/zfs_rename.kshlib

Expand Down Expand Up @@ -63,8 +68,7 @@ log_assert "'zfs rename' should fail while datasets are within different pool."

additional_setup

typeset FILESIZE=64m
log_must $MKFILE $FILESIZE $TESTDIR/$TESTFILE1
log_must $MKFILE $MINVDEVSIZE $TESTDIR/$TESTFILE1
create_pool $TESTPOOL1 $TESTDIR/$TESTFILE1

for src in ${src_dataset[@]} ; do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#

#
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright (c) 2012, 2015 by Delphix. All rights reserved.
#

. $STF_SUITE/tests/functional/cli_root/zfs_snapshot/zfs_snapshot.cfg
Expand Down Expand Up @@ -57,8 +57,8 @@ function cleanup
log_assert "'zfs snapshot pool1@snap1 pool2@snap2' should fail since snapshots are in different pools."
log_onexit cleanup

log_must $MKFILE 64m $SNAPDEV1
log_must $MKFILE 64m $SNAPDEV2
log_must $MKFILE $MINVDEVSIZE $SNAPDEV1
log_must $MKFILE $MINVDEVSIZE $SNAPDEV2

log_must $ZPOOL create $SNAPPOOL1 $SNAPDEV1
log_must $ZPOOL create $SNAPPOOL2 $SNAPDEV2
Expand Down
Loading

0 comments on commit d4dc1d9

Please sign in to comment.