aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2019-10-16 09:04:53 +0000
committerAndriy Gapon <avg@FreeBSD.org>2019-10-16 09:04:53 +0000
commit786c532a8f4de4f86e32a5a566db06ba93a74d0d (patch)
treef248fa08ebb43ee51b3997c99b33d464502528bd /cddl/contrib/opensolaris
parent758a35d0bcecb855dd9850a6b145f912c3be6def (diff)
parentaa3ceb5baedc4e65cbde7a334ca6b82f0569b192 (diff)
downloadsrc-786c532a8f4de4f86e32a5a566db06ba93a74d0d.tar.gz
src-786c532a8f4de4f86e32a5a566db06ba93a74d0d.zip
MFV r348596: 9689 zfs range lock code should not be zpl-specific
illumos/illumos-gate@7931524763ef94dc16989451dddd206563d03bb4 FreeBSD note: some tweaking was needed to avoid a conflict with sys/rangelock.h. Author: Matthew Ahrens <mahrens@delphix.com> Obtained from: illumos MFC after: 3 weeks
Notes
Notes: svn path=/head/; revision=353634
Diffstat (limited to 'cddl/contrib/opensolaris')
-rw-r--r--cddl/contrib/opensolaris/cmd/ztest/ztest.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/cddl/contrib/opensolaris/cmd/ztest/ztest.c b/cddl/contrib/opensolaris/cmd/ztest/ztest.c
index e4382d0f3959..25fc77f75b9a 100644
--- a/cddl/contrib/opensolaris/cmd/ztest/ztest.c
+++ b/cddl/contrib/opensolaris/cmd/ztest/ztest.c
@@ -242,7 +242,9 @@ typedef struct bufwad {
} bufwad_t;
/*
- * XXX -- fix zfs range locks to be generic so we can use them here.
+ * It would be better to use a rangelock_t per object. Unfortunately
+ * the rangelock_t is not a drop-in replacement for rl_t, because we
+ * still need to map from object ID to rangelock_t.
*/
typedef enum {
RL_READER,
@@ -1943,12 +1945,12 @@ static void
ztest_get_done(zgd_t *zgd, int error)
{
ztest_ds_t *zd = zgd->zgd_private;
- uint64_t object = zgd->zgd_rl->rl_object;
+ uint64_t object = ((rl_t *)zgd->zgd_lr)->rl_object;
if (zgd->zgd_db)
dmu_buf_rele(zgd->zgd_db, zgd);
- ztest_range_unlock(zgd->zgd_rl);
+ ztest_range_unlock((rl_t *)zgd->zgd_lr);
ztest_object_unlock(zd, object);
umem_free(zgd, sizeof (*zgd));
@@ -1998,8 +2000,8 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb,
zgd->zgd_private = zd;
if (buf != NULL) { /* immediate write */
- zgd->zgd_rl = ztest_range_lock(zd, object, offset, size,
- RL_READER);
+ zgd->zgd_lr = (struct locked_range *)ztest_range_lock(zd,
+ object, offset, size, RL_READER);
error = dmu_read(os, object, offset, size, buf,
DMU_READ_NO_PREFETCH);
@@ -2013,8 +2015,8 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb,
offset = 0;
}
- zgd->zgd_rl = ztest_range_lock(zd, object, offset, size,
- RL_READER);
+ zgd->zgd_lr = (struct locked_range *)ztest_range_lock(zd,
+ object, offset, size, RL_READER);
error = dmu_buf_hold(os, object, offset, zgd, &db,
DMU_READ_NO_PREFETCH);