summaryrefslogtreecommitdiffstats
path: root/sys/cddl/boot
diff options
context:
space:
mode:
authorrnoland <rnoland@FreeBSD.org>2009-10-23 18:44:53 +0000
committerrnoland <rnoland@FreeBSD.org>2009-10-23 18:44:53 +0000
commit8a200b8ecf6471a2f6b31a0056a9302651259a95 (patch)
tree54470b2775fb022903573c97e9f3370147d0c142 /sys/cddl/boot
parent364b20ea38ba4e0c43cf52903665e313590f0df6 (diff)
downloadFreeBSD-src-8a200b8ecf6471a2f6b31a0056a9302651259a95.zip
FreeBSD-src-8a200b8ecf6471a2f6b31a0056a9302651259a95.tar.gz
Correct some issues with zfs boot.
- Teach it to read gang blocks. (essentially untested) If you see "ZFS: gang block detected!", please let me know, so we can either remove the printf if it works, or fix it if it doesn't. - If multiple partitions exist on a disk, probe them all. We also need to reset dsk->start to 0 to read the right sector here. - With GPT, we can have 128 partitions. - If the bootfs property has ever been set on a pool it seems that it never goes away. zpool won't allow you to add to the pool with the bootfs property set. However, if you clear the property back to default we end up getting 0 for the object number and read a bogus block pointer and fail to boot. - Fix some error printfs. The printf in the loader is only capable of c,s and u formats. - Teach printf how to display %llu Reviewed by: dfr, jhb MFC after: 2 weeks
Diffstat (limited to 'sys/cddl/boot')
-rw-r--r--sys/cddl/boot/zfs/zfsimpl.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/sys/cddl/boot/zfs/zfsimpl.h b/sys/cddl/boot/zfs/zfsimpl.h
index a0b7b72..688bb5c 100644
--- a/sys/cddl/boot/zfs/zfsimpl.h
+++ b/sys/cddl/boot/zfs/zfsimpl.h
@@ -374,6 +374,24 @@ typedef struct vdev_label {
#define VDEV_LABEL_END_SIZE (2 * sizeof (vdev_label_t))
#define VDEV_LABELS 4
+/*
+ * Gang block headers are self-checksumming and contain an array
+ * of block pointers.
+ */
+#define SPA_GANGBLOCKSIZE SPA_MINBLOCKSIZE
+#define SPA_GBH_NBLKPTRS ((SPA_GANGBLOCKSIZE - \
+ sizeof (zio_block_tail_t)) / sizeof (blkptr_t))
+#define SPA_GBH_FILLER ((SPA_GANGBLOCKSIZE - \
+ sizeof (zio_block_tail_t) - \
+ (SPA_GBH_NBLKPTRS * sizeof (blkptr_t))) /\
+ sizeof (uint64_t))
+
+typedef struct zio_gbh {
+ blkptr_t zg_blkptr[SPA_GBH_NBLKPTRS];
+ uint64_t zg_filler[SPA_GBH_FILLER];
+ zio_block_tail_t zg_tail;
+} zio_gbh_phys_t;
+
enum zio_checksum {
ZIO_CHECKSUM_INHERIT = 0,
ZIO_CHECKSUM_ON,
OpenPOWER on IntegriCloud