Project

General

Profile

Bug #3739 » dsl_prop.c.2.patch

Martin Matuška, 2013-04-22 06:56 PM

View differences:

usr/src/uts/common/fs/zfs/dsl_dir.c Wed Apr 17 20:25:52 2013 -0400 → usr/src/uts/common/fs/zfs/dsl_dir.c Mon Apr 22 20:55:29 2013 +0200
964 964
	dsl_pool_t *dp = dmu_tx_pool(tx);
965 965
	dsl_dataset_t *ds;
966 966
	uint64_t newval;
967
	int version;
967 968

  
968 969
	VERIFY0(dsl_dataset_hold(dp, ddsqra->ddsqra_name, FTAG, &ds));
969 970

  
970
	dsl_prop_set_sync_impl(ds, zfs_prop_to_name(ZFS_PROP_QUOTA),
971
	    ddsqra->ddsqra_source, sizeof (ddsqra->ddsqra_value), 1,
972
	    &ddsqra->ddsqra_value, tx);
971
	version = spa_version(dp->dp_spa);
972
	if (version >= SPA_VERSION_RECVD_PROPS) {
973
		dsl_prop_set_sync_impl(ds, zfs_prop_to_name(ZFS_PROP_QUOTA),
974
		    ddsqra->ddsqra_source, sizeof (ddsqra->ddsqra_value), 1,
975
		    &ddsqra->ddsqra_value, tx);
973 976

  
974
	VERIFY0(dsl_prop_get_int_ds(ds,
975
	    zfs_prop_to_name(ZFS_PROP_QUOTA), &newval));
977
		VERIFY0(dsl_prop_get_int_ds(ds,
978
		    zfs_prop_to_name(ZFS_PROP_QUOTA), &newval));
979
	} else
980
		newval = ddsqra->ddsqra_value;
976 981

  
977 982
	dmu_buf_will_dirty(ds->ds_dir->dd_dbuf, tx);
978 983
	mutex_enter(&ds->ds_dir->dd_lock);
979 984
	ds->ds_dir->dd_phys->dd_quota = newval;
980 985
	mutex_exit(&ds->ds_dir->dd_lock);
986

  
987
	if (version < SPA_VERSION_RECVD_PROPS) {
988
		char valbuf[32];
989

  
990
		(void) snprintf(valbuf, sizeof (valbuf),
991
		    "%lld", (longlong_t)newval);
992
		spa_history_log_internal_ds(ds, "set", tx, "%s=%s",
993
		    zfs_prop_to_name(ZFS_PROP_QUOTA), valbuf);
994
	}
995

  
981 996
	dsl_dataset_rele(ds, FTAG);
982 997
}
983 998

  
......
1080 1095
	dsl_pool_t *dp = dmu_tx_pool(tx);
1081 1096
	dsl_dataset_t *ds;
1082 1097
	uint64_t newval;
1098
	int version;
1083 1099

  
1084 1100
	VERIFY0(dsl_dataset_hold(dp, ddsqra->ddsqra_name, FTAG, &ds));
1085 1101

  
1086
	dsl_prop_set_sync_impl(ds, zfs_prop_to_name(ZFS_PROP_RESERVATION),
1087
	    ddsqra->ddsqra_source, sizeof (ddsqra->ddsqra_value), 1,
1088
	    &ddsqra->ddsqra_value, tx);
1102
	version = spa_version(dp->dp_spa);
1103
	if (version >= SPA_VERSION_RECVD_PROPS) {
1104
		dsl_prop_set_sync_impl(ds,
1105
		    zfs_prop_to_name(ZFS_PROP_RESERVATION),
1106
		    ddsqra->ddsqra_source, sizeof (ddsqra->ddsqra_value), 1,
1107
		    &ddsqra->ddsqra_value, tx);
1089 1108

  
1090
	VERIFY0(dsl_prop_get_int_ds(ds,
1091
	    zfs_prop_to_name(ZFS_PROP_RESERVATION), &newval));
1109
		VERIFY0(dsl_prop_get_int_ds(ds,
1110
		    zfs_prop_to_name(ZFS_PROP_RESERVATION), &newval));
1111
	} else
1112
		newval = ddsqra->ddsqra_value;
1092 1113

  
1093 1114
	dsl_dir_set_reservation_sync_impl(ds->ds_dir, newval, tx);
1115

  
1116
	if (version < SPA_VERSION_RECVD_PROPS) {
1117
		char valbuf[32];
1118

  
1119
		(void) snprintf(valbuf, sizeof (valbuf),
1120
		    "%lld", (longlong_t)newval);
1121
		spa_history_log_internal_ds(ds, "set", tx, "%s=%s",
1122
		    zfs_prop_to_name(ZFS_PROP_RESERVATION), valbuf);
1123
	}
1124

  
1094 1125
	dsl_dataset_rele(ds, FTAG);
1095 1126
}
1096 1127

  
(2-2/3)