Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/cddl/osnet/dist/uts/common/fs/zfs Simplify zfs dirl...
details: https://anonhg.NetBSD.org/src/rev/ada31be66b03
branches: trunk
changeset: 782099:ada31be66b03
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Oct 15 22:43:50 2012 +0000
description:
Simplify zfs dirlock reference counting.
No need to pass dzp around; dl has a pointer to it.
diffstat:
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diffs (70 lines):
diff -r 333b0336d4f3 -r ada31be66b03 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c Mon Oct 15 22:22:01 2012 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_dir.c Mon Oct 15 22:43:50 2012 +0000
@@ -103,11 +103,10 @@
*/
static int
-zfs_dirlock_hold(zfs_dirlock_t *dl, znode_t *dzp)
+zfs_dirlock_hold(zfs_dirlock_t *dl)
{
- (void)dzp; /* ignore */
- KASSERT(mutex_owned(&dzp->z_lock));
+ KASSERT(mutex_owned(&dl->dl_dzp->z_lock));
if (dl->dl_refcnt >= ULONG_MAX) /* XXX Name this constant. */
return (ENFILE); /* XXX What to do? */
@@ -117,11 +116,10 @@
}
static void
-zfs_dirlock_rele(zfs_dirlock_t *dl, znode_t *dzp)
+zfs_dirlock_rele(zfs_dirlock_t *dl)
{
- (void)dzp; /* ignore */
- KASSERT(mutex_owned(&dzp->z_lock));
+ KASSERT(mutex_owned(&dl->dl_dzp->z_lock));
KASSERT(dl->dl_refcnt > 0);
if (--dl->dl_refcnt == 0) {
@@ -291,7 +289,7 @@
}
if ((flag & ZSHARED) && dl->dl_sharecnt != 0)
break;
- error = zfs_dirlock_hold(dl, dzp);
+ error = zfs_dirlock_hold(dl);
if (error) {
mutex_exit(&dzp->z_lock);
if (!(flag & ZHAVELOCK))
@@ -299,7 +297,7 @@
return (error);
}
cv_wait(&dl->dl_cv, &dzp->z_lock);
- zfs_dirlock_rele(dl, dzp);
+ zfs_dirlock_rele(dl);
}
/*
@@ -401,7 +399,7 @@
prev_dl = &cur_dl->dl_next;
*prev_dl = dl->dl_next;
cv_broadcast(&dl->dl_cv);
- zfs_dirlock_rele(dl, dzp);
+ zfs_dirlock_rele(dl);
mutex_exit(&dzp->z_lock);
}
@@ -796,7 +794,11 @@
if (zp_is_dir && !zfs_dirempty(zp)) { /* dir not empty */
mutex_exit(&zp->z_lock);
vn_vfsunlock(vp);
+#ifdef __NetBSD__ /* XXX Make our dumb tests happier... */
+ return (ENOTEMPTY);
+#else
return (EEXIST);
+#endif
}
if (zp->z_phys->zp_links <= zp_is_dir) {
zfs_panic_recover("zfs: link count on vnode %p is %u, "
Home |
Main Index |
Thread Index |
Old Index