Print this page
3742 zfs comments need cleaner, more consistent style
Submitted by:   Will Andrews <willa@spectralogic.com>
Submitted by:   Alan Somers <alans@spectralogic.com>
Reviewed by:    Matthew Ahrens <mahrens@delphix.com>
Reviewed by:    George Wilson <george.wilson@delphix.com>
Reviewed by:    Eric Schrock <eric.schrock@delphix.com>


 306 }
 307 
 308 /*
 309  * Check to see if the named dataset is currently defined as bootable
 310  */
 311 static boolean_t
 312 zfs_is_bootfs(const char *name)
 313 {
 314         objset_t *os;
 315 
 316         if (dmu_objset_hold(name, FTAG, &os) == 0) {
 317                 boolean_t ret;
 318                 ret = (dmu_objset_id(os) == spa_bootfs(dmu_objset_spa(os)));
 319                 dmu_objset_rele(os, FTAG);
 320                 return (ret);
 321         }
 322         return (B_FALSE);
 323 }
 324 
 325 /*
 326  * zfs_earlier_version
 327  *
 328  *      Return non-zero if the spa version is less than requested version.
 329  */
 330 static int
 331 zfs_earlier_version(const char *name, int version)
 332 {
 333         spa_t *spa;
 334 
 335         if (spa_open(name, &spa, FTAG) == 0) {
 336                 if (spa_version(spa) < version) {
 337                         spa_close(spa, FTAG);
 338                         return (1);
 339                 }
 340                 spa_close(spa, FTAG);
 341         }
 342         return (0);
 343 }
 344 
 345 /*
 346  * zpl_earlier_version
 347  *
 348  * Return TRUE if the ZPL version is less than requested version.
 349  */
 350 static boolean_t
 351 zpl_earlier_version(const char *name, int version)
 352 {
 353         objset_t *os;
 354         boolean_t rc = B_TRUE;
 355 
 356         if (dmu_objset_hold(name, FTAG, &os) == 0) {
 357                 uint64_t zplversion;
 358 
 359                 if (dmu_objset_type(os) != DMU_OST_ZFS) {
 360                         dmu_objset_rele(os, FTAG);
 361                         return (B_TRUE);
 362                 }
 363                 /* XXX reading from non-owned objset */
 364                 if (zfs_get_zplprop(os, ZFS_PROP_VERSION, &zplversion) == 0)
 365                         rc = zplversion < version;
 366                 dmu_objset_rele(os, FTAG);
 367         }


2938                 }
2939                 vfsp = vfsp->vfs_next;
2940         } while (vfsp != rootvfs);
2941         vfs_list_unlock();
2942         return (vfs_found);
2943 }
2944 
2945 /* ARGSUSED */
2946 static void
2947 zfs_create_cb(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx)
2948 {
2949         zfs_creat_t *zct = arg;
2950 
2951         zfs_create_fs(os, cr, zct->zct_zplprops, tx);
2952 }
2953 
2954 #define ZFS_PROP_UNDEFINED      ((uint64_t)-1)
2955 
2956 /*
2957  * inputs:
2958  * createprops          list of properties requested by creator
2959  * default_zplver       zpl version to use if unspecified in createprops
2960  * fuids_ok             fuids allowed in this version of the spa?
2961  * os                   parent objset pointer (NULL if root fs)



2962  *
2963  * outputs:
2964  * zplprops     values for the zplprops we attach to the master node object
2965  * is_ci        true if requested file system will be purely case-insensitive
2966  *
2967  * Determine the settings for utf8only, normalization and
2968  * casesensitivity.  Specific values may have been requested by the
2969  * creator and/or we can inherit values from the parent dataset.  If
2970  * the file system is of too early a vintage, a creator can not
2971  * request settings for these properties, even if the requested
2972  * setting is the default value.  We don't actually want to create dsl
2973  * properties for these, so remove them from the source nvlist after
2974  * processing.
2975  */
2976 static int
2977 zfs_fill_zplprops_impl(objset_t *os, uint64_t zplver,
2978     boolean_t fuids_ok, boolean_t sa_ok, nvlist_t *createprops,
2979     nvlist_t *zplprops, boolean_t *is_ci)
2980 {
2981         uint64_t sense = ZFS_PROP_UNDEFINED;




 306 }
 307 
 308 /*
 309  * Check to see if the named dataset is currently defined as bootable
 310  */
 311 static boolean_t
 312 zfs_is_bootfs(const char *name)
 313 {
 314         objset_t *os;
 315 
 316         if (dmu_objset_hold(name, FTAG, &os) == 0) {
 317                 boolean_t ret;
 318                 ret = (dmu_objset_id(os) == spa_bootfs(dmu_objset_spa(os)));
 319                 dmu_objset_rele(os, FTAG);
 320                 return (ret);
 321         }
 322         return (B_FALSE);
 323 }
 324 
 325 /*


 326  * Return non-zero if the spa version is less than requested version.
 327  */
 328 static int
 329 zfs_earlier_version(const char *name, int version)
 330 {
 331         spa_t *spa;
 332 
 333         if (spa_open(name, &spa, FTAG) == 0) {
 334                 if (spa_version(spa) < version) {
 335                         spa_close(spa, FTAG);
 336                         return (1);
 337                 }
 338                 spa_close(spa, FTAG);
 339         }
 340         return (0);
 341 }
 342 
 343 /*


 344  * Return TRUE if the ZPL version is less than requested version.
 345  */
 346 static boolean_t
 347 zpl_earlier_version(const char *name, int version)
 348 {
 349         objset_t *os;
 350         boolean_t rc = B_TRUE;
 351 
 352         if (dmu_objset_hold(name, FTAG, &os) == 0) {
 353                 uint64_t zplversion;
 354 
 355                 if (dmu_objset_type(os) != DMU_OST_ZFS) {
 356                         dmu_objset_rele(os, FTAG);
 357                         return (B_TRUE);
 358                 }
 359                 /* XXX reading from non-owned objset */
 360                 if (zfs_get_zplprop(os, ZFS_PROP_VERSION, &zplversion) == 0)
 361                         rc = zplversion < version;
 362                 dmu_objset_rele(os, FTAG);
 363         }


2934                 }
2935                 vfsp = vfsp->vfs_next;
2936         } while (vfsp != rootvfs);
2937         vfs_list_unlock();
2938         return (vfs_found);
2939 }
2940 
2941 /* ARGSUSED */
2942 static void
2943 zfs_create_cb(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx)
2944 {
2945         zfs_creat_t *zct = arg;
2946 
2947         zfs_create_fs(os, cr, zct->zct_zplprops, tx);
2948 }
2949 
2950 #define ZFS_PROP_UNDEFINED      ((uint64_t)-1)
2951 
2952 /*
2953  * inputs:



2954  * os                   parent objset pointer (NULL if root fs)
2955  * fuids_ok             fuids allowed in this version of the spa?
2956  * sa_ok                SAs allowed in this version of the spa?
2957  * createprops          list of properties requested by creator
2958  *
2959  * outputs:
2960  * zplprops     values for the zplprops we attach to the master node object
2961  * is_ci        true if requested file system will be purely case-insensitive
2962  *
2963  * Determine the settings for utf8only, normalization and
2964  * casesensitivity.  Specific values may have been requested by the
2965  * creator and/or we can inherit values from the parent dataset.  If
2966  * the file system is of too early a vintage, a creator can not
2967  * request settings for these properties, even if the requested
2968  * setting is the default value.  We don't actually want to create dsl
2969  * properties for these, so remove them from the source nvlist after
2970  * processing.
2971  */
2972 static int
2973 zfs_fill_zplprops_impl(objset_t *os, uint64_t zplver,
2974     boolean_t fuids_ok, boolean_t sa_ok, nvlist_t *createprops,
2975     nvlist_t *zplprops, boolean_t *is_ci)
2976 {
2977         uint64_t sense = ZFS_PROP_UNDEFINED;