diff options
author | John Sonnenschein <johns@joyent.com> | 2011-10-03 21:04:40 +0000 |
---|---|---|
committer | John Sonnenschein <johns@joyent.com> | 2011-10-03 21:04:40 +0000 |
commit | 4171a80dc48c62297457d0820f26cac6516e068a (patch) | |
tree | 5e20c8b91e74482baeed81d9cda1af2f63207b82 /usr/src/grub | |
parent | cb866ae1d95a57b3ac6bf38040e40ed0cd4fe835 (diff) | |
parent | ed22c7109fc5dd9e1b7a5d0333bdc7ad2718e2ab (diff) | |
download | illumos-joyent-4171a80dc48c62297457d0820f26cac6516e068a.tar.gz |
[OS-663] Post-6.5 Illumos sync
Merge https://github.com/illumos/illumos-gate
Conflicts:
exception_lists/packaging
usr/src/cmd/dtrace/test/cmd/scripts/dtest.pl
usr/src/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh
usr/src/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh
usr/src/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh
usr/src/cmd/dtrace/test/tst/common/usdt/tst.guess64.ksh
usr/src/cmd/dtrace/test/tst/common/usdt/tst.include.ksh
usr/src/cmd/dtrace/test/tst/common/usdt/tst.nodtrace.ksh
usr/src/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh
usr/src/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh
usr/src/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh
usr/src/cmd/lp/Makefile
usr/src/cmd/lp/cmd/lpadmin/options.c
usr/src/cmd/lp/cmd/lpfilter.c
usr/src/cmd/lp/cmd/lpforms.c
usr/src/cmd/lp/cmd/lpusers.c
usr/src/cmd/lp/lib/lp/isterminfo.c
usr/src/cmd/lp/lib/lp/tidbit.c
usr/src/cmd/terminfo/att.ti
usr/src/cmd/zpool/zpool_main.c
usr/src/common/dis/i386/dis_tables.c
usr/src/lib/libdtrace/common/dt_options.c
usr/src/lib/libzfs/common/libzfs_dataset.c
usr/src/man/man1m/dladm.1m
usr/src/man/man1m/flowadm.1m
usr/src/man/man1m/zoneadm.1m
usr/src/man/man1m/zonecfg.1m
usr/src/pkg/manifests/print-lp-print-client-commands.mf
usr/src/pkg/manifests/print-lp.mf
usr/src/uts/common/fs/zfs/sys/zio.h
usr/src/uts/common/fs/zfs/zio.c
usr/src/uts/i86pc/ml/mach_offsets.in
usr/src/uts/intel/amd64/ml/mach_offsets.in
usr/src/uts/intel/sys/tss.h
Diffstat (limited to 'usr/src/grub')
-rw-r--r-- | usr/src/grub/grub-0.97/stage2/fsys_zfs.c | 109 | ||||
-rw-r--r-- | usr/src/grub/grub-0.97/stage2/fsys_zfs.h | 19 | ||||
-rw-r--r-- | usr/src/grub/grub-0.97/stage2/zfs-include/vdev_impl.h | 14 |
3 files changed, 68 insertions, 74 deletions
diff --git a/usr/src/grub/grub-0.97/stage2/fsys_zfs.c b/usr/src/grub/grub-0.97/stage2/fsys_zfs.c index 30a66dd7d7..4eed0afe9a 100644 --- a/usr/src/grub/grub-0.97/stage2/fsys_zfs.c +++ b/usr/src/grub/grub-0.97/stage2/fsys_zfs.c @@ -225,10 +225,8 @@ vdev_uberblock_compare(uberblock_t *ub1, uberblock_t *ub2) * -1 - Failure */ static int -uberblock_verify(uberblock_phys_t *ub, uint64_t offset) +uberblock_verify(uberblock_t *uber, uint64_t ub_size, uint64_t offset) { - - uberblock_t *uber = &ub->ubp_uberblock; blkptr_t bp; BP_ZERO(&bp); @@ -236,7 +234,7 @@ uberblock_verify(uberblock_phys_t *ub, uint64_t offset) BP_SET_BYTEORDER(&bp, ZFS_HOST_BYTEORDER); ZIO_SET_CHECKSUM(&bp.blk_cksum, offset, 0, 0, 0); - if (zio_checksum_verify(&bp, (char *)ub, UBERBLOCK_SIZE) != 0) + if (zio_checksum_verify(&bp, (char *)uber, ub_size) != 0) return (-1); if (uber->ub_magic == UBERBLOCK_MAGIC && @@ -252,25 +250,28 @@ uberblock_verify(uberblock_phys_t *ub, uint64_t offset) * Success - Pointer to the best uberblock. * Failure - NULL */ -static uberblock_phys_t * -find_bestub(uberblock_phys_t *ub_array, uint64_t sector) +static uberblock_t * +find_bestub(char *ub_array, uint64_t ashift, uint64_t sector) { - uberblock_phys_t *ubbest = NULL; - uint64_t offset; + uberblock_t *ubbest = NULL; + uberblock_t *ubnext; + uint64_t offset, ub_size; int i; - for (i = 0; i < (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT); i++) { + ub_size = VDEV_UBERBLOCK_SIZE(ashift); + + for (i = 0; i < VDEV_UBERBLOCK_COUNT(ashift); i++) { + ubnext = (uberblock_t *)ub_array; + ub_array += ub_size; offset = (sector << SPA_MINBLOCKSHIFT) + - VDEV_UBERBLOCK_OFFSET(i); - if (uberblock_verify(&ub_array[i], offset) == 0) { - if (ubbest == NULL) { - ubbest = &ub_array[i]; - } else if (vdev_uberblock_compare( - &(ub_array[i].ubp_uberblock), - &(ubbest->ubp_uberblock)) > 0) { - ubbest = &ub_array[i]; - } - } + VDEV_UBERBLOCK_OFFSET(ashift, i); + + if (uberblock_verify(ubnext, ub_size, offset) != 0) + continue; + + if (ubbest == NULL || + vdev_uberblock_compare(ubnext, ubbest) > 0) + ubbest = ubnext; } return (ubbest); @@ -1209,7 +1210,7 @@ vdev_get_bootpath(char *nv, uint64_t inguid, char *devid, char *bootpath, */ int check_pool_label(uint64_t sector, char *stack, char *outdevid, - char *outpath, uint64_t *outguid) + char *outpath, uint64_t *outguid, uint64_t *outashift) { vdev_phys_t *vdev; uint64_t pool_state, txg = 0; @@ -1259,6 +1260,9 @@ check_pool_label(uint64_t sector, char *stack, char *outdevid, if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_GUID, &diskguid, DATA_TYPE_UINT64, NULL)) return (ERR_FSYS_CORRUPT); + if (nvlist_lookup_value(nv, ZPOOL_CONFIG_ASHIFT, outashift, + DATA_TYPE_UINT64, NULL) != 0) + return (ERR_FSYS_CORRUPT); if (vdev_get_bootpath(nv, diskguid, outdevid, outpath, 0)) return (ERR_NO_BOOTPATH); if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_POOL_GUID, outguid, @@ -1278,13 +1282,13 @@ check_pool_label(uint64_t sector, char *stack, char *outdevid, int zfs_mount(void) { - char *stack; + char *stack, *ub_array; int label = 0; - uberblock_phys_t *ub_array, *ubbest; + uberblock_t *ubbest; objset_phys_t *osp; char tmp_bootpath[MAXNAMELEN]; char tmp_devid[MAXNAMELEN]; - uint64_t tmp_guid; + uint64_t tmp_guid, ashift; uint64_t adjpl = (uint64_t)part_length << SPA_MINBLOCKSHIFT; int err = errnum; /* preserve previous errnum state */ @@ -1296,7 +1300,7 @@ zfs_mount(void) stackbase = ZFS_SCRATCH; stack = stackbase; - ub_array = (uberblock_phys_t *)stack; + ub_array = stack; stack += VDEV_UBERBLOCK_RING; osp = (objset_phys_t *)stack; @@ -1322,39 +1326,34 @@ zfs_mount(void) /* Read in the uberblock ring (128K). */ if (devread(sector + - ((VDEV_SKIP_SIZE + VDEV_PHYS_SIZE) >> - SPA_MINBLOCKSHIFT), 0, VDEV_UBERBLOCK_RING, - (char *)ub_array) == 0) + ((VDEV_SKIP_SIZE + VDEV_PHYS_SIZE) >> SPA_MINBLOCKSHIFT), + 0, VDEV_UBERBLOCK_RING, ub_array) == 0) continue; - if ((ubbest = find_bestub(ub_array, sector)) != NULL && - zio_read(&ubbest->ubp_uberblock.ub_rootbp, osp, stack) - == 0) { - - VERIFY_OS_TYPE(osp, DMU_OST_META); - - if (check_pool_label(sector, stack, tmp_devid, - tmp_bootpath, &tmp_guid)) - continue; - if (pool_guid == 0) - pool_guid = tmp_guid; - - if (find_best_root && ((pool_guid != tmp_guid) || - vdev_uberblock_compare(&ubbest->ubp_uberblock, - &(current_uberblock)) <= 0)) - continue; - - /* Got the MOS. Save it at the memory addr MOS. */ - grub_memmove(MOS, &osp->os_meta_dnode, DNODE_SIZE); - grub_memmove(¤t_uberblock, - &ubbest->ubp_uberblock, sizeof (uberblock_t)); - grub_memmove(current_bootpath, tmp_bootpath, - MAXNAMELEN); - grub_memmove(current_devid, tmp_devid, - grub_strlen(tmp_devid)); - is_zfs_mount = 1; - return (1); - } + if (check_pool_label(sector, stack, tmp_devid, + tmp_bootpath, &tmp_guid, &ashift)) + continue; + + if (pool_guid == 0) + pool_guid = tmp_guid; + + if ((ubbest = find_bestub(ub_array, ashift, sector)) == NULL || + zio_read(&ubbest->ub_rootbp, osp, stack) != 0) + continue; + + VERIFY_OS_TYPE(osp, DMU_OST_META); + + if (find_best_root && ((pool_guid != tmp_guid) || + vdev_uberblock_compare(ubbest, &(current_uberblock)) <= 0)) + continue; + + /* Got the MOS. Save it at the memory addr MOS. */ + grub_memmove(MOS, &osp->os_meta_dnode, DNODE_SIZE); + grub_memmove(¤t_uberblock, ubbest, sizeof (uberblock_t)); + grub_memmove(current_bootpath, tmp_bootpath, MAXNAMELEN); + grub_memmove(current_devid, tmp_devid, grub_strlen(tmp_devid)); + is_zfs_mount = 1; + return (1); } /* diff --git a/usr/src/grub/grub-0.97/stage2/fsys_zfs.h b/usr/src/grub/grub-0.97/stage2/fsys_zfs.h index d439392f3f..b0fdc6e2e9 100644 --- a/usr/src/grub/grub-0.97/stage2/fsys_zfs.h +++ b/usr/src/grub/grub-0.97/stage2/fsys_zfs.h @@ -95,27 +95,8 @@ typedef unsigned int size_t; #define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32)) #define P2ROUNDUP(x, align) (-(-(x) & -(align))) -/* - * XXX Match these macro up with real zfs once we have nvlist support so that we - * can support large sector disks. - */ -#define UBERBLOCK_SIZE (1ULL << UBERBLOCK_SHIFT) -#undef offsetof -#define offsetof(t, m) ((int)&(((t *)0)->m)) -#define VDEV_UBERBLOCK_SHIFT UBERBLOCK_SHIFT -#define VDEV_UBERBLOCK_OFFSET(n) \ -offsetof(vdev_label_t, vl_uberblock[(n) << VDEV_UBERBLOCK_SHIFT]) - typedef struct uberblock uberblock_t; -/* XXX Uberblock_phys_t is no longer in the kernel zfs */ -typedef struct uberblock_phys { - uberblock_t ubp_uberblock; - char ubp_pad[UBERBLOCK_SIZE - sizeof (uberblock_t) - - sizeof (zio_eck_t)]; - zio_eck_t ubp_zec; -} uberblock_phys_t; - /* * Macros to get fields in a bp or DVA. */ diff --git a/usr/src/grub/grub-0.97/stage2/zfs-include/vdev_impl.h b/usr/src/grub/grub-0.97/stage2/zfs-include/vdev_impl.h index ba427dd2bf..7363fc3d96 100644 --- a/usr/src/grub/grub-0.97/stage2/zfs-include/vdev_impl.h +++ b/usr/src/grub/grub-0.97/stage2/zfs-include/vdev_impl.h @@ -24,12 +24,26 @@ #ifndef _SYS_VDEV_IMPL_H #define _SYS_VDEV_IMPL_H +/* helper macros */ +#undef offsetof +#define offsetof(t, m) ((int)&(((t *)0)->m)) +#define MAX(x, y) ((x) > (y) ? (x) : (y)) + #define VDEV_PAD_SIZE (8 << 10) /* 2 padding areas (vl_pad1 and vl_pad2) to skip */ #define VDEV_SKIP_SIZE VDEV_PAD_SIZE * 2 #define VDEV_PHYS_SIZE (112 << 10) #define VDEV_UBERBLOCK_RING (128 << 10) +#define VDEV_UBERBLOCK_SHIFT(sh) \ + MAX((sh), UBERBLOCK_SHIFT) +#define VDEV_UBERBLOCK_COUNT(sh) \ + (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT(sh)) +#define VDEV_UBERBLOCK_OFFSET(sh, n) \ + offsetof(vdev_label_t, vl_uberblock[(n) << VDEV_UBERBLOCK_SHIFT(sh)]) +#define VDEV_UBERBLOCK_SIZE(sh) \ + (1ULL << VDEV_UBERBLOCK_SHIFT(sh)) + typedef struct vdev_phys { char vp_nvlist[VDEV_PHYS_SIZE - sizeof (zio_eck_t)]; zio_eck_t vp_zbt; |