dsl_dataset.c (321535) | dsl_dataset.c (321545) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 4 unchanged lines hidden (view full) --- 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 4 unchanged lines hidden (view full) --- 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ |
21 |
|
21/* 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 23 * Portions Copyright (c) 2011 Martin Matuska <mm@FreeBSD.org> 24 * Copyright (c) 2011, 2016 by Delphix. All rights reserved. 25 * Copyright (c) 2014, Joyent, Inc. All rights reserved. 26 * Copyright (c) 2014 RackTop Systems. 27 * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. 28 * Copyright (c) 2014 Integros [integros.com] 29 * Copyright 2016, OmniTI Computer Consulting, Inc. All rights reserved. | 22/* 23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 24 * Portions Copyright (c) 2011 Martin Matuska <mm@FreeBSD.org> 25 * Copyright (c) 2011, 2016 by Delphix. All rights reserved. 26 * Copyright (c) 2014, Joyent, Inc. All rights reserved. 27 * Copyright (c) 2014 RackTop Systems. 28 * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. 29 * Copyright (c) 2014 Integros [integros.com] 30 * Copyright 2016, OmniTI Computer Consulting, Inc. All rights reserved. |
31 * Copyright 2017 Nexenta Systems, Inc. |
|
30 */ 31 32#include <sys/dmu_objset.h> 33#include <sys/dsl_dataset.h> 34#include <sys/dsl_dir.h> 35#include <sys/dsl_prop.h> 36#include <sys/dsl_synctask.h> 37#include <sys/dmu_traverse.h> --- 321 unchanged lines hidden (view full) --- 359 return (err); 360} 361 362int 363dsl_dataset_snap_lookup(dsl_dataset_t *ds, const char *name, uint64_t *value) 364{ 365 objset_t *mos = ds->ds_dir->dd_pool->dp_meta_objset; 366 uint64_t snapobj = dsl_dataset_phys(ds)->ds_snapnames_zapobj; | 32 */ 33 34#include <sys/dmu_objset.h> 35#include <sys/dsl_dataset.h> 36#include <sys/dsl_dir.h> 37#include <sys/dsl_prop.h> 38#include <sys/dsl_synctask.h> 39#include <sys/dmu_traverse.h> --- 321 unchanged lines hidden (view full) --- 361 return (err); 362} 363 364int 365dsl_dataset_snap_lookup(dsl_dataset_t *ds, const char *name, uint64_t *value) 366{ 367 objset_t *mos = ds->ds_dir->dd_pool->dp_meta_objset; 368 uint64_t snapobj = dsl_dataset_phys(ds)->ds_snapnames_zapobj; |
367 matchtype_t mt; | 369 matchtype_t mt = 0; |
368 int err; 369 370 if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET) | 370 int err; 371 372 if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET) |
371 mt = MT_FIRST; 372 else 373 mt = MT_EXACT; | 373 mt = MT_NORMALIZE; |
374 375 err = zap_lookup_norm(mos, snapobj, name, 8, 1, 376 value, mt, NULL, 0, NULL); | 374 375 err = zap_lookup_norm(mos, snapobj, name, 8, 1, 376 value, mt, NULL, 0, NULL); |
377 if (err == ENOTSUP && mt == MT_FIRST) | 377 if (err == ENOTSUP && (mt & MT_NORMALIZE)) |
378 err = zap_lookup(mos, snapobj, name, 8, 1, value); 379 return (err); 380} 381 382int 383dsl_dataset_snap_remove(dsl_dataset_t *ds, const char *name, dmu_tx_t *tx, 384 boolean_t adj_cnt) 385{ 386 objset_t *mos = ds->ds_dir->dd_pool->dp_meta_objset; 387 uint64_t snapobj = dsl_dataset_phys(ds)->ds_snapnames_zapobj; | 378 err = zap_lookup(mos, snapobj, name, 8, 1, value); 379 return (err); 380} 381 382int 383dsl_dataset_snap_remove(dsl_dataset_t *ds, const char *name, dmu_tx_t *tx, 384 boolean_t adj_cnt) 385{ 386 objset_t *mos = ds->ds_dir->dd_pool->dp_meta_objset; 387 uint64_t snapobj = dsl_dataset_phys(ds)->ds_snapnames_zapobj; |
388 matchtype_t mt; | 388 matchtype_t mt = 0; |
389 int err; 390 391 dsl_dir_snap_cmtime_update(ds->ds_dir); 392 393 if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET) | 389 int err; 390 391 dsl_dir_snap_cmtime_update(ds->ds_dir); 392 393 if (dsl_dataset_phys(ds)->ds_flags & DS_FLAG_CI_DATASET) |
394 mt = MT_FIRST; 395 else 396 mt = MT_EXACT; | 394 mt = MT_NORMALIZE; |
397 398 err = zap_remove_norm(mos, snapobj, name, mt, tx); | 395 396 err = zap_remove_norm(mos, snapobj, name, mt, tx); |
399 if (err == ENOTSUP && mt == MT_FIRST) | 397 if (err == ENOTSUP && (mt & MT_NORMALIZE)) |
400 err = zap_remove(mos, snapobj, name, tx); 401 402 if (err == 0 && adj_cnt) 403 dsl_fs_ss_count_adjust(ds->ds_dir, -1, 404 DD_FIELD_SNAPSHOT_COUNT, tx); 405 406 return (err); 407} --- 3351 unchanged lines hidden --- | 398 err = zap_remove(mos, snapobj, name, tx); 399 400 if (err == 0 && adj_cnt) 401 dsl_fs_ss_count_adjust(ds->ds_dir, -1, 402 DD_FIELD_SNAPSHOT_COUNT, tx); 403 404 return (err); 405} --- 3351 unchanged lines hidden --- |