Commit Graph

126 Commits

Author SHA1 Message Date
Martin Matuska
2d9cf57e18 Introduce "feature flags" for ZFS pools (bump SPA version to 5000).
Add first feature "com.delphix:async_destroy" (asynchronous destroy
of ZFS datasets).
Implement features support in ZFS boot code.

Illumos revisions merged:
13700:2889e2596bd6
13701:1949b688d5fb
2619 asynchronous destruction of ZFS file systems
2747 SPA versioning with zfs feature flags

References:
https://www.illumos.org/issues/2619
https://www.illumos.org/issues/2747

Obtained from:	illumos (issue #2619, #2747)
MFC after:	1 month
2012-06-11 11:35:22 +00:00
Martin Matuska
923bc36411 Import Illumos revision 13715:351036203e4b
2803 zfs get guid pretty-prints the output

References:
https://www.illumos.org/issues/2803

Obtained from:	illumos (issue #2803)
MFC after:	3 days
2012-06-07 08:32:53 +00:00
Martin Matuska
2182d44714 Import illumos changeset 13570:3411fd5f1589
1948 zpool list should show more detailed pool information

Display per-vdev information with "zpool list -v".
The added expandsize property has currently no value on FreeBSD.
This changeset allows adding expansion support to individual vdevs
in the future.

References:
https://www.illumos.org/issues/1948

Obtained from:	illumos (issue #1948)
MFC after:	2 weeks
2012-05-27 16:00:00 +00:00
Andriy Gapon
5e1ba35cea zpool_find_import_impl: another /dev/dsk -> /dev fix
This seems to fix zdb -e behavior.

PR:		bin/155104
Submitted by:	swell.k@gmail.com
MFC after:	2 weeks
2012-05-15 17:11:00 +00:00
Martin Matuska
a837775a9e Import illumos changeset 13686:4bc0783f6064
2703 add mechanism to report ZFS send progress

If the zfs send command is used with the -v flag, the amount of bytes
transmitted is reported in per second updates.

References:
https://www.illumos.org/issues/2703

Obtained from:	illumos (issue #2703)
MFC after:	2 weeks
2012-05-10 10:39:45 +00:00
Martin Matuska
7538677f35 Add support for force unmounting ZFS filesystems during "zfs rename"
with the -f flag.

Reimplementation of the illumos changeset 13677:a0cbef703c12
2635 'zfs rename -f' to perform force unmount

References:
https://www.illumos.org/issues/2635

PR:		kern/164447
Suggested by:	Marcelo Araujo <araujo@FreeBSD.org>
Obtained from:	illumos (issue #2635)
MFC after:	1 week
2012-05-10 08:57:58 +00:00
Ryan Stone
c6024848dd Implement the D "cpu" variable, which returns curcpu. I have chosen not
to follow the example of OpenSolaris and its descendants, which implemented
cpu as an inline that took a value out of curthread.  At certain points in
the FreeBSD scheduler curthread->td_oncpu will no longer be valid (in
particukar, just before the thread gets descheduled) so instead I have
implemented this as its own built-in variable.

Sponsored by:	Sandvine Inc.
MFC after:	1 week
2012-04-26 01:07:03 +00:00
George V. Neville-Neil
72cc304aba Change SIGUSR1 to SIGTHR to properly wake up a process that is being
traced.  The use of SIGUSR1 caused traced processes (those attached to
with dtrace -p) to exit when dtrace exited.

MFC in: 1 week
2012-04-13 20:22:08 +00:00
Oleksandr Tymoshenko
51df478cba Add stub file for pid probe. It's required although pid probe is not supported
on MIPS yet
2012-03-24 05:27:39 +00:00
Kip Macy
7dc322fa14 add KM_NODEBUG needed by ARC buffer core dump exclusion change 2012-01-27 22:24:03 +00:00
Martin Matuska
538251bbf6 Merge illumos revisions 13572, 13573, 13574:
Rev. 13572:
disk sync write perf regression when slog is used post oi_148 [1]

Rev. 13573:
crash during reguid causes stale config [2]
allow and unallow missing from zpool history since removal of pyzfs [5]

Rev. 13574:
leaking a vdev when removing an l2cache device [3]
memory leak when adding a file-based l2arc device [4]
leak in ZFS from metaslab_group_create and zfs_ereport_checksum [6]

References:
https://www.illumos.org/issues/1909 [1]
https://www.illumos.org/issues/1949 [2]
https://www.illumos.org/issues/1951 [3]
https://www.illumos.org/issues/1952 [4]
https://www.illumos.org/issues/1953 [5]
https://www.illumos.org/issues/1954 [6]

Obtained from:	illumos (issues #1909, #1949, #1951, #1952, #1953, #1954)
MFC after:	2 weeks
2012-01-24 23:09:54 +00:00
Pawel Jakub Dawidek
1698a6aec9 Dramatically optimize listing snapshots when user requests only snapshot
names and wants to sort them by name, ie. when executes:

	# zfs list -t snapshot -o name -s name

Because only name is needed we don't have to read all snapshot properties.

Below you can find how long does it take to list 34509 snapshots from a single
disk pool before and after this change with cold and warm cache:

before:

	# time zfs list -t snapshot -o name -s name > /dev/null
	cold cache: 525s
	warm cache: 218s

after:

	# time zfs list -t snapshot -o name -s name > /dev/null
	cold cache: 1.7s
	warm cache: 1.1s

MFC after:	1 week
2012-01-21 21:12:53 +00:00
Martin Matuska
08acd455f3 Add one more copyright line accidentially removed in r228103
MFC after:	3 days
2012-01-20 22:56:57 +00:00
Martin Matuska
f622fcd083 Add accidentially removed copyright lines in r228103
Reported by:	pjd
MFC after:	3 days
2012-01-20 22:55:16 +00:00
Dimitry Andric
edf500a77a In cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c, some
uint64_t values are snprintf'd using %llx.  On amd64, uint64_t is
typedef'd as unsigned long, so cast the values to u_longlong_t, as is
done similarly in the rest of the file.

MFC after:	1 week
2011-12-16 15:12:42 +00:00
Dimitry Andric
8ac4e8ebc3 In cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c, some
uint64_t values are snprintf'd using %llx.  On amd64, uint64_t is
typedef'd as unsigned long, so cast the values to u_longlong_t, as is
done similarly in the rest of the file.

MFC after:	1 week
2011-12-16 15:04:47 +00:00
Dimitry Andric
6d9bf0940c In cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c, the
dt_popc() function assumes that either _ILP32 or _LP64 is defined,
otherwise it has no suitable implementation.

However, the _ILP32 and _LP64 macros come from isa_defs.h, which is not
included in this file.  Add the include now, to get the macros defined.

MFC after:	1 week
2011-12-15 23:06:46 +00:00
Dimitry Andric
8b6b79ce0a In cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c, use the
correct printf format for a key_t (aka long).

MFC after:	1 week
2011-12-15 22:46:04 +00:00
Dimitry Andric
bb15ca603f In cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c, use the
correct printf format for an unsigned long.

MFC after:	1 week
2011-12-15 22:37:33 +00:00
Dimitry Andric
a2f16036af Cast away a clang alignment warning in drti.c's fixsymbol() function.
This code only runs on i386 and amd64, so there should be no problems if
buf + sec->dofs_offset is not aligned (which is unlikely anyway).

MFC after:	1 week
2011-12-15 22:10:27 +00:00
Martin Matuska
2f7f0f4112 Merge new ZFS features from illumos:
1644 add ZFS "clones" property
https://www.illumos.org/issues/1644

1645 add ZFS "written" and "written@..." properties
https://www.illumos.org/issues/1645

1646 "zfs send" should estimate size of stream
https://www.illumos.org/issues/1646

1647 "zfs destroy" should determine space reclaimed by destroying multiple
snapshots
https://www.illumos.org/issues/1647

1693 persistent 'comment' field for a zpool
https://www.illumos.org/issues/1693

1708 adjust size of zpool history data
https://www.illumos.org/issues/1708

1748 desire support for reguid in zfs
https://www.illumos.org/issues/1748

Obtained from:	illumos (changesets 13514, 13524, 13525)
MFC after:	1 month
2011-11-28 21:40:00 +00:00
Pawel Jakub Dawidek
8411337f94 Update copyright to include myself.
MFC after:	2 weeks
2011-10-24 21:22:55 +00:00
Pawel Jakub Dawidek
3ebce5e218 Extend r226676 to allow rename without unmount even for file systems with
non-legacy mountpoints. It is better to be able to rename such file systems and
let them be mounted in old places until next reboot than using live CD, etc. to
rename with remount.

This is implemented by adding -u option to 'zfs rename'. If file system's
mountpoint property is set to 'legacy' or 'none', there is no need to specify -u.

Update zfs(8) manual page to reflect this addition.

MFC after:	2 weeks
2011-10-24 21:14:50 +00:00
Pawel Jakub Dawidek
497b7ef946 Allow to rename file systems without remounting if it is possible.
It is possible for file systems with 'mountpoint' preperty set to 'legacy'
or 'none' - we don't have to change mount directory for them.
Currently such file systems are unmounted on rename and not even mounted back.

This introduces layering violation, as we need to update 'f_mntfromname'
field in statfs structure related to mountpoint (for the dataset we are
renaming and all its children).

In my opinion it is worth it, as it allow to update FreeBSD in even cleaner
way - in ZFS-only configuration root file system is ZFS file system with
'mountpoint' property set to 'legacy'. If root dataset is named system/rootfs,
we can snapshot it (system/rootfs@upgrade), clone it (system/oldrootfs),
update FreeBSD and if it doesn't boot we can boot back from system/oldrootfs
and rename it back to system/rootfs while it is mounted as /. Before it was
not possible, because unmounting / was not possible.

MFC after:	2 weeks
2011-10-24 00:38:09 +00:00
Pawel Jakub Dawidek
7c833ba2d6 libzpool task_alloc: pass only valid flags to kmem_alloc
tqflags may contain other flags besided those that are suitable for
kmem_alloc == umem_alloc

Submitted by:	avg
MFC after:	3 days
2011-10-21 13:53:06 +00:00
Martin Matuska
91109eb1c8 Remove assertion that prevents zfs rename of datasets with mountpoint=none
or mountpoint=legacy that have children datasets. This also fixes dataset
rename when receiving incremental snapshots as reported on freebsd-fs@

This assertion was made triggerable by opensolaris change #10196.

PR:		bin/160400
Reviewed by:	pjd
MFC after:	1 week
2011-09-28 11:57:10 +00:00
Martin Matuska
3036062f0c Fix wrong initialization of "cmd" for calling the jail/unjail ioctl.
Reviewed by:	pjd@, delphij@
Approved by:	re (kib)
MFC after:	3 days
2011-07-30 17:44:06 +00:00
Justin T. Gibbs
e96cf39826 cddl/contrib/opensolaris/cmd/zpool/zpool_main.c:
cddl/contrib/opensolaris/cmd/zpool/zpool.8:
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c:
	Add the "zpool labelclear" command.  This command can be
	used to wipe the label data from a drive that is not
	active in a pool.  The optional "-f" argument can be
	used to treat an exported or foreign vdev as "inactive"
	thus allowing its label information to be cleared.
2011-07-18 03:18:06 +00:00
Justin T. Gibbs
d7a00114ea Correct reporting of missing leaf vdevs so that the GUID required to
perform pool actions is always displayed.

cddl/contrib/opensolaris/cmd/zpool/zpool_main.c:
	The "zpool status" command reports the "last seen at"
	device node path when the vdev name is being reported
	by GUID.  Augment this code to assume a GUID is reported
	when a device goes missing after initial boot in addition
	to the previous behavior of doing this for devices that
	aren't seen at boot.

cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c:
	In zpool_vdev_name(), report recently missing devices
	by GUID.  There is no guarantee they will return at
	their previous location.
2011-07-18 03:00:59 +00:00
Justin T. Gibbs
6c1942802d cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h:
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c:
	o Add zpool_pool_state_to_name() API to libzfs which converts a
	  pool_state_t into a user consumable string.
	o While here, correct constness of make zpool_state_to_name()
	  and zpool_label_disk().

MFD after: 1 week
2011-07-18 02:13:21 +00:00
Martin Matuska
fbfed0cda6 Add a new "REFCOMPRESSRATIO" property.
For snapshots, this is the same as COMPRESSRATIO, but for
filesystems/volumes, the COMPRESSRATIO is based on the data "USED" (ie,
includes blocks in children, but not blocks shared with the origin).

This is needed to figure out how much space a filesystem would use if it
were not compressed (ignoring snapshots).

Illumos-gate revision:	13387

Obtained from:	Illumos (Feature #1092)
MFC after:	2 weeks
2011-06-28 07:52:01 +00:00
Simon L. B. Nielsen
86f222bbfe Do not use #warning to warn about missing implementation of dt_popc(),
but just have a comment that this is broken.

This is just a bandaid until somebody can fix this correctly.  The code
is just a broken as it was before r223262 - now buildworld just doesn't
fail.

Tested by:	i386 + amd64 buildworld
With hat:	benl co-mentor
2011-06-19 12:52:50 +00:00
Ben Laurie
5f301949ef Fix clang warnings.
Approved by:	philip (mentor)
2011-06-18 13:56:33 +00:00
Pawel Jakub Dawidek
73aab6768c Fix 'zfs list <path>' handling. If the path was found, the 'ret' variable was
uninitialized.

PR:		kern/155940
Submitted by:	KOIE Hidetaka <koie@suri.co.jp>
MFC after:	1 week
2011-04-12 20:31:33 +00:00
Pawel Jakub Dawidek
939f98dd4d Properly print characters larger than 127.
Submitted by:	noordsij <noordsij@cs.helsinki.fi>
Reviewed by:	Eric Schrock <eric.schrock@delphix.com>
MFC after:	1 month
2011-03-24 14:12:41 +00:00
Pawel Jakub Dawidek
10b9d77bf1 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
2011-02-27 19:41:40 +00:00
Matthew D Fleming
e704482d43 Re-commit the zfs sysctl(9) type-safety changes.
Thanks to dim and pjd for the pointer to zfs_context.h for building
userland.
2011-01-13 18:20:19 +00:00
Martin Matuska
055731ce60 Print message with information about updating the boot code if a new
vdev is attached to a root pool (e.g. when creating a mirrored boot pool).

Reviewed by:	pav
Approved by:	delphij (mentor)
MFC after:	3 days
2010-12-08 13:51:25 +00:00
Martin Matuska
60a7e0c3cb Do not print OpenSolaris hint to use (non-existing) installgrub(1) command
if creating a mirror by attaching a new vdev to a root pool.

Reported by:	James R. Van Artsdalen (on freebsd-fs@freebsd.org)
Approved by:	delphij (mentor)
MFC after:	3 days
2010-12-08 08:57:37 +00:00
Pawel Jakub Dawidek
1cc1967893 1. Remove invalid assertion.
2. Properly recalculate delta in case pthread_cond_timedwait() is interrupted.
3. Style fix.

Reported by:	[1] App Deb <appdebgr@gmail.com>
2010-11-01 10:41:05 +00:00
Martin Matuska
96a1a6a568 Enable offlining of log devices.
OpenSolaris revision and Bug IDs:

9701:cc5b64682e64
6803605	should be able to offline log devices
6726045	vdev_deflate_ratio is not set when offlining a log device
6599442	zpool import has faults in the display

Approved by:	delphij (mentor)
Obtained from:	OpenSolaris (Bug ID 6803605, 6726045, 6599442)
MFC after:	3 weeks
2010-09-27 09:05:51 +00:00
Martin Matuska
5ab44ccaf2 Remove duplicate include of <strings.h>
Approved by:	delphij (mentor)
MFC after:	3 days
2010-09-17 14:15:03 +00:00
Rui Paulo
7879263397 Give a chance to the target binary to run the ctors by waiting until it
has reached main(). This allows plockstat to work.

Sponsored by:	The FreeBSD Foundation
2010-09-12 15:59:14 +00:00
Rui Paulo
dba0ac63fb Disable debug by default.
Sponsored by:	The FreeBSD Foundation
2010-09-11 10:16:15 +00:00
Rui Paulo
acac60bbfe Don't try to map the USDT probes. This is necessary because there is no
__SUNW_dof symbol present in FreeBSD binaries.

Sponsored by:	The FreeBSD Foundation
2010-09-10 12:16:24 +00:00
Rui Paulo
37c380fbb5 Don't clobber an existing target object file when doing the DTrace
linking process. This is needed because we change the source object
files and the second this dtrace -G is run, no probes will be found.
This hack allows us to build postgres with DTrace probes enabled. I'll
try to find a way to fix this without needing this hack.

Sponsored by:	The FreeBSD Foundation
2010-09-09 11:10:15 +00:00
Rui Paulo
8f7264f0e3 Include <sys/sdt.h> on a generated header.
Sponsored by:	The FreeBSD Foundation
2010-09-01 11:27:09 +00:00
Pawel Jakub Dawidek
4f1f4356f3 Fix 'zfs allow' (maybe not only) returning:
cannot access dataset system/usr/home: Operation not supported

by including libzfs_impl.h. What libzfs_impl.h does is to redefine ioctl() to
be compatible with OpenSolaris. More specifically OpenSolaris returns ENOMEM
when buffer is too small and sets field zc_nvlist_dst_size to the size that
will be big enough for the data. In FreeBSD case ioctl() doesn't copy data
structure back in case of a failure. We work-around it in kernel and libzfs by
returning 0 from ioctl() and always checking if zc_nvlist_dst_size hasn't
changed. For this work-around to work in pyzfs we need this compatible ioctl()
which is implemented in libzfs_impl.h.

MFC after:	2 weeks
2010-08-29 20:18:06 +00:00
Rui Paulo
0f2bd1e89d Add libdtrace support for tracing userland programs.
Summary of changes:
* Implement a compatibility shim between Solaris libproc and our
libproc and remove several ifdefs because of this.
* Port the drti to FreeBSD.
* Implement the missing DOODAD sections
* Link with libproc and librtld_db
* Support for ustack, jstack and uregs (by sson@)
* Misc bugfixing

When writing the SUWN_dof section, we had to resort to building the ELF
file layout by "hand". This is the job of libelf, but our libelf doesn't
support this yet. When libelf is fixed, we can remove the code under
#ifdef BROKEN_LIBELF.

Sponsored by:	The FreeBSD Foundation
2010-08-21 11:50:53 +00:00
Rui Paulo
afba0b6e9e Fix another mismerge: bring back the definition of DT_MUTEX_HELD(). 2010-08-02 17:31:48 +00:00