svn commit: r219089 - in head: cddl/compat/opensolaris/include cddl/compat/opensolaris/misc cddl/contrib/opensolaris/cmd/stat cddl/contrib/opensolaris/cmd/stat/common cddl/contrib/opensolaris/cmd/z...

Author: pjd Date: Sun Feb 27 19:41:40 2011 New Revision: 219089 URL: http://svn.freebsd.org/changeset/base/219089 Log: Finally... Import the latest open-source ZFS version - (SPA) 28. Few new things available from now on: - Data deduplication. - Triple parity RAIDZ (RAIDZ3). - zfs diff. - zpool split. - Snapshot holds. - zpool import -F. Allows to rewind corrupted pool to earlier transaction group. - Possibility to import pool in read-only mode. MFC after: 1 month Added: head/cddl/compat/opensolaris/include/sha2.h (contents, props changed) head/cddl/compat/opensolaris/include/thread_pool.h (contents, props changed) head/cddl/contrib/opensolaris/cmd/stat/ head/cddl/contrib/opensolaris/cmd/stat/common/ head/cddl/contrib/opensolaris/cmd/stat/common/statcommon.h (contents, props changed) head/cddl/contrib/opensolaris/cmd/stat/common/timestamp.c (contents, props changed) head/cddl/contrib/opensolaris/cmd/zlook/ head/cddl/contrib/opensolaris/cmd/zlook/zlook.c (contents, props changed) head/cddl/contrib/opensolaris/cmd/zstreamdump/ head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 (contents, props changed) head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c (contents, props changed) head/cddl/contrib/opensolaris/lib/libuutil/common/uu_string.c (contents, props changed) head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c (contents, props changed) head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_fru.c (contents, props changed) head/cddl/contrib/opensolaris/lib/pyzfs/common/holds.py (contents, props changed) head/cddl/contrib/opensolaris/lib/pyzfs/common/table.py (contents, props changed) head/cddl/usr.bin/zlook/ head/cddl/usr.bin/zlook/Makefile (contents, props changed) head/cddl/usr.bin/zstreamdump/ head/cddl/usr.bin/zstreamdump/Makefile (contents, props changed) head/sys/cddl/boot/zfs/zle.c (contents, props changed) head/sys/cddl/compat/opensolaris/kern/opensolaris_sunddi.c (contents, props changed) head/sys/cddl/compat/opensolaris/kern/opensolaris_sysevent.c (contents, props changed) head/sys/cddl/compat/opensolaris/sys/systeminfo.h (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zfs_fletcher.c (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zfs_fletcher.h (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt_zap.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bpobj.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deadlist.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_scan.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/sa_impl.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_onexit.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_sa.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_stat.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zrlock.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_debug.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_onexit.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zle.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/os/fm.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zut.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/dev.h (contents, props changed) Deleted: head/sys/cddl/compat/opensolaris/sys/sysmacros.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scrub.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/fletcher.c head/sys/cddl/contrib/opensolaris/uts/common/sys/byteorder.h Modified: head/cddl/compat/opensolaris/include/fcntl.h head/cddl/compat/opensolaris/include/mnttab.h head/cddl/compat/opensolaris/include/priv.h head/cddl/compat/opensolaris/include/solaris.h head/cddl/compat/opensolaris/misc/fsshare.c head/cddl/compat/opensolaris/misc/zmount.c head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/cddl/contrib/opensolaris/cmd/zfs/zfs_util.h head/cddl/contrib/opensolaris/cmd/zinject/translate.c head/cddl/contrib/opensolaris/cmd/zinject/zinject.c head/cddl/contrib/opensolaris/cmd/zinject/zinject.h head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_util.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/cddl/contrib/opensolaris/head/synch.h head/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c head/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.h head/cddl/contrib/opensolaris/lib/libuutil/common/libuutil.h head/cddl/contrib/opensolaris/lib/libuutil/common/uu_alloc.c head/cddl/contrib/opensolaris/lib/libuutil/common/uu_misc.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h head/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c head/cddl/contrib/opensolaris/lib/libzpool/common/util.c head/cddl/contrib/opensolaris/lib/pyzfs/common/__init__.py head/cddl/contrib/opensolaris/lib/pyzfs/common/allow.py head/cddl/contrib/opensolaris/lib/pyzfs/common/dataset.py head/cddl/contrib/opensolaris/lib/pyzfs/common/groupspace.py head/cddl/contrib/opensolaris/lib/pyzfs/common/ioctl.c head/cddl/contrib/opensolaris/lib/pyzfs/common/unallow.py head/cddl/contrib/opensolaris/lib/pyzfs/common/userspace.py head/cddl/contrib/opensolaris/lib/pyzfs/common/util.py head/cddl/lib/libzfs/Makefile head/cddl/lib/libzpool/Makefile head/cddl/sbin/zfs/Makefile head/cddl/sbin/zpool/Makefile head/cddl/usr.bin/Makefile head/cddl/usr.bin/ztest/Makefile head/cddl/usr.sbin/zdb/Makefile head/rescue/rescue/Makefile head/sys/boot/i386/gptzfsboot/Makefile head/sys/boot/i386/zfsboot/Makefile head/sys/boot/zfs/zfs.c head/sys/boot/zfs/zfsimpl.c head/sys/cddl/boot/zfs/fletcher.c head/sys/cddl/boot/zfs/zfsimpl.h head/sys/cddl/boot/zfs/zfssubr.c head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c head/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c head/sys/cddl/compat/opensolaris/kern/opensolaris_string.c head/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c head/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c head/sys/cddl/compat/opensolaris/sys/atomic.h head/sys/cddl/compat/opensolaris/sys/byteorder.h head/sys/cddl/compat/opensolaris/sys/dirent.h head/sys/cddl/compat/opensolaris/sys/file.h head/sys/cddl/compat/opensolaris/sys/kmem.h head/sys/cddl/compat/opensolaris/sys/misc.h head/sys/cddl/compat/opensolaris/sys/mount.h head/sys/cddl/compat/opensolaris/sys/mutex.h head/sys/cddl/compat/opensolaris/sys/policy.h head/sys/cddl/compat/opensolaris/sys/proc.h head/sys/cddl/compat/opensolaris/sys/rwlock.h head/sys/cddl/compat/opensolaris/sys/sid.h head/sys/cddl/compat/opensolaris/sys/stat.h head/sys/cddl/compat/opensolaris/sys/string.h head/sys/cddl/compat/opensolaris/sys/sunddi.h head/sys/cddl/compat/opensolaris/sys/systm.h head/sys/cddl/compat/opensolaris/sys/taskq.h head/sys/cddl/compat/opensolaris/sys/time.h head/sys/cddl/compat/opensolaris/sys/types.h head/sys/cddl/compat/opensolaris/sys/uio.h head/sys/cddl/compat/opensolaris/sys/vfs.h head/sys/cddl/compat/opensolaris/sys/vnode.h head/sys/cddl/compat/opensolaris/sys/zone.h head/sys/cddl/contrib/opensolaris/common/acl/acl_common.c head/sys/cddl/contrib/opensolaris/common/acl/acl_common.h head/sys/cddl/contrib/opensolaris/common/atomic/amd64/opensolaris_atomic.S head/sys/cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S head/sys/cddl/contrib/opensolaris/common/atomic/ia64/opensolaris_atomic.S head/sys/cddl/contrib/opensolaris/common/atomic/powerpc64/opensolaris_atomic.S head/sys/cddl/contrib/opensolaris/common/atomic/sparc64/opensolaris_atomic.S head/sys/cddl/contrib/opensolaris/common/avl/avl.c head/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c head/sys/cddl/contrib/opensolaris/common/unicode/u8_textprep.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.h head/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.h head/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.h head/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c head/sys/cddl/contrib/opensolaris/common/zfs/zprop_common.c head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c head/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bplist.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bplist.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_traverse.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deleg.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_prop.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_boot.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_leaf.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_debug.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_fuid.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_checksum.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/uberblock.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c head/sys/cddl/contrib/opensolaris/uts/common/os/callb.c head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h head/sys/cddl/contrib/opensolaris/uts/common/sys/acl_impl.h head/sys/cddl/contrib/opensolaris/uts/common/sys/avl.h head/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h head/sys/cddl/contrib/opensolaris/uts/common/sys/cpupart.h head/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h head/sys/cddl/contrib/opensolaris/uts/common/sys/cred.h head/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h head/sys/cddl/contrib/opensolaris/uts/common/sys/fm/fs/zfs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/fm/protocol.h head/sys/cddl/contrib/opensolaris/uts/common/sys/fm/util.h head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/gfs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/idmap.h head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/nvpair.h head/sys/cddl/contrib/opensolaris/uts/common/sys/processor.h head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent.h head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h head/sys/cddl/contrib/opensolaris/uts/common/sys/taskq.h head/sys/cddl/contrib/opensolaris/uts/common/sys/u8_textprep.h head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h head/sys/modules/opensolaris/Makefile head/sys/modules/zfs/Makefile head/usr.bin/fstat/zfs.c Modified: head/cddl/compat/opensolaris/include/fcntl.h ============================================================================== --- head/cddl/compat/opensolaris/include/fcntl.h Sun Feb 27 18:23:28 2011 (r219088) +++ head/cddl/compat/opensolaris/include/fcntl.h Sun Feb 27 19:41:40 2011 (r219089) @@ -32,6 +32,7 @@ #include_next <fcntl.h> -#define open64 open +#define open64(...) open(__VA_ARGS__) +#define openat64(...) openat(__VA_ARGS__) #endif Modified: head/cddl/compat/opensolaris/include/mnttab.h ============================================================================== --- head/cddl/compat/opensolaris/include/mnttab.h Sun Feb 27 18:23:28 2011 (r219088) +++ head/cddl/compat/opensolaris/include/mnttab.h Sun Feb 27 19:41:40 2011 (r219089) @@ -12,6 +12,10 @@ #define MNTTAB _PATH_DEVZERO #define MNT_LINE_MAX 1024 +#define MS_OVERLAY 0x0 +#define MS_NOMNTTAB 0x0 +#define MS_RDONLY 0x1 + #define umount2(p, f) unmount(p, f) struct mnttab { Modified: head/cddl/compat/opensolaris/include/priv.h ============================================================================== --- head/cddl/compat/opensolaris/include/priv.h Sun Feb 27 18:23:28 2011 (r219088) +++ head/cddl/compat/opensolaris/include/priv.h Sun Feb 27 19:41:40 2011 (r219089) @@ -10,7 +10,7 @@ #define PRIV_SYS_CONFIG 0 static __inline int -priv_ineffect(priv) +priv_ineffect(int priv) { assert(priv == PRIV_SYS_CONFIG); Added: head/cddl/compat/opensolaris/include/sha2.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/compat/opensolaris/include/sha2.h Sun Feb 27 19:41:40 2011 (r219089) @@ -0,0 +1,38 @@ +/*- + * Copyright (c) 2010 Pawel Jakub Dawidek <pjd at FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _OPENSOLARIS_SHA2_H_ +#define _OPENSOLARIS_SHA2_H_ + +#include_next <sha256.h> + +#define SHA256Init(c) SHA256_Init(c) +#define SHA256Update(c, d, s) SHA256_Update((c), (d), (s)) +#define SHA256Final(b, c) SHA256_Final((unsigned char *)(b), (c)) + +#endif /* !_OPENSOLARIS_SHA2_H_ */ Modified: head/cddl/compat/opensolaris/include/solaris.h ============================================================================== --- head/cddl/compat/opensolaris/include/solaris.h Sun Feb 27 18:23:28 2011 (r219088) +++ head/cddl/compat/opensolaris/include/solaris.h Sun Feb 27 19:41:40 2011 (r219089) @@ -5,6 +5,10 @@ #include <sys/ccompile.h> -#define dirent64 dirent +#include <fcntl.h> + +#define NOTE(s) + +int mkdirp(const char *, mode_t); #endif /* !_SOLARIS_H_ */ Added: head/cddl/compat/opensolaris/include/thread_pool.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/compat/opensolaris/include/thread_pool.h Sun Feb 27 19:41:40 2011 (r219089) @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2010 Pawel Jakub Dawidek <pjd at FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _OPENSOLARIS_THREAD_POOL_H_ +#define _OPENSOLARIS_THREAD_POOL_H_ + +typedef int tpool_t; + +#define tpool_create(a, b, c, d) (0) +#define tpool_dispatch(pool, func, arg) func(arg) +#define tpool_wait(pool) do { } while (0) +#define tpool_destroy(pool) do { } while (0) + +#endif /* !_OPENSOLARIS_THREAD_POOL_H_ */ Modified: head/cddl/compat/opensolaris/misc/fsshare.c ============================================================================== --- head/cddl/compat/opensolaris/misc/fsshare.c Sun Feb 27 18:23:28 2011 (r219088) +++ head/cddl/compat/opensolaris/misc/fsshare.c Sun Feb 27 19:41:40 2011 (r219089) @@ -28,15 +28,17 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> -#include <stdio.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> + +#include <assert.h> #include <errno.h> +#include <fcntl.h> +#include <fsshare.h> #include <libutil.h> -#include <assert.h> #include <pathnames.h> /* _PATH_MOUNTDPID */ -#include <fsshare.h> +#include <signal.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> #define FILE_HEADER "# !!! DO NOT EDIT THIS FILE MANUALLY !!!



" #define OPTSSIZE 1024 Modified: head/cddl/compat/opensolaris/misc/zmount.c ============================================================================== --- head/cddl/compat/opensolaris/misc/zmount.c Sun Feb 27 18:23:28 2011 (r219088) +++ head/cddl/compat/opensolaris/misc/zmount.c Sun Feb 27 19:41:40 2011 (r219089) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <mnttab.h> static void build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val, @@ -78,7 +79,7 @@ zmount(const char *spec, const char *dir assert(spec != NULL); assert(dir != NULL); - assert(mflag == 0); + assert(mflag == 0 || mflag == MS_RDONLY); assert(fstype != NULL); assert(strcmp(fstype, MNTTYPE_ZFS) == 0); assert(dataptr == NULL); @@ -91,6 +92,8 @@ zmount(const char *spec, const char *dir iov = NULL; iovlen = 0; + if (mflag & MS_RDONLY) + build_iovec(&iov, &iovlen, "ro", NULL, 0); build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1); build_iovec(&iov, &iovlen, "fspath", __DECONST(char *, dir), (size_t)-1); Added: head/cddl/contrib/opensolaris/cmd/stat/common/statcommon.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/stat/common/statcommon.h Sun Feb 27 19:41:40 2011 (r219089) @@ -0,0 +1,50 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * + * Common routines for acquiring snapshots of kstats for + * iostat, mpstat, and vmstat. + */ + +#ifndef _STATCOMMON_H +#define _STATCOMMON_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdio.h> +#include <sys/types.h> +#include <time.h> + +#define NODATE 0 /* Default: No time stamp */ +#define DDATE 1 /* Standard date format */ +#define UDATE 2 /* Internal representation of Unix time */ + +/* Print a timestamp in either Unix or standard format. */ +void print_timestamp(uint_t); + +#ifdef __cplusplus +} +#endif + +#endif /* _STATCOMMON_H */ Added: head/cddl/contrib/opensolaris/cmd/stat/common/timestamp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/contrib/opensolaris/cmd/stat/common/timestamp.c Sun Feb 27 19:41:40 2011 (r219089) @@ -0,0 +1,49 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include "statcommon.h" + +#include <langinfo.h> + +/* + * Print timestamp as decimal reprentation of time_t value (-T u was specified) + * or in date(1) format (-T d was specified). + */ +void +print_timestamp(uint_t timestamp_fmt) +{ + time_t t = time(NULL); + + if (timestamp_fmt == UDATE) { + (void) printf("%ld

", t); + } else if (timestamp_fmt == DDATE) { + char dstr[64]; + int len; + + len = strftime(dstr, sizeof (dstr), "%+", localtime(&t)); + if (len > 0) + (void) printf("%s

", dstr); + } +} Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sun Feb 27 18:23:28 2011 (r219088) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Sun Feb 27 19:41:40 2011 (r219089) @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. */ #include <stdio.h> @@ -34,6 +33,9 @@ #include <sys/zap.h> #include <sys/fs/zfs.h> #include <sys/zfs_znode.h> +#include <sys/zfs_sa.h> +#include <sys/sa.h> +#include <sys/sa_impl.h> #include <sys/vdev.h> #include <sys/vdev_impl.h> #include <sys/metaslab_impl.h> @@ -51,10 +53,25 @@ #include <sys/zio_compress.h> #include <sys/zfs_fuid.h> #include <sys/arc.h> +#include <sys/ddt.h> #undef ZFS_MAXNAMELEN #undef verify #include <libzfs.h> +#define ZDB_COMPRESS_NAME(idx) ((idx) < ZIO_COMPRESS_FUNCTIONS ? \ + zio_compress_table[(idx)].ci_name : "UNKNOWN") +#define ZDB_CHECKSUM_NAME(idx) ((idx) < ZIO_CHECKSUM_FUNCTIONS ? \ + zio_checksum_table[(idx)].ci_name : "UNKNOWN") +#define ZDB_OT_NAME(idx) ((idx) < DMU_OT_NUMTYPES ? \ + dmu_ot[(idx)].ot_name : "UNKNOWN") +#define ZDB_OT_TYPE(idx) ((idx) < DMU_OT_NUMTYPES ? (idx) : DMU_OT_NUMTYPES) + +#ifndef lint +extern int zfs_recover; +#else +int zfs_recover; +#endif + const char cmdname[] = "zdb"; uint8_t dump_opt[256]; @@ -64,8 +81,6 @@ extern void dump_intent_log(zilog_t *); uint64_t *zopt_object = NULL; int zopt_objects = 0; libzfs_handle_t *g_zfs; -boolean_t zdb_sig_user_data = B_TRUE; -int zdb_sig_cksumalg = ZIO_CHECKSUM_SHA256; /* * These libumem hooks provide a reasonable set of defaults for the allocator's @@ -87,39 +102,56 @@ static void usage(void) { (void) fprintf(stderr, - "Usage: %s [-udibcsvL] [-U cachefile_path] [-t txg]

" - "\t [-S user:cksumalg] " - "dataset [object...]

" - " %s -C [pool]

" - " %s -l dev

" - " %s -R pool:vdev:offset:size:flags

" - " %s [-p path_to_vdev_dir]

" - " %s -e pool | GUID | devid ...

", - cmdname, cmdname, cmdname, cmdname, cmdname, cmdname); - - (void) fprintf(stderr, " -u uberblock

"); - (void) fprintf(stderr, " -d datasets

"); - (void) fprintf(stderr, " -C cached pool configuration

"); - (void) fprintf(stderr, " -i intent logs

"); - (void) fprintf(stderr, " -b block statistics

"); - (void) fprintf(stderr, " -m metaslabs

"); - (void) fprintf(stderr, " -c checksum all metadata (twice for " + "Usage: %s [-CumdibcsDvhL] poolname [object...]

" + " %s [-div] dataset [object...]

" + " %s -m [-L] poolname [vdev [metaslab...]]

" + " %s -R poolname vdev:offset:size[:flags]

" + " %s -S poolname

" + " %s -l [-u] device

" + " %s -C



", + cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname); + + (void) fprintf(stderr, " Dataset name must include at least one " + "separator character '/' or '@'

"); + (void) fprintf(stderr, " If dataset name is specified, only that " + "dataset is dumped

"); + (void) fprintf(stderr, " If object numbers are specified, only " + "those objects are dumped



"); + (void) fprintf(stderr, " Options to control amount of output:

"); + (void) fprintf(stderr, " -u uberblock

"); + (void) fprintf(stderr, " -d dataset(s)

"); + (void) fprintf(stderr, " -i intent logs

"); + (void) fprintf(stderr, " -C config (or cachefile if alone)

"); + (void) fprintf(stderr, " -h pool history

"); + (void) fprintf(stderr, " -b block statistics

"); + (void) fprintf(stderr, " -m metaslabs

"); + (void) fprintf(stderr, " -c checksum all metadata (twice for " "all data) blocks

"); - (void) fprintf(stderr, " -s report stats on zdb's I/O

"); - (void) fprintf(stderr, " -S <user|all>:<cksum_alg|all> -- " - "dump blkptr signatures

"); - (void) fprintf(stderr, " -v verbose (applies to all others)

"); + (void) fprintf(stderr, " -s report stats on zdb's I/O

"); + (void) fprintf(stderr, " -D dedup statistics

"); + (void) fprintf(stderr, " -S simulate dedup to measure effect

"); + (void) fprintf(stderr, " -v verbose (applies to all others)

"); (void) fprintf(stderr, " -l dump label contents

"); (void) fprintf(stderr, " -L disable leak tracking (do not " "load spacemaps)

"); - (void) fprintf(stderr, " -U cachefile_path -- use alternate " - "cachefile

"); (void) fprintf(stderr, " -R read and display block from a " - "device

"); - (void) fprintf(stderr, " -e Pool is exported/destroyed/" - "has altroot

"); - (void) fprintf(stderr, " -p <Path to vdev dir> (use with -e)

"); - (void) fprintf(stderr, " -t <txg> highest txg to use when " + "device



"); + (void) fprintf(stderr, " Below options are intended for use " + "with other options (except -l):

"); + (void) fprintf(stderr, " -A ignore assertions (-A), enable " + "panic recovery (-AA) or both (-AAA)

"); + (void) fprintf(stderr, " -F attempt automatic rewind within " + "safe range of transaction groups

"); + (void) fprintf(stderr, " -U <cachefile_path> -- use alternate " + "cachefile

"); + (void) fprintf(stderr, " -X attempt extreme rewind (does not " + "work with dataset)

"); + (void) fprintf(stderr, " -e pool is exported/destroyed/" + "has altroot/not in a cachefile

"); + (void) fprintf(stderr, " -p <path> -- use one or more with " + "-e to specify path to vdev dir

"); + (void) fprintf(stderr, " -P print numbers parsable

"); + (void) fprintf(stderr, " -t <txg> -- highest txg to use when " "searching for uberblocks

"); (void) fprintf(stderr, "Specify an option more than once (e.g. -bb) " "to make only that option verbose

"); @@ -146,68 +178,6 @@ fatal(const char *fmt, ...) exit(1); } -static void -dump_nvlist(nvlist_t *list, int indent) -{ - nvpair_t *elem = NULL; - - while ((elem = nvlist_next_nvpair(list, elem)) != NULL) { - switch (nvpair_type(elem)) { - case DATA_TYPE_STRING: - { - char *value; - - VERIFY(nvpair_value_string(elem, &value) == 0); - (void) printf("%*s%s='%s'

", indent, "", - nvpair_name(elem), value); - } - break; - - case DATA_TYPE_UINT64: - { - uint64_t value; - - VERIFY(nvpair_value_uint64(elem, &value) == 0); - (void) printf("%*s%s=%llu

", indent, "", - nvpair_name(elem), (u_longlong_t)value); - } - break; - - case DATA_TYPE_NVLIST: - { - nvlist_t *value; - - VERIFY(nvpair_value_nvlist(elem, &value) == 0); - (void) printf("%*s%s

", indent, "", - nvpair_name(elem)); - dump_nvlist(value, indent + 4); - } - break; - - case DATA_TYPE_NVLIST_ARRAY: - { - nvlist_t **value; - uint_t c, count; - - VERIFY(nvpair_value_nvlist_array(elem, &value, - &count) == 0); - - for (c = 0; c < count; c++) { - (void) printf("%*s%s[%u]

", indent, "", - nvpair_name(elem), c); - dump_nvlist(value[c], indent + 8); - } - } - break; - - default: - - (void) printf("bad config type %d for %s

", - nvpair_type(elem), nvpair_name(elem)); - } - } -} - /* ARGSUSED */ static void dump_packed_nvlist(objset_t *os, uint64_t object, void *data, size_t size) @@ -227,6 +197,15 @@ dump_packed_nvlist(objset_t *os, uint64_ nvlist_free(nv); } +static void +zdb_nicenum(uint64_t num, char *buf) +{ + if (dump_opt['P']) + (void) sprintf(buf, "%llu", (longlong_t)num); + else + nicenum(num, buf); +} + const char dump_zap_stars[] = "****************************************"; const int dump_zap_width = sizeof (dump_zap_stars) - 1; @@ -325,6 +304,13 @@ dump_none(objset_t *os, uint64_t object, } /*ARGSUSED*/ +static void +dump_unknown(objset_t *os, uint64_t object, void *data, size_t size) +{ + (void) printf("\tUNKNOWN OBJECT TYPE

"); +} + +/*ARGSUSED*/ void dump_uint8(objset_t *os, uint64_t object, void *data, size_t size) { @@ -388,6 +374,79 @@ dump_zap(objset_t *os, uint64_t object, /*ARGSUSED*/ static void +dump_ddt_zap(objset_t *os, uint64_t object, void *data, size_t size) +{ + dump_zap_stats(os, object); + /* contents are printed elsewhere, properly decoded */ +} + +/*ARGSUSED*/ +static void +dump_sa_attrs(objset_t *os, uint64_t object, void *data, size_t size) +{ + zap_cursor_t zc; + zap_attribute_t attr; + + dump_zap_stats(os, object); + (void) printf("

"); + + for (zap_cursor_init(&zc, os, object); + zap_cursor_retrieve(&zc, &attr) == 0; + zap_cursor_advance(&zc)) { + (void) printf("\t\t%s = ", attr.za_name); + if (attr.za_num_integers == 0) { + (void) printf("

"); + continue; + } + (void) printf(" %llx : [%d:%d:%d]

", + (u_longlong_t)attr.za_first_integer, + (int)ATTR_LENGTH(attr.za_first_integer), + (int)ATTR_BSWAP(attr.za_first_integer), + (int)ATTR_NUM(attr.za_first_integer)); + } + zap_cursor_fini(&zc); +} + +/*ARGSUSED*/ +static void +dump_sa_layouts(objset_t *os, uint64_t object, void *data, size_t size) +{ + zap_cursor_t zc; + zap_attribute_t attr; + uint16_t *layout_attrs; + int i; + + dump_zap_stats(os, object); + (void) printf("

"); + + for (zap_cursor_init(&zc, os, object); + zap_cursor_retrieve(&zc, &attr) == 0; + zap_cursor_advance(&zc)) { + (void) printf("\t\t%s = [", attr.za_name); + if (attr.za_num_integers == 0) { + (void) printf("

"); + continue; + } + + VERIFY(attr.za_integer_length == 2); + layout_attrs = umem_zalloc(attr.za_num_integers * + attr.za_integer_length, UMEM_NOFAIL); + + VERIFY(zap_lookup(os, object, attr.za_name, + attr.za_integer_length, + attr.za_num_integers, layout_attrs) == 0); + + for (i = 0; i != attr.za_num_integers; i++) + (void) printf(" %d ", (int)layout_attrs[i]); + (void) printf("]

"); + umem_free(layout_attrs, + attr.za_num_integers * attr.za_integer_length); + } + zap_cursor_fini(&zc); +} + +/*ARGSUSED*/ +static void dump_zpldir(objset_t *os, uint64_t object, void *data, size_t size) { zap_cursor_t zc; @@ -441,17 +500,17 @@ dump_spacemap(objset_t *os, space_map_ob */ alloc = 0; for (offset = 0; offset < smo->smo_objsize; offset += sizeof (entry)) { - VERIFY(0 == dmu_read(os, smo->smo_object, offset, + VERIFY3U(0, ==, dmu_read(os, smo->smo_object, offset, sizeof (entry), &entry, DMU_READ_PREFETCH)); if (SM_DEBUG_DECODE(entry)) { - (void) printf("\t\t[%4llu] %s: txg %llu, pass %llu

", + (void) printf("\t [%6llu] %s: txg %llu, pass %llu

", (u_longlong_t)(offset / sizeof (entry)), ddata[SM_DEBUG_ACTION_DECODE(entry)], (u_longlong_t)SM_DEBUG_TXG_DECODE(entry), (u_longlong_t)SM_DEBUG_SYNCPASS_DECODE(entry)); } else { - (void) printf("\t\t[%4llu] %c range:" - " %08llx-%08llx size: %06llx

", + (void) printf("\t [%6llu] %c range:" + " %010llx-%010llx size: %06llx

", (u_longlong_t)(offset / sizeof (entry)), SM_TYPE_DECODE(entry) == SM_ALLOC ? 'A' : 'F', (u_longlong_t)((SM_OFFSET_DECODE(entry) << @@ -476,14 +535,14 @@ dump_spacemap(objset_t *os, space_map_ob static void dump_metaslab_stats(metaslab_t *msp) { - char maxbuf[5]; + char maxbuf[32]; space_map_t *sm = &msp->ms_map; avl_tree_t *t = sm->sm_pp_root; int free_pct = sm->sm_space * 100 / sm->sm_size; - nicenum(space_map_maxsize(sm), maxbuf); + zdb_nicenum(space_map_maxsize(sm), maxbuf); - (void) printf("\t %20s %10lu %7s %6s %4s %4d%%

", + (void) printf("\t %25s %10lu %7s %6s %4s %4d%%

", "segments", avl_numnodes(t), "maxsize", maxbuf, "freepct", free_pct); } @@ -495,16 +554,16 @@ dump_metaslab(metaslab_t *msp) spa_t *spa = vd->vdev_spa; space_map_t *sm = &msp->ms_map; space_map_obj_t *smo = &msp->ms_smo; - char freebuf[5]; + char freebuf[32]; - nicenum(sm->sm_size - smo->smo_alloc, freebuf); + zdb_nicenum(sm->sm_size - smo->smo_alloc, freebuf); (void) printf( - "\tvdev %5llu offset %12llx spacemap %6llu free %5s

", + "\tmetaslab %6llu offset %12llx spacemap %6llu free %5s

", (u_longlong_t)(sm->sm_start / sm->sm_size), (u_longlong_t)sm->sm_start, (u_longlong_t)smo->smo_object, freebuf); - if (dump_opt['m'] > 1) { + if (dump_opt['m'] > 1 && !dump_opt['L']) { mutex_enter(&msp->ms_lock); space_map_load_wait(sm); if (!sm->sm_loaded) @@ -525,22 +584,52 @@ dump_metaslab(metaslab_t *msp) } static void +print_vdev_metaslab_header(vdev_t *vd) +{ + (void) printf("\tvdev %10llu

\t%-10s%5llu %-19s %-15s %-10s

", + (u_longlong_t)vd->vdev_id, + "metaslabs", (u_longlong_t)vd->vdev_ms_count, + "offset", "spacemap", "free"); + (void) printf("\t%15s %19s %15s %10s

", + "---------------", "-------------------", + "---------------", "-------------"); +} + +static void dump_metaslabs(spa_t *spa) { - vdev_t *rvd = spa->spa_root_vdev; - vdev_t *vd; - int c, m; + vdev_t *vd, *rvd = spa->spa_root_vdev; + uint64_t m, c = 0, children = rvd->vdev_children; (void) printf("

Metaslabs:

"); - for (c = 0; c < rvd->vdev_children; c++) { - vd = rvd->vdev_child[c]; + if (!dump_opt['d'] && zopt_objects > 0) { + c = zopt_object[0]; - (void) printf("\t%-10s %-19s %-15s %-10s

", - "vdev", "offset", "spacemap", "free"); - (void) printf("\t%10s %19s %15s %10s

", - "----------", "-------------------", - "---------------", "-------------"); + if (c >= children) + (void) fatal("bad vdev id: %llu", (u_longlong_t)c); + + if (zopt_objects > 1) { + vd = rvd->vdev_child[c]; + print_vdev_metaslab_header(vd); + + for (m = 1; m < zopt_objects; m++) { + if (zopt_object[m] < vd->vdev_ms_count) + dump_metaslab( + vd->vdev_ms[zopt_object[m]]); + else + (void) fprintf(stderr, "bad metaslab " + "number %llu

", + (u_longlong_t)zopt_object[m]); + } + (void) printf("

"); + return; + } + children = c + 1; + } + for (; c < children; c++) { + vd = rvd->vdev_child[c]; + print_vdev_metaslab_header(vd); for (m = 0; m < vd->vdev_ms_count; m++) dump_metaslab(vd->vdev_ms[m]); @@ -549,6 +638,133 @@ dump_metaslabs(spa_t *spa) } static void +dump_dde(const ddt_t *ddt, const ddt_entry_t *dde, uint64_t index) +{ + const ddt_phys_t *ddp = dde->dde_phys; + const ddt_key_t *ddk = &dde->dde_key; + char *types[4] = { "ditto", "single", "double", "triple" }; + char blkbuf[BP_SPRINTF_LEN]; + blkptr_t blk; + + for (int p = 0; p < DDT_PHYS_TYPES; p++, ddp++) { + if (ddp->ddp_phys_birth == 0) + continue; + ddt_bp_create(ddt->ddt_checksum, ddk, ddp, &blk); + sprintf_blkptr(blkbuf, &blk); + (void) printf("index %llx refcnt %llu %s %s

", + (u_longlong_t)index, (u_longlong_t)ddp->ddp_refcnt, + types[p], blkbuf); + } +} + +static void +dump_dedup_ratio(const ddt_stat_t *dds) +{ + double rL, rP, rD, D, dedup, compress, copies; + + if (dds->dds_blocks == 0) + return; + + rL = (double)dds->dds_ref_lsize; + rP = (double)dds->dds_ref_psize; + rD = (double)dds->dds_ref_dsize; + D = (double)dds->dds_dsize; + + dedup = rD / D; + compress = rL / rP; + copies = rD / rP; + + (void) printf("dedup = %.2f, compress = %.2f, copies = %.2f, " + "dedup * compress / copies = %.2f



", + dedup, compress, copies, dedup * compress / copies); +} + +static void +dump_ddt(ddt_t *ddt, enum ddt_type type, enum ddt_class class) +{ + char name[DDT_NAMELEN]; + ddt_entry_t dde; + uint64_t walk = 0; + dmu_object_info_t doi; + uint64_t count, dspace, mspace; + int error; + + error = ddt_object_info(ddt, type, class, &doi); + + if (error == ENOENT) + return; + ASSERT(error == 0); + + if ((count = ddt_object_count(ddt, type, class)) == 0) + return; + + dspace = doi.doi_physical_blocks_512 << 9; + mspace = doi.doi_fill_count * doi.doi_data_block_size; + + ddt_object_name(ddt, type, class, name); + + (void) printf("%s: %llu entries, size %llu on disk, %llu in core

", + name, + (u_longlong_t)count, + (u_longlong_t)(dspace / count), + (u_longlong_t)(mspace / count)); + + if (dump_opt['D'] < 3) + return; + + zpool_dump_ddt(NULL, &ddt->ddt_histogram[type][class]); + + if (dump_opt['D'] < 4) + return; + + if (dump_opt['D'] < 5 && class == DDT_CLASS_UNIQUE) + return; + + (void) printf("%s contents:



", name); + + while ((error = ddt_object_walk(ddt, type, class, &walk, &dde)) == 0) + dump_dde(ddt, &dde, walk); + + ASSERT(error == ENOENT); + + (void) printf("

"); +} + +static void +dump_all_ddts(spa_t *spa) +{ + ddt_histogram_t ddh_total = { 0 }; + ddt_stat_t dds_total = { 0 }; + + for (enum zio_checksum c = 0; c < ZIO_CHECKSUM_FUNCTIONS; c++) { + ddt_t *ddt = spa->spa_ddt[c]; + for (enum ddt_type type = 0; type < DDT_TYPES; type++) { + for (enum ddt_class class = 0; class < DDT_CLASSES; + class++) { + dump_ddt(ddt, type, class); + } + } + } + + ddt_get_dedup_stats(spa, &dds_total); + + if (dds_total.dds_blocks == 0) { + (void) printf("All DDTs are empty

"); + return; + } + + (void) printf("

"); + + if (dump_opt['D'] > 1) { + (void) printf("DDT histogram (aggregated over all DDTs):

"); + ddt_get_dedup_histogram(spa, &ddh_total); + zpool_dump_ddt(&dds_total, &ddh_total); + } + + dump_dedup_ratio(&dds_total); +} + +static void dump_dtl_seg(space_map_t *sm, uint64_t start, uint64_t size) { char *prefix = (void *)sm; @@ -568,7 +784,7 @@ dump_dtl(vdev_t *vd, int indent) char *name[DTL_TYPES] = { "missing", "partial", "scrub", "outage" }; char prefix[256]; - spa_vdev_state_enter(spa); + spa_vdev_state_enter(spa, SCL_NONE); required = vdev_dtl_required(vd); (void) spa_vdev_state_exit(spa, NULL, 0); @@ -598,6 +814,68 @@ dump_dtl(vdev_t *vd, int indent) dump_dtl(vd->vdev_child[c], indent + 4); } +static void +dump_history(spa_t *spa) +{ + nvlist_t **events = NULL; + char buf[SPA_MAXBLOCKSIZE]; + uint64_t resid, len, off = 0; + uint_t num = 0; + int error; + time_t tsec; + struct tm t; + char tbuf[30]; + char internalstr[MAXPATHLEN]; + + do { + len = sizeof (buf); + + if ((error = spa_history_get(spa, &off, &len, buf)) != 0) { + (void) fprintf(stderr, "Unable to read history: " + "error %d

", error); + return; + } + + if (zpool_history_unpack(buf, len, &resid, &events, &num) != 0) + break; + + off -= resid; + } while (len != 0); + + (void) printf("

History:

"); + for (int i = 0; i < num; i++) { + uint64_t time, txg, ievent; + char *cmd, *intstr; + + if (nvlist_lookup_uint64(events[i], ZPOOL_HIST_TIME, + &time) != 0) + continue; + if (nvlist_lookup_string(events[i], ZPOOL_HIST_CMD, + &cmd) != 0) { + if (nvlist_lookup_uint64(events[i], + ZPOOL_HIST_INT_EVENT, &ievent) != 0) + continue; + verify(nvlist_lookup_uint64(events[i], + ZPOOL_HIST_TXG, &txg) == 0); + verify(nvlist_lookup_string(events[i], + ZPOOL_HIST_INT_STR, &intstr) == 0); + if (ievent >= LOG_END) + continue; + + (void) snprintf(internalstr, + sizeof (internalstr), + "[internal %s txg:%lld] %s", + zfs_history_event_names[ievent], txg, + intstr); + cmd = internalstr; + } + tsec = time; + (void) localtime_r(&tsec, &t); + (void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t); + (void) printf("%s %s

", tbuf, cmd); + } +} + /*ARGSUSED*/ static void dump_dnode(objset_t *os, uint64_t object, void *data, size_t size) @@ -605,35 +883,48 @@ dump_dnode(objset_t *os, uint64_t object } static uint64_t -blkid2offset(const dnode_phys_t *dnp, int level, uint64_t blkid) +blkid2offset(const dnode_phys_t *dnp, const blkptr_t *bp, const zbookmark_t *zb) { - if (level < 0) - return (blkid); + if (dnp == NULL) { + ASSERT(zb->zb_level < 0); + if (zb->zb_object == 0) + return (zb->zb_blkid); + return (zb->zb_blkid * BP_GET_LSIZE(bp)); + } + + ASSERT(zb->zb_level >= 0); - return ((blkid << (level * (dnp->dn_indblkshift - SPA_BLKPTRSHIFT))) * + return ((zb->zb_blkid << + (zb->zb_level * (dnp->dn_indblkshift - SPA_BLKPTRSHIFT))) * dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT); } static void -sprintf_blkptr_compact(char *blkbuf, blkptr_t *bp, int alldvas) +sprintf_blkptr_compact(char *blkbuf, const blkptr_t *bp) { - dva_t *dva = bp->blk_dva; - int ndvas = alldvas ? BP_GET_NDVAS(bp) : 1; - int i; + const dva_t *dva = bp->blk_dva; + int ndvas = dump_opt['d'] > 5 ? BP_GET_NDVAS(bp) : 1; + + if (dump_opt['b'] >= 5) { + sprintf_blkptr(blkbuf, bp); + return; + } blkbuf[0] = '\0'; - for (i = 0; i < ndvas; i++) + for (int i = 0; i < ndvas; i++) (void) sprintf(blkbuf + strlen(blkbuf), "%llu:%llx:%llx ", (u_longlong_t)DVA_GET_VDEV(&dva[i]), (u_longlong_t)DVA_GET_OFFSET(&dva[i]), (u_longlong_t)DVA_GET_ASIZE(&dva[i])); - (void) sprintf(blkbuf + strlen(blkbuf), "%llxL/%llxP F=%llu B=%llu", + (void) sprintf(blkbuf + strlen(blkbuf), + "%llxL/%llxP F=%llu B=%llu/%llu", (u_longlong_t)BP_GET_LSIZE(bp), *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***