Print this page
4171 clean up spa_feature_*() interfaces
4172 implement extensible_dataset feature for use by other zpool features
Reviewed by: Max Grossman <max.grossman@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/grub/grub-0.97/stage2/fsys_zfs.c
          +++ new/usr/src/grub/grub-0.97/stage2/fsys_zfs.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   *  along with this program; if not, write to the Free Software
  17   17   *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18   18   */
  19   19  
  20   20  /*
  21   21   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  22   22   * Use is subject to license terms.
  23   23   */
  24   24  
  25   25  /*
  26      - * Copyright (c) 2012 by Delphix. All rights reserved.
       26 + * Copyright (c) 2013 by Delphix. All rights reserved.
  27   27   * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
  28   28   */
  29   29  
  30   30  /*
  31   31   * The zfs plug-in routines for GRUB are:
  32   32   *
  33   33   * zfs_mount() - locates a valid uberblock of the root pool and reads
  34   34   *              in its MOS at the memory address MOS.
  35   35   *
  36   36   * zfs_open() - locates a plain file object by following the MOS
↓ open down ↓ 922 lines elided ↑ open up ↑
 959  959  /*
 960  960   * List of pool features that the grub implementation of ZFS supports for
 961  961   * read. Note that features that are only required for write do not need
 962  962   * to be listed here since grub opens pools in read-only mode.
 963  963   *
 964  964   * When this list is updated the version number in usr/src/grub/capability
 965  965   * must be incremented to ensure the new grub gets installed.
 966  966   */
 967  967  static const char *spa_feature_names[] = {
 968  968          "org.illumos:lz4_compress",
      969 +        "com.delphix:extensible_dataset",
 969  970          NULL
 970  971  };
 971  972  
 972  973  /*
 973  974   * Checks whether the MOS features that are active are supported by this
 974  975   * (GRUB's) implementation of ZFS.
 975  976   *
 976  977   * Return:
 977  978   *      0: Success.
 978  979   *      errnum: Failure.
↓ open down ↓ 58 lines elided ↑ open up ↑
1037 1038          }
1038 1039  
1039 1040          if (errnum = dnode_get(mosmdn, DMU_POOL_DIRECTORY_OBJECT,
1040 1041              DMU_OT_OBJECT_DIRECTORY, mdn, stack))
1041 1042                  return (errnum);
1042 1043  
1043 1044          if (errnum = zap_lookup(mdn, DMU_POOL_ROOT_DATASET, &objnum,
1044 1045              stack))
1045 1046                  return (errnum);
1046 1047  
1047      -        if (errnum = dnode_get(mosmdn, objnum, DMU_OT_DSL_DIR, mdn, stack))
     1048 +        if (errnum = dnode_get(mosmdn, objnum, 0, mdn, stack))
1048 1049                  return (errnum);
1049 1050  
1050 1051          if (fsname == NULL) {
1051 1052                  headobj =
1052 1053                      ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_head_dataset_obj;
1053 1054                  goto skip;
1054 1055          }
1055 1056  
1056 1057          /* take out the pool name */
1057 1058          while (*fsname && !grub_isspace(*fsname) && *fsname != '/')
↓ open down ↓ 21 lines elided ↑ open up ↑
1079 1080                  }
1080 1081                  childobj =
1081 1082                      ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_child_dir_zapobj;
1082 1083                  if (errnum = dnode_get(mosmdn, childobj,
1083 1084                      DMU_OT_DSL_DIR_CHILD_MAP, mdn, stack))
1084 1085                          return (errnum);
1085 1086  
1086 1087                  if (zap_lookup(mdn, cname, &objnum, stack))
1087 1088                          return (ERR_FILESYSTEM_NOT_FOUND);
1088 1089  
1089      -                if (errnum = dnode_get(mosmdn, objnum, DMU_OT_DSL_DIR,
     1090 +                if (errnum = dnode_get(mosmdn, objnum, 0,
1090 1091                      mdn, stack))
1091 1092                          return (errnum);
1092 1093  
1093 1094                  *fsname = ch;
1094 1095                  if (issnapshot)
1095 1096                          *snapname = '@';
1096 1097          }
1097 1098          headobj = ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_head_dataset_obj;
1098 1099          if (obj)
1099 1100                  *obj = headobj;
1100 1101  
1101 1102  skip:
1102      -        if (errnum = dnode_get(mosmdn, headobj, DMU_OT_DSL_DATASET, mdn, stack))
     1103 +        if (errnum = dnode_get(mosmdn, headobj, 0, mdn, stack))
1103 1104                  return (errnum);
1104 1105          if (issnapshot) {
1105 1106                  uint64_t snapobj;
1106 1107  
1107 1108                  snapobj = ((dsl_dataset_phys_t *)DN_BONUS(mdn))->
1108 1109                      ds_snapnames_zapobj;
1109 1110  
1110 1111                  if (errnum = dnode_get(mosmdn, snapobj,
1111 1112                      DMU_OT_DSL_DS_SNAP_MAP, mdn, stack))
1112 1113                          return (errnum);
1113 1114                  if (zap_lookup(mdn, snapname + 1, &headobj, stack))
1114 1115                          return (ERR_FILESYSTEM_NOT_FOUND);
1115      -                if (errnum = dnode_get(mosmdn, headobj,
1116      -                    DMU_OT_DSL_DATASET, mdn, stack))
     1116 +                if (errnum = dnode_get(mosmdn, headobj, 0, mdn, stack))
1117 1117                          return (errnum);
1118 1118                  if (obj)
1119 1119                          *obj = headobj;
1120 1120          }
1121 1121  
1122 1122          bp = &((dsl_dataset_phys_t *)DN_BONUS(mdn))->ds_bp;
1123 1123          osp = (objset_phys_t *)stack;
1124 1124          stack += sizeof (objset_phys_t);
1125 1125          if (errnum = zio_read(bp, osp, stack))
1126 1126                  return (errnum);
↓ open down ↓ 672 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX