aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/dsl_dir.c
diff options
context:
space:
mode:
authorUmer Saleem <[email protected]>2022-08-25 02:20:43 +0500
committerGitHub <[email protected]>2022-08-24 14:20:43 -0700
commita582d52993134905f2e96cebe7aff410f29b1ad8 (patch)
treea0e38110e95219d814eaadd0c944aa6b45556e05 /module/zfs/dsl_dir.c
parent0c4064d9a08ca2cf601ad1010e7cfd3f917cb991 (diff)
Updates for snapshots_changed property
Currently, snapshots_changed property is stored in dd_props_zapobj, due to which the property is assumed to be local. This causes a difference in behavior with respect to other readonly properties. This commit stores the snapshots_changed property in dd_object. Source is not set to local in this case, which makes it consistent with other readonly properties. This commit also updates the date string format to include seconds. Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Umer Saleem <[email protected]> Closes #13785
Diffstat (limited to 'module/zfs/dsl_dir.c')
-rw-r--r--module/zfs/dsl_dir.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c
index 5a64e399c..746026938 100644
--- a/module/zfs/dsl_dir.c
+++ b/module/zfs/dsl_dir.c
@@ -268,13 +268,15 @@ dsl_dir_hold_obj(dsl_pool_t *dp, uint64_t ddobj,
}
}
- inode_timespec_t t = {0};
- zap_lookup(dd->dd_pool->dp_meta_objset,
- dsl_dir_phys(dd)->dd_props_zapobj,
- zfs_prop_to_name(ZFS_PROP_SNAPSHOTS_CHANGED),
- sizeof (uint64_t),
- sizeof (inode_timespec_t) / sizeof (uint64_t), &t);
- dd->dd_snap_cmtime = t;
+ if (dsl_dir_is_zapified(dd)) {
+ inode_timespec_t t = {0};
+ zap_lookup(dp->dp_meta_objset, ddobj,
+ zfs_prop_to_name(ZFS_PROP_SNAPSHOTS_CHANGED),
+ sizeof (uint64_t),
+ sizeof (inode_timespec_t) / sizeof (uint64_t),
+ &t);
+ dd->dd_snap_cmtime = t;
+ }
dmu_buf_init_user(&dd->dd_dbu, NULL, dsl_dir_evict_async,
&dd->dd_dbuf);
@@ -2251,16 +2253,23 @@ dsl_dir_snap_cmtime(dsl_dir_t *dd)
void
dsl_dir_snap_cmtime_update(dsl_dir_t *dd, dmu_tx_t *tx)
{
+ dsl_pool_t *dp = dmu_tx_pool(tx);
inode_timespec_t t;
- objset_t *mos = dd->dd_pool->dp_meta_objset;
- uint64_t zapobj = dsl_dir_phys(dd)->dd_props_zapobj;
- const char *prop_name = zfs_prop_to_name(ZFS_PROP_SNAPSHOTS_CHANGED);
-
gethrestime(&t);
+
mutex_enter(&dd->dd_lock);
dd->dd_snap_cmtime = t;
- VERIFY0(zap_update(mos, zapobj, prop_name, sizeof (uint64_t),
- sizeof (inode_timespec_t) / sizeof (uint64_t), &t, tx));
+ if (spa_feature_is_enabled(dp->dp_spa,
+ SPA_FEATURE_EXTENSIBLE_DATASET)) {
+ objset_t *mos = dd->dd_pool->dp_meta_objset;
+ uint64_t ddobj = dd->dd_object;
+ dsl_dir_zapify(dd, tx);
+ VERIFY0(zap_update(mos, ddobj,
+ zfs_prop_to_name(ZFS_PROP_SNAPSHOTS_CHANGED),
+ sizeof (uint64_t),
+ sizeof (inode_timespec_t) / sizeof (uint64_t),
+ &t, tx));
+ }
mutex_exit(&dd->dd_lock);
}