ZFS v.13 уже в 8-CURRENT

Обсуждение всяких разных новостей.
Гость
проходил мимо

ZFS v.13 уже в 8-CURRENT

Непрочитанное сообщение Гость » 2008-11-18 2:16:46

http://svn.freebsd.org/changeset/base/185029

Кто-нить разобрался как работает ZFSBoot?
Простое dd if=/boot/zfsboot of=/dev/ad0 убивает метку с метаданными пула, коя находится в первых 256Kb диска. Но даже если сие сделать, то все равно не грузится.

Кстати, pjd забыл обновить sys/cddl/boot:

Код: Выделить всё

--- sys/boot/zfs/zfsimpl.c.orig
+++ sys/boot/zfs/zfsimpl.c
@@ -656,8 +656,8 @@
 		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", (int) val, (int) SPA_VERSION);
 		return (EIO);
 	}
 
--- sys/cddl/boot/zfs/zfsimpl.h.orig
+++ sys/cddl/boot/zfs/zfsimpl.h
@@ -49,7 +49,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -448,41 +448,80 @@
 /*
  * 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
+#define	SPA_VERSION_12			12ULL
+#define	SPA_VERSION_13			13ULL
 /*
- * When bumping up ZFS_VERSION, make sure GRUB ZFS understand the on-disk
+ * When bumping up SPA_VERSION, make sure GRUB ZFS understands 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_13
+#define	SPA_VERSION_STRING		"13"
 
 /*
- * 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
+#define	SPA_VERSION_SLOGS		SPA_VERSION_7
+#define	SPA_VERSION_DELEGATED_PERMS	SPA_VERSION_8
+#define	SPA_VERSION_FUID		SPA_VERSION_9
+#define	SPA_VERSION_REFRESERVATION	SPA_VERSION_9
+#define	SPA_VERSION_REFQUOTA		SPA_VERSION_9
+#define	SPA_VERSION_UNIQUE_ACCURATE	SPA_VERSION_9
+#define	SPA_VERSION_L2CACHE		SPA_VERSION_10
+#define	SPA_VERSION_NEXT_CLONES		SPA_VERSION_11
+#define	SPA_VERSION_ORIGIN		SPA_VERSION_11
+#define	SPA_VERSION_DSL_SCRUB		SPA_VERSION_11
+#define	SPA_VERSION_SNAP_PROPS		SPA_VERSION_12
+#define	SPA_VERSION_USED_BREAKDOWN	SPA_VERSION_13
+
+/*
+ * ZPL version - rev'd whenever an incompatible on-disk format change
+ * occurs.  This is independent of SPA/DMU/ZAP versioning.  You must
+ * also update the version_table[] and help message in zfs_prop.c.
+ *
+ * When changing, be sure to teach GRUB how to read the new format!
+ * See usr/src/grub/grub-0.95/stage2/{zfs-include/,fsys_zfs*}
+ */
+#define	ZPL_VERSION_1			1ULL
+#define	ZPL_VERSION_2			2ULL
+#define	ZPL_VERSION_3			3ULL
+#define	ZPL_VERSION			ZPL_VERSION_3
+#define	ZPL_VERSION_STRING		"3"
+
+#define	ZPL_VERSION_INITIAL		ZPL_VERSION_1
+#define	ZPL_VERSION_DIRENT_TYPE		ZPL_VERSION_2
+#define	ZPL_VERSION_FUID		ZPL_VERSION_3
+#define	ZPL_VERSION_NORMALIZATION	ZPL_VERSION_3
+#define	ZPL_VERSION_SYSATTR		ZPL_VERSION_3
 
 /*
  * The following are configuration names used in the nvlist describing a pool's
@@ -509,7 +548,6 @@
 #define	ZPOOL_CONFIG_DTL		"DTL"
 #define	ZPOOL_CONFIG_STATS		"stats"
 #define	ZPOOL_CONFIG_WHOLE_DISK		"whole_disk"
-#define	ZPOOL_CONFIG_OFFLINE		"offline"
 #define	ZPOOL_CONFIG_ERRCOUNT		"error_count"
 #define	ZPOOL_CONFIG_NOT_PRESENT	"not_present"
 #define	ZPOOL_CONFIG_SPARES		"spares"
@@ -517,7 +555,22 @@
 #define	ZPOOL_CONFIG_NPARITY		"nparity"
 #define	ZPOOL_CONFIG_HOSTID		"hostid"
 #define	ZPOOL_CONFIG_HOSTNAME		"hostname"
-#define	ZPOOL_CONFIG_TIMESTAMP		"timestamp" /* not stored on disk */
+#define	ZPOOL_CONFIG_UNSPARE		"unspare"
+#define	ZPOOL_CONFIG_PHYS_PATH		"phys_path"
+#define	ZPOOL_CONFIG_IS_LOG		"is_log"
+#define	ZPOOL_CONFIG_L2CACHE		"l2cache"
+#define	ZPOOL_CONFIG_SUSPENDED		"suspended"	/* not stored on disk */
+#define	ZPOOL_CONFIG_TIMESTAMP		"timestamp"	/* not stored on disk */
+#define	ZPOOL_CONFIG_BOOTFS		"bootfs"	/* not stored on disk */
+/*
+ * The persistent vdev state is stored as separate values rather than a single
+ * 'vdev_state' entry.  This is because a device can be in multiple states, such
+ * as offline and degraded.
+ */
+#define	ZPOOL_CONFIG_OFFLINE		"offline"
+#define	ZPOOL_CONFIG_FAULTED		"faulted"
+#define	ZPOOL_CONFIG_DEGRADED		"degraded"
+#define	ZPOOL_CONFIG_REMOVED		"removed"
 
 #define	VDEV_TYPE_ROOT			"root"
 #define	VDEV_TYPE_MIRROR		"mirror"
@@ -527,6 +580,8 @@
 #define	VDEV_TYPE_FILE			"file"
 #define	VDEV_TYPE_MISSING		"missing"
 #define	VDEV_TYPE_SPARE			"spare"
+#define	VDEV_TYPE_LOG			"log"
+#define	VDEV_TYPE_L2CACHE		"l2cache"
 
 /*
  * This is needed in userland to report the minimum necessary device size.
@@ -537,11 +592,7 @@
  * The location of the pool configuration repository, shared between kernel and
  * userland.
  */
-#define	ZPOOL_CACHE_DIR		"/boot/zfs"
-#define	ZPOOL_CACHE_FILE	"zpool.cache"
-#define	ZPOOL_CACHE_TMP		".zpool.cache"
-
-#define	ZPOOL_CACHE		ZPOOL_CACHE_DIR "/" ZPOOL_CACHE_FILE
+#define	ZPOOL_CACHE		"/boot/zfs/zpool.cache"
 
 /*
  * vdev states are ordered from least to most healthy.
@@ -551,11 +602,15 @@
 	VDEV_STATE_UNKNOWN = 0,	/* Uninitialized vdev			*/
 	VDEV_STATE_CLOSED,	/* Not currently open			*/
 	VDEV_STATE_OFFLINE,	/* Not allowed to open			*/
+	VDEV_STATE_REMOVED,	/* Explicitly removed from system	*/
 	VDEV_STATE_CANT_OPEN,	/* Tried to open, but failed		*/
+	VDEV_STATE_FAULTED,	/* External request to fault device	*/
 	VDEV_STATE_DEGRADED,	/* Replicated vdev with unhealthy kids	*/
 	VDEV_STATE_HEALTHY	/* Presumed good			*/
 } vdev_state_t;
 
+#define	VDEV_STATE_ONLINE	VDEV_STATE_HEALTHY
+
 /*
  * vdev aux states.  When a vdev is in the CANT_OPEN state, the aux field
  * of the vdev stats structure uses these constants to distinguish why.
@@ -570,19 +625,24 @@
 	VDEV_AUX_BAD_LABEL,	/* the label is OK but invalid		*/
 	VDEV_AUX_VERSION_NEWER,	/* on-disk version is too new		*/
 	VDEV_AUX_VERSION_OLDER,	/* on-disk version is too old		*/
-	VDEV_AUX_SPARED		/* hot spare used in another pool	*/
+	VDEV_AUX_SPARED,	/* hot spare used in another pool	*/
+	VDEV_AUX_ERR_EXCEEDED,	/* too many errors			*/
+	VDEV_AUX_IO_FAILURE,	/* experienced I/O failure		*/
+	VDEV_AUX_BAD_LOG	/* cannot read log chain(s)		*/
 } vdev_aux_t;
 
 /*
  * pool state.  The following states are written to disk as part of the normal
- * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE.  The remaining states are
- * software abstractions used at various levels to communicate pool state.
+ * SPA lifecycle: ACTIVE, EXPORTED, DESTROYED, SPARE, L2CACHE.  The remaining
+ * states are software abstractions used at various levels to communicate
+ * pool state.
  */
 typedef enum pool_state {
 	POOL_STATE_ACTIVE = 0,		/* In active use		*/
 	POOL_STATE_EXPORTED,		/* Explicitly exported		*/
 	POOL_STATE_DESTROYED,		/* Explicitly destroyed		*/
 	POOL_STATE_SPARE,		/* Reserved for hot spare use	*/
+	POOL_STATE_L2CACHE,		/* Level 2 ARC device		*/
 	POOL_STATE_UNINITIALIZED,	/* Internal spa_t state		*/
 	POOL_STATE_UNAVAIL,		/* Internal libzfs state	*/
 	POOL_STATE_POTENTIALLY_ACTIVE	/* Internal libzfs state	*/
--- sys/cddl/boot/zfs/zfssubr.c.orig
+++ sys/cddl/boot/zfs/zfssubr.c
@@ -162,7 +162,7 @@
 
 	/* 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);
 	}
 
--- sys/cddl/boot/zfs/sha256.c.orig
+++ sys/cddl/boot/zfs/sha256.c
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * 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.
@@ -20,6 +19,6 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
@@ -28,19 +27,19 @@
 
 /*
- * SHA-256 checksum, as specified in FIPS 180-2, available at:
- * http://csrc.nist.gov/cryptval
+ * SHA-256 checksum, as specified in FIPS 180-3, available at:
+ * http://csrc.nist.gov/publications/PubsFIPS.html
  *
  * This is a very compact implementation of SHA-256.
  * It is designed to be simple and portable, not to be fast.
  */
 
 /*
- * The literal definitions according to FIPS180-2 would be:
+ * The literal definitions of Ch() and Maj() according to FIPS 180-3 are:
  *
- * 	Ch(x, y, z)     (((x) & (y)) ^ ((~(x)) & (z)))
- * 	Maj(x, y, z)    (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
+ * 	Ch(x, y, z)     (x & y) ^ (~x & z)
+ * 	Maj(x, y, z)    (x & y) ^ (x & z) ^ (y & z)
  *
- * We use logical equivalents which require one less op.
+ * We use equivalent logical reductions here that require one less op.
  */
 #define	Ch(x, y, z)	((z) ^ ((x) & ((y) ^ (z))))
 #define	Maj(x, y, z)	(((x) & (y)) ^ ((z) & ((x) ^ (y))))
@@ -101,20 +104,19 @@
 	uint32_t H[8] = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
 	    0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 };
 	uint8_t pad[128];
-	int padsize = size & 63;
-	int i;
+	int i, padsize;
 
-	for (i = 0; i < size - padsize; i += 64)
+	for (i = 0; i < (size & ~63ULL); i += 64)
 		SHA256Transform(H, (uint8_t *)buf + i);
 
-	for (i = 0; i < padsize; i++)
-		pad[i] = ((uint8_t *)buf)[i];
+	for (padsize = 0; i < size; i++)
+		pad[padsize++] = *((uint8_t *)buf + i);
 
 	for (pad[padsize++] = 0x80; (padsize & 63) != 56; padsize++)
 		pad[padsize] = 0;
 
-	for (i = 0; i < 8; i++)
-		pad[padsize++] = (size << 3) >> (56 - 8 * i);
+	for (i = 56; i >= 0; i -= 8)
+		pad[padsize++] = (size << 3) >> i;
 
 	for (i = 0; i < padsize; i += 64)
 		SHA256Transform(H, pad + i);
Патч на основе идеи от Norikatsu Shigemura.

Хостинговая компания Host-Food.ru
Хостинг HostFood.ru
 

Услуги хостинговой компании Host-Food.ru

Хостинг HostFood.ru

Тарифы на хостинг в России, от 12 рублей: https://www.host-food.ru/tariffs/hosting/
Тарифы на виртуальные сервера (VPS/VDS/KVM) в РФ, от 189 руб.: https://www.host-food.ru/tariffs/virtualny-server-vps/
Выделенные сервера, Россия, Москва, от 2000 рублей (HP Proliant G5, Intel Xeon E5430 (2.66GHz, Quad-Core, 12Mb), 8Gb RAM, 2x300Gb SAS HDD, P400i, 512Mb, BBU):
https://www.host-food.ru/tariffs/vydelennyi-server-ds/
Недорогие домены в популярных зонах: https://www.host-food.ru/domains/

Гость
проходил мимо

Re: ZFS v.13 уже в 8-CURRENT

Непрочитанное сообщение Гость » 2008-11-18 2:38:51

кстати, для тех кто делал

Код: Выделить всё

hg clone ssh://anon@hg.opensolaris.org/hg/onnv/onnv-gate onnv
можно взять чуток патчей из opensolaris'а

Код: Выделить всё

#! /bin/sh

PREFIX=~/dist/

for rev in 7844 7872 7897 7904 7980 \
           7994 8080 8084 8109 8129; {
    hg log -vpr$rev ${PREFIX}onnv |
    sed >zfs-$rev -E 's/curproc/curthread/g
      /\+\+\+|---/s?(a|b)([^/]*/){4}?cddl/contrib/opensolaris/\2?
      s|cddl/contrib/opensolaris/uts|sys/&|'
}
Наиболее интересный патч - 8080:4299ee7a727e, который ускоряет "zfs list" при первоначальном запуске:

Код: Выделить всё

changeset:   8080:4299ee7a727e
user:        Rich Morris <Richard.Morris@Sun.COM>
date:        Tue Nov 11 10:05:22 2008 -0500
files:       usr/src/cmd/zfs/zfs_main.c usr/src/uts/common/fs/zfs/arc.c usr/src/uts/common/fs/zfs/dmu_objset.c usr/src/uts/common/fs/zfs/sys/dmu_objset.h usr/src/uts/common/fs/zfs/zfs_ioctl.c
description:
6386929 initial "zfs list" is slow
6755389 Initial run of any zfs command that iterates over datasets can be slow
6758338 zfs list should list all explicitly requested snapshots


diff -r 5ecb87815e82 -r 4299ee7a727e usr/src/cmd/zfs/zfs_main.c
--- cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	Tue Nov 11 10:53:41 2008 +0100
+++ cddl/contrib/opensolaris/cmd/zfs/zfs_main.c	Tue Nov 11 10:05:22 2008 -0500
@@ -1754,7 +1754,7 @@ zfs_do_list(int argc, char **argv)
 	boolean_t scripted = B_FALSE;
 	static char default_fields[] =
 	    "name,used,available,referenced,mountpoint";
-	int types = ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME;
+	int types = ZFS_TYPE_DATASET;
 	boolean_t types_specified = B_FALSE;
 	char *fields = NULL;
 	list_cbdata_t cb = { 0 };
diff -r 5ecb87815e82 -r 4299ee7a727e usr/src/uts/common/fs/zfs/arc.c
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Tue Nov 11 10:53:41 2008 +0100
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Tue Nov 11 10:05:22 2008 -0500
@@ -2425,7 +2425,8 @@ arc_read_done(zio_t *zio)
  *
  * Normal callers should use arc_read and pass the arc buffer and offset
  * for the bp.  But if you know you don't need locking, you can use
- * arc_read_bp.
+ * arc_read_nolock.  Callers cannot use a "done" function in a prefetch
+ * call (i.e., with ARC_NOWAIT set).
  */
 int
 arc_read(zio_t *pio, spa_t *spa, blkptr_t *bp, arc_buf_t *pbuf,
diff -r 5ecb87815e82 -r 4299ee7a727e usr/src/uts/common/fs/zfs/dmu_objset.c
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c	Tue Nov 11 10:53:41 2008 +0100
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c	Tue Nov 11 10:05:22 2008 -0500
@@ -1213,6 +1213,38 @@ dmu_objset_find_spa(spa_t *spa, const ch
 	return (err);
 }
 
+/* ARGSUSED */
+int
+dmu_objset_prefetch(char *name, void *arg)
+{
+	objset_t *os;
+	dsl_dataset_t *ds;
+
+	os = kmem_alloc(sizeof (objset_t), KM_SLEEP);
+	if (dsl_dataset_hold(name, os, &ds)) {
+		kmem_free(os, sizeof (objset_t));
+		return (0);
+	}
+
+	if (!BP_IS_HOLE(&ds->ds_phys->ds_bp)) {
+		uint32_t aflags = ARC_NOWAIT | ARC_PREFETCH;
+		zbookmark_t zb;
+
+		zb.zb_objset = ds->ds_object;
+		zb.zb_object = 0;
+		zb.zb_level = -1;
+		zb.zb_blkid = 0;
+
+		(void) arc_read_nolock(NULL, dsl_dataset_get_spa(ds),
+		    &ds->ds_phys->ds_bp, NULL, NULL, ZIO_PRIORITY_ASYNC_READ,
+		    ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE, &aflags, &zb);
+	}
+
+	dsl_dataset_rele(ds, os);
+	kmem_free(os, sizeof (objset_t));
+	return (0);
+}
+
 void
 dmu_objset_set_user(objset_t *os, void *user_ptr)
 {
diff -r 5ecb87815e82 -r 4299ee7a727e usr/src/uts/common/fs/zfs/sys/dmu_objset.h
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h	Tue Nov 11 10:53:41 2008 +0100
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h	Tue Nov 11 10:05:22 2008 -0500
@@ -25,8 +25,6 @@
 
 #ifndef	_SYS_DMU_OBJSET_H
 #define	_SYS_DMU_OBJSET_H
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 #include <sys/spa.h>
 #include <sys/arc.h>
@@ -118,6 +116,7 @@ int dmu_objset_find(char *name, int func
     int flags);
 int dmu_objset_find_spa(spa_t *spa, const char *name,
     int func(spa_t *, uint64_t, const char *, void *), void *arg, int flags);
+int dmu_objset_prefetch(char *name, void *arg);
 void dmu_objset_byteswap(void *buf, size_t size);
 int dmu_objset_evict_dbufs(objset_t *os);
 
diff -r 5ecb87815e82 -r 4299ee7a727e usr/src/uts/common/fs/zfs/zfs_ioctl.c
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Tue Nov 11 10:53:41 2008 +0100
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c	Tue Nov 11 10:05:22 2008 -0500
@@ -1290,6 +1290,28 @@ zfs_ioc_objset_zplprops(zfs_cmd_t *zc)
 	return (err);
 }
 
+static void
+zfs_prefetch_datasets(zfs_cmd_t *zc, objset_t *os, char *p)
+{
+	uint64_t cookie = 0;
+	int error;
+
+	do {
+		error = dmu_dir_list_next(os,
+		    sizeof (zc->zc_name) - (p - zc->zc_name), p,
+		    NULL, &cookie);
+	} while (error == 0 && !INGLOBALZONE(curthread) &&
+	    !zone_dataset_visible(zc->zc_name, NULL) &&
+	    !dmu_objset_prefetch(zc->zc_name, NULL));
+}
+
+static void
+zfs_prefetch_snapshots(zfs_cmd_t *zc)
+{
+	dmu_objset_find(zc->zc_name, dmu_objset_prefetch,
+	    NULL, DS_FIND_SNAPSHOTS);
+}
+
 /*
  * inputs:
  * zc_name		name of filesystem
@@ -1321,6 +1343,8 @@ zfs_ioc_dataset_list_next(zfs_cmd_t *zc)
 		(void) strlcat(zc->zc_name, "/", sizeof (zc->zc_name));
 	p = zc->zc_name + strlen(zc->zc_name);
 
+	if (zc->zc_cookie == 0)
+		zfs_prefetch_datasets(zc, os, p);
 	do {
 		error = dmu_dir_list_next(os,
 		    sizeof (zc->zc_name) - (p - zc->zc_name), p,
@@ -1364,6 +1388,8 @@ zfs_ioc_snapshot_list_next(zfs_cmd_t *zc
 	if (error)
 		return (error == ENOENT ? ESRCH : error);
 
+	if (zc->zc_cookie == 0)
+		zfs_prefetch_snapshots(zc);
 	/*
 	 * A dataset name of maximum length cannot have any snapshots,
 	 * so exit immediately.


Аватара пользователя
zingel
beastie
Сообщения: 6204
Зарегистрирован: 2007-10-30 3:56:49
Откуда: Moscow
Контактная информация:

Re: ZFS v.13 уже в 8-CURRENT

Непрочитанное сообщение zingel » 2008-11-18 9:22:16

отпиши ему.
Z301171463546 - можно пожертвовать мне денег

Гость
проходил мимо

Re: ZFS v.13 уже в 8-CURRENT

Непрочитанное сообщение Гость » 2008-11-18 11:06:15

там в этом большом коммите частичный bacokut r184413

Код: Выделить всё

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
===================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c	(revision 185028)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c	(revision 185029)
@@ -237,14 +253,14 @@
 zfsctl_common_access(ap)
 	struct vop_access_args /* {
 		struct vnode *a_vp;
-		accmode_t a_accmode;
+		int  a_accmode;
 		struct ucred *a_cred;
 		struct thread *a_td;
 	} */ *ap;
 {
-	accmode_t accmode = ap->a_accmode;
+	int mode = ap->a_accmode;
 
-	if (accmode & VWRITE)
+	if (mode & VWRITE)
 		return (EACCES);
 
 	return (0);

Код: Выделить всё

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
===================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c	(revision 184412)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c	(revision 184413)
@@ -237,14 +237,14 @@
 zfsctl_common_access(ap)
 	struct vop_access_args /* {
 		struct vnode *a_vp;
-		int  a_mode;
+		accmode_t a_accmode;
 		struct ucred *a_cred;
 		struct thread *a_td;
 	} */ *ap;
 {
-	int mode = ap->a_mode;
+	accmode_t accmode = ap->a_accmode;
 
-	if (mode & VWRITE)
+	if (accmode & VWRITE)
 		return (EACCES);
 
 	return (0);
кстати, у кого-нить на amd64 работает ztest(1) и zdb(8)? У мя они валятся на strlen, а на i386 на разных assert'ах.
И fstat(1) у кого-нить показывает номера inode'ов в столбце INUM?

Гость
проходил мимо

Re: ZFS v.13 уже в 8-CURRENT

Непрочитанное сообщение Гость » 2008-11-20 2:12:56

Хех, получилось загрузиться, но почему-то bootfs работает через пятую точку. Грузиться с q/boot loader не захотел.

На тестовой тачке было сделано gpart bootcode -p /boot/gptzfsboot -i1 ad0:

Код: Выделить всё

(~). gpart show
=>      34  20971453  ad0  GPT  (10G)
        34       128    1  freebsd-boot  (64K)
       162   1048576    2  freebsd-ufs  (512M)
   1048738  19922749    3  freebsd-zfs  (9.5G)
(~). zpool get all q
NAME  PROPERTY       VALUE       SOURCE
q     size           9.44G       -
q     used           7.27G       -
q     available      2.17G       -
q     capacity       77%         -
q     altroot        -           default
q     health         ONLINE      -
q     guid           996696748835267127  -
q     version        14          default
q     bootfs         q           local
q     delegation     on          default
q     autoreplace    off         default
q     cachefile      -           default
q     failmode       wait        default
q     listsnapshots  off         default
Ну и собственно сам процесс сопровождался Invalid format, но оно на serial console не передалось:

Код: Выделить всё

(~). qemu-system-x86_64 -m 512 -net nic,model=rtl8139 -net tap,ifname=tap0 -nographic -echr 0x03 scrap/freebsd-amd64.img
/ig: -h|Consoles: serial port
BIOS drive C: is disk0
BIOS 639kB/523200kB available memory

FreeBSD/i386 bootstrap loader, Revision 1.1
(luser@qemu, Thu Nov 20 00:47:02 MSK 2008)
Loading /boot/defaults/loader.conf
/boot/kernel/kernel text=0x4a64fa data=0x6c478+0x69e38 syms=[0x8+0x8a120+0x8+0x8064e]
/boot/kernel/zfs.ko size 0x4e3418 at 0x887000
loading required module 'opensolaris'
/boot/kernel/opensolaris.ko size 0x6748 at 0xd6b000
-
Hit [Enter] to boot immediately, or any other key for command prompt.


Type '?' for a list of commands, 'help' for more detailed help.
OK lsdev
cd devices:
disk devices:
    disk0:   BIOS drive C:
      disk0p1: FreeBSD boot
      disk0p2: FreeBSD UFS
      disk0p3: FreeBSD ZFS
pxe devices:
zfs devices:
    zfs0:   q
OK boot
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2008 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 8.0-CURRENT #0 r185088M: Wed Nov 19 13:43:09 MSK 2008
    luser@qemu:/usr/obj/usr/src/sys/QEMU64
QEMU: Terminated
ps, я слегка изменил свой zboot.diff, ибо он конфликтует r185097 и у меня 14-ая версия, а не 13-ая.
Вложения
zboot.diff
(9.67 КБ) 36 скачиваний

Гость
проходил мимо

Re: ZFS v.13 уже в 8-CURRENT

Непрочитанное сообщение Гость » 2008-11-20 8:19:00

Гость писал(а):

Код: Выделить всё

zfs devices:
    zfs0:   q
упс, забыл показать грузится именно с zfs, а не с ufs:

Код: Выделить всё

OK show currdev
zfs0
OK ls
/
 d  old_boot
 d  bin
 l  home
    boot.config
 d  dev
 d  etc
 d  lib
 d  libexec
 d  media
 d  mnt
 d  proc
 d  rescue
 l  sys
 d  sbin
 d  root
 d  tmp
 d  usr
 d  var
    entropy
 d  d
 d  boot
OK set currdev=disk0p2
OK ls
/
 d  .snap
 d  boot
    boot.config
Сейчас у мя давно swap на месте disk0p2 для kernel dump'ов.

ps, теперь не надо постоянно синхронизировать /boot и беспокоится, что тот же самый /boot не выжевет hard reset.

Аватара пользователя
Alex Keda
стреляли...
Сообщения: 35437
Зарегистрирован: 2004-10-18 14:25:19
Откуда: Made in USSR
Контактная информация:

Re: ZFS v.13 уже в 8-CURRENT

Непрочитанное сообщение Alex Keda » 2008-11-20 11:17:21

а у когонить в продакшен он есть - или у всех тока "поиграться" ?
Убей их всех! Бог потом рассортирует...


Аватара пользователя
LMik
капитан
Сообщения: 1852
Зарегистрирован: 2007-07-17 9:14:39
Откуда: МО
Контактная информация:

Re: ZFS v.13 уже в 8-CURRENT

Непрочитанное сообщение LMik » 2008-11-23 3:54:15

Все это конечно хорошо, но пока ядро не научат выделять памяти больше чем 2 гига под ZFS....
BSD... Join the dark side.
Виpус детям не игpушка, не товаpищ и не дpуг!

Гость
проходил мимо

Re: ZFS v.13 уже в 8-CURRENT

Непрочитанное сообщение Гость » 2008-11-23 6:06:34

LMik писал(а):пока ядро не научат выделять памяти больше чем 2 гига под ZFS....
Jeremy Chadwick писал(а):
  • Panic occurs when vm.kmem_size or vm.kmem_size_max set to values larger than 1536M
    • Kernel will panic with a message that looks very similar to either of the following:
      • panic: kmem_malloc(4096): kmem_map too small: 1073741824 total allocated
        kmem_suballoc(): bad status return of 3
    • Limit is caused by a 2GB limit for kmem
    • Affects i386 and amd64, regardless of how much physical memory is installed
    • Greatly impacts ZFS stability
    • Reference: http://lists.freebsd.org/pipermail/free ... 42764.html
    • Reference: http://lists.freebsd.org/pipermail/free ... 24708.html
    • Fix: Committed to CURRENT (8.0); expands limitation to 512GB. MFC of fix is very unlikely


Гость
проходил мимо

Re: ZFS v.13 уже в 8-CURRENT

Непрочитанное сообщение Гость » 2008-11-23 6:59:36

в 8-current этой проблемы нет. Если для production 8-current рискованно ставить, то для desktop'а самое то.

kmem_map too small - очень давно не встречал, кажется сразу после как установил в июле patchset от pjd@, к-ый недавно был за'committ'ен.