Print this page
2882 implement libzfs_core
2883 changing "canmount" property to "on" should not always remount dataset
2900 "zfs snapshot" should be able to create multiple, arbitrary snapshots at once
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Chris Siden <christopher.siden@delphix.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Bill Pijewski <wdp@joyent.com>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>


   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
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  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 /*
  22  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.

  23  */
  24 
  25 /* Portions Copyright 2010 Robert Milkowski */
  26 
  27 #include <sys/types.h>
  28 #include <sys/param.h>
  29 #include <sys/systm.h>
  30 #include <sys/sysmacros.h>
  31 #include <sys/kmem.h>
  32 #include <sys/pathname.h>
  33 #include <sys/vnode.h>
  34 #include <sys/vfs.h>
  35 #include <sys/vfs_opreg.h>
  36 #include <sys/mntent.h>
  37 #include <sys/mount.h>
  38 #include <sys/cmn_err.h>
  39 #include "fs/fs_subr.h"
  40 #include <sys/zfs_znode.h>
  41 #include <sys/zfs_dir.h>
  42 #include <sys/zil.h>


2231                 dmu_tx_commit(tx);
2232                 return (error);
2233         }
2234 
2235         if (newvers >= ZPL_VERSION_SA && !zfsvfs->z_use_sa) {
2236                 uint64_t sa_obj;
2237 
2238                 ASSERT3U(spa_version(dmu_objset_spa(zfsvfs->z_os)), >=,
2239                     SPA_VERSION_SA);
2240                 sa_obj = zap_create(os, DMU_OT_SA_MASTER_NODE,
2241                     DMU_OT_NONE, 0, tx);
2242 
2243                 error = zap_add(os, MASTER_NODE_OBJ,
2244                     ZFS_SA_ATTRS, 8, 1, &sa_obj, tx);
2245                 ASSERT3U(error, ==, 0);
2246 
2247                 VERIFY(0 == sa_set_sa_object(os, sa_obj));
2248                 sa_register_update_callback(os, zfs_sa_upgrade);
2249         }
2250 
2251         spa_history_log_internal(LOG_DS_UPGRADE,
2252             dmu_objset_spa(os), tx, "oldver=%llu newver=%llu dataset = %llu",
2253             zfsvfs->z_version, newvers, dmu_objset_id(os));
2254 
2255         dmu_tx_commit(tx);
2256 
2257         zfsvfs->z_version = newvers;
2258 
2259         zfs_set_fuid_feature(zfsvfs);
2260 
2261         return (0);
2262 }
2263 
2264 /*
2265  * Read a property stored within the master node.
2266  */
2267 int
2268 zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value)
2269 {
2270         const char *pname;
2271         int error = ENOENT;
2272 
2273         /*




   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
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  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 /*
  22  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2012 by Delphix. All rights reserved.
  24  */
  25 
  26 /* Portions Copyright 2010 Robert Milkowski */
  27 
  28 #include <sys/types.h>
  29 #include <sys/param.h>
  30 #include <sys/systm.h>
  31 #include <sys/sysmacros.h>
  32 #include <sys/kmem.h>
  33 #include <sys/pathname.h>
  34 #include <sys/vnode.h>
  35 #include <sys/vfs.h>
  36 #include <sys/vfs_opreg.h>
  37 #include <sys/mntent.h>
  38 #include <sys/mount.h>
  39 #include <sys/cmn_err.h>
  40 #include "fs/fs_subr.h"
  41 #include <sys/zfs_znode.h>
  42 #include <sys/zfs_dir.h>
  43 #include <sys/zil.h>


2232                 dmu_tx_commit(tx);
2233                 return (error);
2234         }
2235 
2236         if (newvers >= ZPL_VERSION_SA && !zfsvfs->z_use_sa) {
2237                 uint64_t sa_obj;
2238 
2239                 ASSERT3U(spa_version(dmu_objset_spa(zfsvfs->z_os)), >=,
2240                     SPA_VERSION_SA);
2241                 sa_obj = zap_create(os, DMU_OT_SA_MASTER_NODE,
2242                     DMU_OT_NONE, 0, tx);
2243 
2244                 error = zap_add(os, MASTER_NODE_OBJ,
2245                     ZFS_SA_ATTRS, 8, 1, &sa_obj, tx);
2246                 ASSERT3U(error, ==, 0);
2247 
2248                 VERIFY(0 == sa_set_sa_object(os, sa_obj));
2249                 sa_register_update_callback(os, zfs_sa_upgrade);
2250         }
2251 
2252         spa_history_log_internal_ds(dmu_objset_ds(os), "upgrade", tx,
2253             "from %llu to %llu", zfsvfs->z_version, newvers);

2254 
2255         dmu_tx_commit(tx);
2256 
2257         zfsvfs->z_version = newvers;
2258 
2259         zfs_set_fuid_feature(zfsvfs);
2260 
2261         return (0);
2262 }
2263 
2264 /*
2265  * Read a property stored within the master node.
2266  */
2267 int
2268 zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value)
2269 {
2270         const char *pname;
2271         int error = ENOENT;
2272 
2273         /*