mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Add snapshots_changed as property
Make dd_snap_cmtime property persistent across mount and unmount operations by storing in ZAP and restore the value from ZAP on hold into dd_snap_cmtime instead of updating it. Expose dd_snap_cmtime as 'snapshots_changed' property that provides a mechanism to quickly determine whether snapshot list for dataset has changed without having to mount a dataset or iterate the snapshot list. It specifies the time at which a snapshot for a dataset was last created or deleted. This allows us to be more efficient how often we query snapshots. Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Umer Saleem <usaleem@ixsystems.com> Closes #13635
This commit is contained in:
@@ -2398,7 +2398,8 @@
|
||||
<enumerator name='ZFS_PROP_IVSET_GUID' value='92'/>
|
||||
<enumerator name='ZFS_PROP_REDACTED' value='93'/>
|
||||
<enumerator name='ZFS_PROP_REDACT_SNAPS' value='94'/>
|
||||
<enumerator name='ZFS_NUM_PROPS' value='95'/>
|
||||
<enumerator name='ZFS_PROP_SNAPSHOTS_CHANGED' value='95'/>
|
||||
<enumerator name='ZFS_NUM_PROPS' value='96'/>
|
||||
</enum-decl>
|
||||
<typedef-decl name='zfs_prop_t' type-id='4b000d60' id='58603c44'/>
|
||||
<enum-decl name='zfs_userquota_prop_t' naming-typedef-id='279fde6a' id='5258d2f6'>
|
||||
|
||||
@@ -2935,6 +2935,26 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop_t prop, char *propbuf, size_t proplen,
|
||||
zcp_check(zhp, prop, val, NULL);
|
||||
break;
|
||||
|
||||
case ZFS_PROP_SNAPSHOTS_CHANGED:
|
||||
{
|
||||
if ((get_numeric_property(zhp, prop, src, &source,
|
||||
&val) != 0) || val == 0) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
time_t time = (time_t)val;
|
||||
struct tm t;
|
||||
|
||||
if (literal ||
|
||||
localtime_r(&time, &t) == NULL ||
|
||||
strftime(propbuf, proplen, "%a %b %e %k:%M %Y",
|
||||
&t) == 0)
|
||||
(void) snprintf(propbuf, proplen, "%llu",
|
||||
(u_longlong_t)val);
|
||||
}
|
||||
zcp_check(zhp, prop, val, NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
switch (zfs_prop_get_type(prop)) {
|
||||
case PROP_TYPE_NUMBER:
|
||||
|
||||
Reference in New Issue
Block a user