MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dmu_diff

Function dmu_diff

freebsd/contrib/openzfs/module/zfs/dmu_diff.c:166–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166int
167dmu_diff(const char *tosnap_name, const char *fromsnap_name,
168 zfs_file_t *fp, offset_t *offp)
169{
170 dmu_diffarg_t da;
171 dsl_dataset_t *fromsnap;
172 dsl_dataset_t *tosnap;
173 dsl_pool_t *dp;
174 int error;
175 uint64_t fromtxg;
176
177 if (strchr(tosnap_name, '@') == NULL ||
178 strchr(fromsnap_name, '@') == NULL)
179 return (SET_ERROR(EINVAL));
180
181 error = dsl_pool_hold(tosnap_name, FTAG, &dp);
182 if (error != 0)
183 return (error);
184
185 error = dsl_dataset_hold(dp, tosnap_name, FTAG, &tosnap);
186 if (error != 0) {
187 dsl_pool_rele(dp, FTAG);
188 return (error);
189 }
190
191 error = dsl_dataset_hold(dp, fromsnap_name, FTAG, &fromsnap);
192 if (error != 0) {
193 dsl_dataset_rele(tosnap, FTAG);
194 dsl_pool_rele(dp, FTAG);
195 return (error);
196 }
197
198 if (!dsl_dataset_is_before(tosnap, fromsnap, 0)) {
199 dsl_dataset_rele(fromsnap, FTAG);
200 dsl_dataset_rele(tosnap, FTAG);
201 dsl_pool_rele(dp, FTAG);
202 return (SET_ERROR(EXDEV));
203 }
204
205 fromtxg = dsl_dataset_phys(fromsnap)->ds_creation_txg;
206 dsl_dataset_rele(fromsnap, FTAG);
207
208 dsl_dataset_long_hold(tosnap, FTAG);
209 dsl_pool_rele(dp, FTAG);
210
211 da.da_fp = fp;
212 da.da_offp = offp;
213 da.da_ddr.ddr_type = DDR_NONE;
214 da.da_ddr.ddr_first = da.da_ddr.ddr_last = 0;
215 da.da_err = 0;
216
217 /*
218 * Since zfs diff only looks at dnodes which are stored in plaintext
219 * (other than bonus buffers), we don't technically need to decrypt
220 * the dataset to perform this operation. However, the command line
221 * utility will still fail if the keys are not loaded because the
222 * dataset isn't mounted and because it will fail when it attempts to
223 * call the ZFS_IOC_OBJ_TO_STATS ioctl.

Callers 1

zfs_ioc_diffFunction · 0.85

Calls 11

strchrFunction · 0.85
dsl_pool_holdFunction · 0.85
dsl_dataset_holdFunction · 0.85
dsl_pool_releFunction · 0.85
dsl_dataset_releFunction · 0.85
dsl_dataset_is_beforeFunction · 0.85
dsl_dataset_long_holdFunction · 0.85
traverse_datasetFunction · 0.85
write_recordFunction · 0.85
dsl_dataset_long_releFunction · 0.85
dsl_dataset_physFunction · 0.50

Tested by

no test coverage detected