diff options
Diffstat (limited to 'usr/src/uts/common')
-rw-r--r-- | usr/src/uts/common/fs/dnlc.c | 15 | ||||
-rw-r--r-- | usr/src/uts/common/fs/lookup.c | 1 | ||||
-rw-r--r-- | usr/src/uts/common/fs/zfs/dbuf.c | 18 | ||||
-rw-r--r-- | usr/src/uts/common/fs/zfs/dmu_send.c | 15 | ||||
-rw-r--r-- | usr/src/uts/common/sys/dnlc.h | 1 |
5 files changed, 29 insertions, 21 deletions
diff --git a/usr/src/uts/common/fs/dnlc.c b/usr/src/uts/common/fs/dnlc.c index 32ac33c879..0ec57ff7f7 100644 --- a/usr/src/uts/common/fs/dnlc.c +++ b/usr/src/uts/common/fs/dnlc.c @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Joyent, Inc. * Copyright (c) 2017 by Delphix. All rights reserved. */ @@ -67,12 +68,12 @@ /* * We want to be able to identify files that are referenced only by the DNLC. * When adding a reference from the DNLC, call VN_HOLD_DNLC instead of VN_HOLD, - * since multiple DNLC references should only be counted once in v_count. This - * file contains only two(2) calls to VN_HOLD, renamed VN_HOLD_CALLER in the - * hope that no one will mistakenly add a VN_HOLD to this file. (Unfortunately - * it is not possible to #undef VN_HOLD and retain VN_HOLD_CALLER. Ideally a - * Makefile rule would grep uncommented C tokens to check that VN_HOLD is - * referenced only once in this file, to define VN_HOLD_CALLER.) + * since multiple DNLC references should only be counted once in v_count. The + * VN_HOLD macro itself is aliased to VN_HOLD_CALLER in this file to help + * differentiate the behaviors. (Unfortunately it is not possible to #undef + * VN_HOLD and retain VN_HOLD_CALLER. Ideally a Makefile rule would grep + * uncommented C tokens to check that VN_HOLD is referenced only once in this + * file, to define VN_HOLD_CALLER.) */ #define VN_HOLD_CALLER VN_HOLD #define VN_HOLD_DNLC(vp) { \ @@ -634,7 +635,7 @@ dnlc_lookup(vnode_t *dp, const char *name) * put a hold on it. */ vp = ncp->vp; - VN_HOLD_CALLER(vp); /* VN_HOLD 1 of 2 in this file */ + VN_HOLD_CALLER(vp); mutex_exit(&hp->hash_lock); ncstats.hits++; ncs.ncs_hits.value.ui64++; diff --git a/usr/src/uts/common/fs/lookup.c b/usr/src/uts/common/fs/lookup.c index 7dc83ff8d5..789509ecfb 100644 --- a/usr/src/uts/common/fs/lookup.c +++ b/usr/src/uts/common/fs/lookup.c @@ -23,6 +23,7 @@ * Copyright 2015 Nexenta Systems, Inc. All rights reserved. * Copyright 2016 Joyent, Inc. * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Joyent, Inc. */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ diff --git a/usr/src/uts/common/fs/zfs/dbuf.c b/usr/src/uts/common/fs/zfs/dbuf.c index b2e6595190..7168e848ca 100644 --- a/usr/src/uts/common/fs/zfs/dbuf.c +++ b/usr/src/uts/common/fs/zfs/dbuf.c @@ -561,19 +561,15 @@ dbuf_evict_notify(void) if (tsd_get(zfs_dbuf_evict_key) != NULL) return; + /* + * We check if we should evict without holding the dbuf_evict_lock, + * because it's OK to occasionally make the wrong decision here, + * and grabbing the lock results in massive lock contention. + */ if (refcount_count(&dbuf_cache_size) > dbuf_cache_max_bytes) { - boolean_t evict_now = B_FALSE; - - mutex_enter(&dbuf_evict_lock); - if (refcount_count(&dbuf_cache_size) > dbuf_cache_max_bytes) { - evict_now = dbuf_cache_above_hiwater(); - cv_signal(&dbuf_evict_cv); - } - mutex_exit(&dbuf_evict_lock); - - if (evict_now) { + if (dbuf_cache_above_hiwater()) dbuf_evict_one(); - } + cv_signal(&dbuf_evict_cv); } } diff --git a/usr/src/uts/common/fs/zfs/dmu_send.c b/usr/src/uts/common/fs/zfs/dmu_send.c index c9a79b94e8..92f24cd7f2 100644 --- a/usr/src/uts/common/fs/zfs/dmu_send.c +++ b/usr/src/uts/common/fs/zfs/dmu_send.c @@ -1102,10 +1102,17 @@ dmu_adjust_send_estimate_for_indirects(dsl_dataset_t *ds, uint64_t uncompressed, */ uint64_t recordsize; uint64_t record_count; + objset_t *os; + VERIFY0(dmu_objset_from_ds(ds, &os)); /* Assume all (uncompressed) blocks are recordsize. */ - err = dsl_prop_get_int_ds(ds, zfs_prop_to_name(ZFS_PROP_RECORDSIZE), - &recordsize); + if (os->os_phys->os_type == DMU_OST_ZVOL) { + err = dsl_prop_get_int_ds(ds, + zfs_prop_to_name(ZFS_PROP_VOLBLOCKSIZE), &recordsize); + } else { + err = dsl_prop_get_int_ds(ds, + zfs_prop_to_name(ZFS_PROP_RECORDSIZE), &recordsize); + } if (err != 0) return (err); record_count = uncompressed / recordsize; @@ -1174,6 +1181,10 @@ dmu_send_estimate(dsl_dataset_t *ds, dsl_dataset_t *fromds, err = dmu_adjust_send_estimate_for_indirects(ds, uncomp, comp, stream_compressed, sizep); + /* + * Add the size of the BEGIN and END records to the estimate. + */ + *sizep += 2 * sizeof (dmu_replay_record_t); return (err); } diff --git a/usr/src/uts/common/sys/dnlc.h b/usr/src/uts/common/sys/dnlc.h index 070506ee31..26f1f1dc0c 100644 --- a/usr/src/uts/common/sys/dnlc.h +++ b/usr/src/uts/common/sys/dnlc.h @@ -187,7 +187,6 @@ void dnlc_purge_vp(vnode_t *); int dnlc_purge_vfsp(vfs_t *, int); void dnlc_remove(vnode_t *, const char *); int dnlc_fs_purge1(struct vnodeops *); -vnode_t *dnlc_reverse_lookup(vnode_t *, char *, size_t); void dnlc_reduce_cache(void *); #endif /* defined(_KERNEL) */ |