1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-25 11:37:56 +00:00

Some zfsboot fixes from Norikatsu Shigemura:

1. zfsboot2 (boot2) doesn't %d (printf), so change %d to %u.
2. chase new zpool versioning as SPA_VERSION.
   Obtained from: sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h

Submitted by:	nork
This commit is contained in:
Doug Rabson 2008-11-19 16:59:19 +00:00
parent 51f0d2e192
commit 0d16312b46
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=185097
3 changed files with 31 additions and 25 deletions

View File

@ -656,8 +656,9 @@ vdev_probe(vdev_read_t *read, void *read_priv, spa_t **spap)
return (EIO);
}
if (val != ZFS_VERSION) {
printf("ZFS: unsupported ZFS version %d\n", (int) val);
if (val > SPA_VERSION) {
printf("ZFS: unsupported ZFS version %u (should be %u)\n",
(unsigned) val, (unsigned) SPA_VERSION);
return (EIO);
}

View File

@ -448,41 +448,46 @@ typedef enum {
/*
* On-disk version number.
*/
#define ZFS_VERSION_1 1ULL
#define ZFS_VERSION_2 2ULL
#define ZFS_VERSION_3 3ULL
#define ZFS_VERSION_4 4ULL
#define ZFS_VERSION_5 5ULL
#define ZFS_VERSION_6 6ULL
#define SPA_VERSION_1 1ULL
#define SPA_VERSION_2 2ULL
#define SPA_VERSION_3 3ULL
#define SPA_VERSION_4 4ULL
#define SPA_VERSION_5 5ULL
#define SPA_VERSION_6 6ULL
#define SPA_VERSION_7 7ULL
#define SPA_VERSION_8 8ULL
#define SPA_VERSION_9 9ULL
#define SPA_VERSION_10 10ULL
#define SPA_VERSION_11 11ULL
/*
* When bumping up ZFS_VERSION, make sure GRUB ZFS understand the on-disk
* When bumping up SPA_VERSION, make sure GRUB ZFS understand the on-disk
* format change. Go to usr/src/grub/grub-0.95/stage2/{zfs-include/, fsys_zfs*},
* and do the appropriate changes.
*/
#define ZFS_VERSION ZFS_VERSION_6
#define ZFS_VERSION_STRING "6"
#define SPA_VERSION SPA_VERSION_11
#define SPA_VERSION_STRING "11"
/*
* Symbolic names for the changes that caused a ZFS_VERSION switch.
* Symbolic names for the changes that caused a SPA_VERSION switch.
* Used in the code when checking for presence or absence of a feature.
* Feel free to define multiple symbolic names for each version if there
* were multiple changes to on-disk structures during that version.
*
* NOTE: When checking the current ZFS_VERSION in your code, be sure
* NOTE: When checking the current SPA_VERSION in your code, be sure
* to use spa_version() since it reports the version of the
* last synced uberblock. Checking the in-flight version can
* be dangerous in some cases.
*/
#define ZFS_VERSION_INITIAL ZFS_VERSION_1
#define ZFS_VERSION_DITTO_BLOCKS ZFS_VERSION_2
#define ZFS_VERSION_SPARES ZFS_VERSION_3
#define ZFS_VERSION_RAID6 ZFS_VERSION_3
#define ZFS_VERSION_BPLIST_ACCOUNT ZFS_VERSION_3
#define ZFS_VERSION_RAIDZ_DEFLATE ZFS_VERSION_3
#define ZFS_VERSION_DNODE_BYTES ZFS_VERSION_3
#define ZFS_VERSION_ZPOOL_HISTORY ZFS_VERSION_4
#define ZFS_VERSION_GZIP_COMPRESSION ZFS_VERSION_5
#define ZFS_VERSION_BOOTFS ZFS_VERSION_6
#define SPA_VERSION_INITIAL SPA_VERSION_1
#define SPA_VERSION_DITTO_BLOCKS SPA_VERSION_2
#define SPA_VERSION_SPARES SPA_VERSION_3
#define SPA_VERSION_RAID6 SPA_VERSION_3
#define SPA_VERSION_BPLIST_ACCOUNT SPA_VERSION_3
#define SPA_VERSION_RAIDZ_DEFLATE SPA_VERSION_3
#define SPA_VERSION_DNODE_BYTES SPA_VERSION_3
#define SPA_VERSION_ZPOOL_HISTORY SPA_VERSION_4
#define SPA_VERSION_GZIP_COMPRESSION SPA_VERSION_5
#define SPA_VERSION_BOOTFS SPA_VERSION_6
/*
* The following are configuration names used in the nvlist describing a pool's
@ -603,7 +608,7 @@ typedef enum pool_state {
struct uberblock {
uint64_t ub_magic; /* UBERBLOCK_MAGIC */
uint64_t ub_version; /* ZFS_VERSION */
uint64_t ub_version; /* SPA_VERSION */
uint64_t ub_txg; /* txg of last sync */
uint64_t ub_guid_sum; /* sum of all vdev guids */
uint64_t ub_timestamp; /* UTC time of last sync */

View File

@ -162,7 +162,7 @@ zio_decompress_data(int cpfunc, void *src, uint64_t srcsize,
/* ASSERT((uint_t)cpfunc < ZIO_COMPRESS_FUNCTIONS); */
if (!ci->ci_decompress) {
printf("ZFS: unsupported compression algorithm %d\n", cpfunc);
printf("ZFS: unsupported compression algorithm %u\n", cpfunc);
return (EIO);
}