diff options
author | delphij <delphij@FreeBSD.org> | 2014-07-23 00:35:06 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2014-07-23 00:35:06 +0000 |
commit | ffc18ded5bc79502d527f9ff35220d2a5e579225 (patch) | |
tree | bf62623a34aeeb725ec83c3dca937146ba6420fa /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c | |
parent | dc97077d62c55c6f91988f073e9e645c3eb7a5ee (diff) | |
download | FreeBSD-src-ffc18ded5bc79502d527f9ff35220d2a5e579225.zip FreeBSD-src-ffc18ded5bc79502d527f9ff35220d2a5e579225.tar.gz |
MFC r268464: MFV r268452:
Explicitly mark file removal transactions as "presumed to result
in a net free of space" so they will not fail with ENOSPC.
Illumos issue: 4950 files sometimes can't be removed from a full
filesystem
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c index 1213d91..ed9757e 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 2013 by Delphix. All rights reserved. + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. */ #include <sys/dmu.h> @@ -583,6 +583,32 @@ dmu_tx_count_free(dmu_tx_hold_t *txh, uint64_t off, uint64_t len) txh->txh_space_tounref += unref; } +/* + * This function marks the transaction as being a "net free". The end + * result is that refquotas will be disabled for this transaction, and + * this transaction will be able to use half of the pool space overhead + * (see dsl_pool_adjustedsize()). Therefore this function should only + * be called for transactions that we expect will not cause a net increase + * in the amount of space used (but it's OK if that is occasionally not true). + */ +void +dmu_tx_mark_netfree(dmu_tx_t *tx) +{ + dmu_tx_hold_t *txh; + + txh = dmu_tx_hold_object_impl(tx, tx->tx_objset, + DMU_NEW_OBJECT, THT_FREE, 0, 0); + + /* + * Pretend that this operation will free 1GB of space. This + * should be large enough to cancel out the largest write. + * We don't want to use something like UINT64_MAX, because that would + * cause overflows when doing math with these values (e.g. in + * dmu_tx_try_assign()). + */ + txh->txh_space_tofree = txh->txh_space_tounref = 1024 * 1024 * 1024; +} + void dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64_t off, uint64_t len) { |