]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/log
FreeBSD/stable/10.git
8 years agoMFC r287534: Add two new portal group options "tag" and "foreign".
mav [Mon, 5 Oct 2015 08:54:02 +0000 (08:54 +0000)]
MFC r287534: Add two new portal group options "tag" and "foreign".

They are going to be useful in clustered setups.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288729 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287500: Allow LUN options modification via CTL_LUNREQ_MODIFY.
mav [Mon, 5 Oct 2015 08:52:37 +0000 (08:52 +0000)]
MFC r287500: Allow LUN options modification via CTL_LUNREQ_MODIFY.

Not all changes take effect, but that is a different question.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288728 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287499: Move setting of media parameters inside open routines.
mav [Mon, 5 Oct 2015 08:51:20 +0000 (08:51 +0000)]
MFC r287499: Move setting of media parameters inside open routines.

This is preparation for possibility to open/close media several times
per LUN life cycle.  While there, rename variables to reduce confusion.
As additional bonus this allows to open read-only media, such as ZFS
snapshots.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288727 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287455, r287458, r287459: Remove some dead code.
mav [Mon, 5 Oct 2015 08:50:15 +0000 (08:50 +0000)]
MFC r287455, r287458, r287459: Remove some dead code.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288726 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287433: Small UA cleanup.
mav [Mon, 5 Oct 2015 08:48:47 +0000 (08:48 +0000)]
MFC r287433: Small UA cleanup.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288725 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287372:
mav [Mon, 5 Oct 2015 08:47:45 +0000 (08:47 +0000)]
MFC r287372:
Make most of port methods optional and remove bunch of dummies.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288724 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287293: Remove 600 bytes of port_priv from struct ctl_io_hdr.
mav [Mon, 5 Oct 2015 08:46:48 +0000 (08:46 +0000)]
MFC r287293: Remove 600 bytes of port_priv from struct ctl_io_hdr.

This field used only for camtgt frontend, and once it any way preallocates
all requests, let it preallocate this memory too, not bothering core code.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288723 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287221: Fix type bug introduced at r286811.
mav [Mon, 5 Oct 2015 08:45:56 +0000 (08:45 +0000)]
MFC r287221: Fix type bug introduced at r286811.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288722 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286811: Polish sizes processing.
mav [Mon, 5 Oct 2015 08:44:39 +0000 (08:44 +0000)]
MFC r286811: Polish sizes processing.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288721 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286807: Move "ioctl" CAM frontend into separate file.
mav [Mon, 5 Oct 2015 08:43:47 +0000 (08:43 +0000)]
MFC r286807: Move "ioctl" CAM frontend into separate file.

It has nothing to share with too huge ctl.c other then device descriptor,
but even that may be counted as design error that may be fixed later.
At some point we may even want to have several ioctl ports.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288720 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286806: Drop "internal" CTL frontend.
mav [Mon, 5 Oct 2015 08:42:43 +0000 (08:42 +0000)]
MFC r286806: Drop "internal" CTL frontend.

Its idea was to be a simple initiator and execute several commands from
kernel level, but FreeBSD never had consumer for that functionality,
while its implementation polluted many unrelated places.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288719 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286406, r286414:
mav [Mon, 5 Oct 2015 08:41:32 +0000 (08:41 +0000)]
MFC r286406, r286414:
Wrap some unused functions with notyet, it is necessary to be able to
build the modules/ctl directly.
Remove a dead MALLOC_DEFINE.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288718 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285600: MULTI_ID supported does not mean it is used.
mav [Mon, 5 Oct 2015 08:35:48 +0000 (08:35 +0000)]
MFC r285600: MULTI_ID supported does not mean it is used.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288717 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285510:
mav [Mon, 5 Oct 2015 08:33:41 +0000 (08:33 +0000)]
MFC r285510:
Switch initiator IDs in target mode to the same address space as target
IDs in initiator mode -- index in port database instead of handlers.

This makes initiator IDs persist across role changes and firmware resets,
when handlers previously assigned by firmware are lost and reused.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288716 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285481: Make role sysctl handling from r284727 less strict.
mav [Mon, 5 Oct 2015 08:32:34 +0000 (08:32 +0000)]
MFC r285481: Make role sysctl handling from r284727 less strict.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288715 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285459: Unify port database use for target and initiator roles.
mav [Mon, 5 Oct 2015 08:31:48 +0000 (08:31 +0000)]
MFC r285459: Unify port database use for target and initiator roles.

Aside from cleaner and more consistent code, this allows ports to be both
target and initiator same time, and easily switch from any role to any.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288714 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285155:
mav [Mon, 5 Oct 2015 08:30:49 +0000 (08:30 +0000)]
MFC r285155:
Make first step toward supporting target and initiator roles same time.

To avoid conflicts between target and initiator devices in CAM, make
CTL use target ID reported by HBA as its initiator_id in XPT_PATH_INQ.
That target ID is known to never be used for initiator role, so it won't
conflict.  For Fibre Channel and FireWire HBAs this specific ID choice
is irrelevant since all target IDs there are virtual. Same time for SPI
HBAs it seems could be even requirement to use same target ID for both
initiator and target roles.

While there are some more things to polish in isp(4) driver, first tests
of using both roles same time on the same port appeared successfull:

# camcontrol devlist -v
scbus0 on isp0 bus 0:
<FREEBSD CTLDISK 0001>             at scbus0 target 1 lun 0 (da20,pass21)
<>                                 at scbus0 target 256 lun 0 (ctl0)
<>                                 at scbus0 target -1 lun ffffffff (ctl1)

git-svn-id: svn://svn.freebsd.org/base/stable/10@288713 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285154: Remove extra level of target ID indirection (isp_dev_map).
mav [Mon, 5 Oct 2015 08:29:31 +0000 (08:29 +0000)]
MFC r285154: Remove extra level of target ID indirection (isp_dev_map).

FreeBSD never had limitation on number of target IDs, and there is no
any other requirement to allocate them densely.  Since slots of port
database already populated just sequentially, there is no much need
for another indirection to allocate sequentially too.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288712 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285147: Change comment added in r284540.
mav [Mon, 5 Oct 2015 08:28:33 +0000 (08:28 +0000)]
MFC r285147: Change comment added in r284540.

This appeared to be not card's issue, but driver's, though solution is
the same so far.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288711 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC 287473,287485,287493,287494
bapt [Mon, 5 Oct 2015 08:18:31 +0000 (08:18 +0000)]
MFC 287473,287485,287493,287494

Add a new sesutil(8) utility

This is an utility for managing SCSI Enclosure Services (SES) device.

For now only one command is supported "locate" which will change the test of the
external LED associated to a given disk.

Usage if the following:
sesutil locate disk [on|off]

Disk can be a device name: "da12" or a special keyword: "all".

Reviewed by: mav
Relnotes: yes
Sponsored by: gandi.net

git-svn-id: svn://svn.freebsd.org/base/stable/10@288710 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285146: Drop discovered targets when initiator role is disabled.
mav [Mon, 5 Oct 2015 08:16:10 +0000 (08:16 +0000)]
MFC r285146: Drop discovered targets when initiator role is disabled.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288709 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r273051 (by imp):
mav [Mon, 5 Oct 2015 08:14:27 +0000 (08:14 +0000)]
MFC r273051 (by imp):
Use the C99 flexible array construct to denote a variable amount of
data rather than the old-school [1] construct. We have required c99
compilers for some time.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288708 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r271731 (by will): Fix a kernel panic when unloading isp(4).
mav [Mon, 5 Oct 2015 08:13:29 +0000 (08:13 +0000)]
MFC r271731 (by will): Fix a kernel panic when unloading isp(4).

In the current implementation, the isp_kthread() threads never exit.

The target threads do have an exit mode from isp_attach(), but it is
not invoked from isp_detach().

Ensure isp_detach() notifies threads started for each channel, such
that they exit before their parent device softc detaches, and thus
before the module does.  Otherwise, a page fault panic occurs later in:

sysctl_kern_proc
  sysctl_out_proc
    kern_proc_out
      fill_kinfo_proc
        fill_kinfo_thread
          strlcpy(kp->ki_wmesg, td->td_wmesg, sizeof(kp->ki_wmesg));

For isp_kthread() (and isp(4) target threads), td->td_wmesg references
now-unmapped memory after the module has been unloaded.  These threads
are typically msleep()ing at the time of unload, but they could also
attempt to execute now-unmapped code segments.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288707 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285030: Fix couple panics on forced unmount of backing file.
mav [Mon, 5 Oct 2015 08:09:34 +0000 (08:09 +0000)]
MFC r285030: Fix couple panics on forced unmount of backing file.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288706 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r281532 (by delphij): Eliminate unused headers.
mav [Mon, 5 Oct 2015 07:42:05 +0000 (07:42 +0000)]
MFC r281532 (by delphij): Eliminate unused headers.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288704 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r281531 (by asomers):
mav [Mon, 5 Oct 2015 07:40:18 +0000 (07:40 +0000)]
MFC r281531 (by asomers):
Initialize async_arg_ptr in xpt_async when called with async_code
AC_ADVINFO_CHANGED.

Without this change, newly inserted hard disks won't always have their
physical path device nodes created.  The problem reproduces most readily
when attaching a large number of disks at once.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288702 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r280845 (by eadler):
mav [Mon, 5 Oct 2015 07:38:22 +0000 (07:38 +0000)]
MFC r280845 (by eadler):
Add some additional quirks for various Western Digital Caviar MHDDs

git-svn-id: svn://svn.freebsd.org/base/stable/10@288701 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r280388 (by benno): Be consistent with M_ZERO when allocating ccbs.
mav [Mon, 5 Oct 2015 07:36:16 +0000 (07:36 +0000)]
MFC r280388 (by benno): Be consistent with M_ZERO when allocating ccbs.

There are four places, all in cam_xpt.c, where ccbs are malloc'ed. Two of
these use M_ZERO, two don't. The two that don't meant that allocated ccbs
had trash in them making it hard to debug errors where they showed up. Due
to this, use M_ZERO all the time when allocating ccbs.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288700 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r279314 (by trasz): Add missing error check.
mav [Mon, 5 Oct 2015 07:33:54 +0000 (07:33 +0000)]
MFC r279314 (by trasz): Add missing error check.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288699 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r278622 (by trasz): Remove unused code.
mav [Mon, 5 Oct 2015 07:31:51 +0000 (07:31 +0000)]
MFC r278622 (by trasz): Remove unused code.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288698 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r278398 (by trasz):
mav [Mon, 5 Oct 2015 07:29:26 +0000 (07:29 +0000)]
MFC r278398 (by trasz):
Fix ordering of "*logout" and "*terminate"; no functional changes.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288697 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r257831 (by smh):
mav [Mon, 5 Oct 2015 07:21:26 +0000 (07:21 +0000)]
MFC r257831 (by smh):
Corrected definition for old_rate to match d_rotation_rate

git-svn-id: svn://svn.freebsd.org/base/stable/10@288696 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r277440 (by will):
mav [Mon, 5 Oct 2015 07:10:09 +0000 (07:10 +0000)]
MFC r277440 (by will):
Restore the CAM XPT peripheral generation counter, and export it via sysctl.

Define it as an atomic uint32_t.  These increments happen infrequently
enough for the atomic overhead to be a problem, and since they're now
independent atomics, they won't contend with xpt_lock_buses().

This counter is useful as a means of cheaply identifying whether any changes
have been made to the CAM peripheral list.  Userland programs have no guarantee
that the counter won't change on them while being returned or while processing
the information, so they must be written accordingly.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288695 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r277101 (by imp):
mav [Mon, 5 Oct 2015 07:07:37 +0000 (07:07 +0000)]
MFC r277101 (by imp):
Explain a bit of tricky code dealing with trims and how it prevents
starvation. These side effects aren't obvious without extremely
careful study, and are important to do just so.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288694 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r270225 (by jhb): Unexpand TAILQ_FOREACH().
mav [Mon, 5 Oct 2015 06:56:22 +0000 (06:56 +0000)]
MFC r270225 (by jhb): Unexpand TAILQ_FOREACH().

git-svn-id: svn://svn.freebsd.org/base/stable/10@288693 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r269709 (by imp): is_full_id is set to 0 and then not used. remove it.
mav [Mon, 5 Oct 2015 06:55:26 +0000 (06:55 +0000)]
MFC r269709 (by imp): is_full_id is set to 0 and then not used. remove it.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288692 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r288068:
kib [Mon, 5 Oct 2015 05:33:30 +0000 (05:33 +0000)]
MFC r288068:
Ensure that maxproc does not exceed pid_max, at the time of boot.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288690 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoFix broken build, again.
peter [Mon, 5 Oct 2015 01:25:51 +0000 (01:25 +0000)]
Fix broken build, again.

cddl/contrib/opensolaris/uts/common/fs/zfs/bqueue.c wasn't added to
conf/files in r286705 and was fixed by r286718.  The broken
version was MFCed by r288571.

Forgotten by:  mav (again)

git-svn-id: svn://svn.freebsd.org/base/stable/10@288681 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoPartially revert r288607, stable/10 does not use ncurses_dll.h.in like head
bdrewery [Sat, 3 Oct 2015 18:40:27 +0000 (18:40 +0000)]
Partially revert r288607, stable/10 does not use ncurses_dll.h.in like head
does, so this file should not be in CLEANFILES / .NOPATH.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288624 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287982:
bdrewery [Sat, 3 Oct 2015 16:26:13 +0000 (16:26 +0000)]
MFC r287982:

  Replace afterinstall: hack from r54681 with 'make delete-old' functionality.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288613 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287981:
bdrewery [Sat, 3 Oct 2015 16:24:20 +0000 (16:24 +0000)]
MFC r287981:

  Replace afterinstall: hack from r111083 with 'make delete-old' functionality.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288611 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r273756,r287980:
bdrewery [Sat, 3 Oct 2015 16:21:53 +0000 (16:21 +0000)]
MFC r273756,r287980:

  r273756:
    only install .pc files when we are not installing 32bit compat libs...
  r287980:
    Replace beforeinstall: handling with FILES.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288610 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r288199,r288246:
bdrewery [Sat, 3 Oct 2015 16:01:16 +0000 (16:01 +0000)]
MFC r288199,r288246:

    Add missing CLEANFILES.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288607 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r288064 (by avg): 6220 memleak in l2arc on debug build
mav [Sat, 3 Oct 2015 11:43:54 +0000 (11:43 +0000)]
MFC r288064 (by avg): 6220 memleak in l2arc on debug build

illumos/illumos-gate/commit/c546f36aa898d913ff77674fb5ff97f15b2e08b4
https://www.illumos.org/issues/6220
  5408 introduced a memleak in l2arc, namely the member b_thawed gets leaked
  when an arc_hdr is realloced from full to l2only.

Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Simon Klinkert <simon.klinkert@gmail.com>
Reviewed by: George Wilson <george@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Arne Jansen <sensille@gmx.net>

git-svn-id: svn://svn.freebsd.org/base/stable/10@288599 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287771: 5695 dmu_sync'ed holes do not retain birth time
mav [Sat, 3 Oct 2015 11:41:27 +0000 (11:41 +0000)]
MFC r287771: 5695 dmu_sync'ed holes do not retain birth time
(userland portion that was not merged in r286677)

Update zdb to also print ltime, type, and level information
for these new style holes. Previously, only the logical birth
time would be printed.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288598 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287744 (by delphij): Reduce diff against upstream.
mav [Sat, 3 Oct 2015 11:39:39 +0000 (11:39 +0000)]
MFC r287744 (by delphij): Reduce diff against upstream.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288597 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287706 (by delphij):
mav [Sat, 3 Oct 2015 11:38:10 +0000 (11:38 +0000)]
MFC r287706 (by delphij):
6214 zpools going south

In r286570 (MFV of r277426) an unprotected write to b_flags to
set the compression mode was introduced.  This would open a race
window where data is partially decompressed, modified, checksummed
and written to the pool, resulting in pool corruption due to the
partial decompression.

Prevent this by reintroducing b_compress

illumos/illumos-gate@d4cd038c92c36fd0ae35945831a8fc2975b5272c

Illumos issues:

    6214 zpools going south
    https://www.illumos.org/issues/6214

git-svn-id: svn://svn.freebsd.org/base/stable/10@288596 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFV r287703, r287705 (by delphij):
mav [Sat, 3 Oct 2015 11:37:00 +0000 (11:37 +0000)]
MFV r287703, r287705 (by delphij):
6091 avl_add doesn't assert on non-debug builds

Use assfail() from libuutil instead of ASSERT() in userland
AVL avl_add.

illumos/illumos-gate@faa2b6be2fc102adf9ed584fc1a667b4ddf50d78

Illumos issues:

    6091 avl_add doesn't assert on non-debug builds
    https://www.illumos.org/issues/6091

git-svn-id: svn://svn.freebsd.org/base/stable/10@288595 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287702: 5987 zfs prefetch code needs work
mav [Sat, 3 Oct 2015 11:35:18 +0000 (11:35 +0000)]
MFC r287702: 5987 zfs prefetch code needs work

Rewrite the ZFS prefetch code to detect only forward, sequential
streams.

The following kstats have been added:

    kstat.zfs.misc.arcstats.sync_wait_for_async

        How many sync reads have waited for async read
        to complete. (less is better)

    kstat.zfs.misc.arcstats.demand_hit_predictive_prefetch

        How many demand read didn't have to wait for I/O
        because of predictive prefetch.  (more is better)

zfetch kstats have been similified to hits, misses, and max_streams,
with max_streams representing times when we were not able to create
new stream because we already have the maximum number of sequences
for a file.

The sysctl variable/loader tunable vfs.zfs.zfetch.block_cap have been
replaced by vfs.zfs.zfetch.max_distance, which controls maximum bytes
to prefetch per stream.

illumos/illumos-gate@cf6106c8a0d6598b045811f9650d66e07eb332af

Illumos ZFS issues:

    5987 zfs prefetch code needs work
    https://www.illumos.org/issues/5987

git-svn-id: svn://svn.freebsd.org/base/stable/10@288594 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287335 (by allanjude):
mav [Sat, 3 Oct 2015 11:27:23 +0000 (11:27 +0000)]
MFC r287335 (by allanjude):
Remove duplicate defines introduced in initial ZFS import (r168404)

This change reduces compiler warnings by removing duplicate defines

Line numbers are from r168404 (and r284648)
#define lbolt: lines 384 and 459 (531 and 648) (original was renamed later)
#define lbolt64: lines 385 and 460 (532 and 649) (original was renamed later)
#define gethrestime_sec: lines 390 and 465 (540 and 653)
uint64_t physmem: lines 402 and 463 (561 and 651)

git-svn-id: svn://svn.freebsd.org/base/stable/10@288593 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287283 (by delphij):
mav [Sat, 3 Oct 2015 11:24:47 +0000 (11:24 +0000)]
MFC r287283 (by delphij):
Fix a buffer overrun which may lead to data corruption, introduced in
r286951 by reinstating changes in r274628.

In l2arc_compress_buf(), we allocate a buffer to stash away the compressed
data in 'cdata', allocated of l2hdr->b_asize bytes.

We then ask zio_compress_data() to compress the buffer, b_l1hdr.b_tmp_cdata,
which is of l2hdr->b_asize bytes, and have the compressed size (or original
size, if compress didn't gain enough) stored in csize.

To pad the buffer to fit the optimal write size, we round up the compressed
size to L2 device's vdev_ashift.

Illumos code rounds up the size by at most SPA_MINBLOCKSIZE.  Because we
know csize <= b_asize, and b_asize is integer multiple of SPA_MINBLOCKSIZE,
we are guaranteed that the rounded up csize would be <= b_asize. However,
this is not necessarily true when we round up to 1 << vdev_ashift, because
it could be larger than SPA_MINBLOCKSIZE.

So, in the worst case scenario, we are overwriting at most

        (1 << vdev_ashift - SPA_MINBLOCKSIZE)

bytes of memory next to the compressed data buffer.

Andriy's original change in r274628 reorganized the code a little bit,
by moving the padding to after we determined that the compression was
beneficial.  At which point, we would check rounded size against the
allocated buffer size, and the buffer overrun would not be possible.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288592 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287280 (by delphij):
mav [Sat, 3 Oct 2015 11:23:08 +0000 (11:23 +0000)]
MFC r287280 (by delphij):
In r286705 (Illumos 5960/a2cdcdd), a separate thread is created with curproc
as parent.  In the case of a send or receive, the curproc would be the
userland application that issues the ioctl.  This would trigger an assertion
failure introduced in Solaris compatibility shims in r196458 when kernel is
compiled with INVARIANTS.

Fix this by using p0 (proc0 or kernel) as the parent thread when creating
the kernel threads.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288591 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287103 (by avg): 5692 expose the number of hole blocks in a file
mav [Sat, 3 Oct 2015 11:21:50 +0000 (11:21 +0000)]
MFC r287103 (by avg): 5692 expose the number of hole blocks in a file

FreeBSD porting notes:
- only kernel-side changes are merged
- the new ioctl is not actually implemented yet
- thus, the goal is to synchronize DMU code

illumos/illumos-gate@2bcf0248e992f292c7b814458bcdce2f004925d6

https://www.illumos.org/issues/5692
we would like to expose the number of hole (sparse) blocks in a file.
this can be useful to for example if you want to fill in the holes with
some data; knowing the number of holes in advances allows you to report
progress on hole filling. We could use SEEK_HOLE to do that but it would
be O(n) where n is the number of holes present in the file.

Author: Max Grossman <max.grossman@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Boris Protopopov <bprotopopov@hotmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

git-svn-id: svn://svn.freebsd.org/base/stable/10@288590 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286983 (by avg):
mav [Sat, 3 Oct 2015 11:19:32 +0000 (11:19 +0000)]
MFC r286983 (by avg):
fix a mismerge in r286539 (MFV 286538: 5562 ZFS sa_handle's violate...)

git-svn-id: svn://svn.freebsd.org/base/stable/10@288589 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286951: Restore part of r274628, reverted at r286776.
mav [Sat, 3 Oct 2015 11:18:30 +0000 (11:18 +0000)]
MFC r286951: Restore part of r274628, reverted at r286776.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288588 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286776: Remove some random accumulated diff from Illumos.
mav [Sat, 3 Oct 2015 11:17:31 +0000 (11:17 +0000)]
MFC r286776: Remove some random accumulated diff from Illumos.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288587 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286774: 2618 arc.c mistypes in the comments
mav [Sat, 3 Oct 2015 11:16:42 +0000 (11:16 +0000)]
MFC r286774: 2618 arc.c mistypes in the comments

Reviewed by: Jason King <jason.brian.king@gmail.com>
Reviewed by: Josef Sipek <jeffpc@josefsipek.net>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Bart Coddens <bart.coddens@gmail.com>

illumos/illumos-gate@fc98fea58e89224f6f13d7fae246d6cb5dfa35ea

git-svn-id: svn://svn.freebsd.org/base/stable/10@288586 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286770: Fix r286766 build with debug.
mav [Sat, 3 Oct 2015 11:15:49 +0000 (11:15 +0000)]
MFC r286770: Fix r286766 build with debug.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288585 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286767: Fix minor mismerge sometimes earlier.
mav [Sat, 3 Oct 2015 11:15:01 +0000 (11:15 +0000)]
MFC r286767: Fix minor mismerge sometimes earlier.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288584 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286766: 5817 change type of arcs_size from uint64_t to refcount_t
mav [Sat, 3 Oct 2015 11:14:05 +0000 (11:14 +0000)]
MFC r286766: 5817 change type of arcs_size from uint64_t to refcount_t

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <paul.dagnelie@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Reviewed by: Richard Elling <richard.elling@richardelling.com>
Approved by: Garrett D'Amore <garrett@damore.org>
Author: Prakash Surya <prakash.surya@delphix.com>

illumos/illumos-gate@2fd872a734cf486007a8dba532cec52bfb4d40e5

As a way to make it more difficult to introduce bugs into the ARC, and to
make it easier to diagnose issues when bugs do creep in, it would be
beneficial to change the type of the arc_state_t's arcs_size field to be
a refcount_t instead of a uint64_t. This would allow us to make stricter
checks when incrementing and decrementing the value with debugging enabled,
but still fallback to simple, fast atomic operations when debugging is
disabled.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288583 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286764: 6033 arc_adjust() should search MFU lists for oldest buffer
mav [Sat, 3 Oct 2015 11:13:01 +0000 (11:13 +0000)]
MFC r286764: 6033 arc_adjust() should search MFU lists for oldest buffer
when adjusting MFU size.

illumos/illumos-gate@31c46cf23cd1cf4d66390a983dc5072d7d299ba2

https://www.illumos.org/issues/6033
  When we're looking for the list containing oldest buffer we never
  actually look at the MFU lists even when we try to evict from MFU.
  looks like a copy paste error, the fix is here:

Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Xin Li <delphij@delphij.net>
Reviewed by: Prakash Surya <me@prakashsurya.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Alek Pinchuk <alek@nexenta.com>
Obtained from:  illumos

git-svn-id: svn://svn.freebsd.org/base/stable/10@288582 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286763: 5497 lock contention on arcs_mtx
mav [Sat, 3 Oct 2015 11:11:56 +0000 (11:11 +0000)]
MFC r286763: 5497 lock contention on arcs_mtx

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Richard Elling <richard.elling@richardelling.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Prakash Surya <prakash.surya@delphix.com>

illumos/illumos-gate@244781f10dcd82684fd8163c016540667842f203

This patch attempts to reduce lock contention on the current arc_state_t
mutexes. These mutexes are used liberally to protect the number of LRU
lists within the ARC (e.g. ARC_mru, ARC_mfu, etc). The granularity at
which these locks are acquired has been shown to greatly affect the
performance of highly concurrent, cached workloads.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288581 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286762: Revert part of r205231, introducing multiple ARC state locks.
mav [Sat, 3 Oct 2015 11:10:54 +0000 (11:10 +0000)]
MFC r286762: Revert part of r205231, introducing multiple ARC state locks.

This local implementation will be replaced by one from Illumos to reduce
code divergence and make further merges easier.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288580 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoFix r288549 build on stable.
mav [Sat, 3 Oct 2015 09:22:21 +0000 (09:22 +0000)]
Fix r288549 build on stable.

For some reason this (odd) code builds on head, but not on stable.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288576 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286712: 6096 ZFS_SMB_ACL_RENAME needs to cleanup better
mav [Sat, 3 Oct 2015 08:07:21 +0000 (08:07 +0000)]
MFC r286712: 6096 ZFS_SMB_ACL_RENAME needs to cleanup better

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
Reviewed by: George Wilson <gwilson@zfsmail.com>
Approved by: Robert Mustacchi <rm@joyent.com>

illumos/illumos-gate@8f5190a540d64d2debee6664bbc740e4c38f5b7f

git-svn-id: svn://svn.freebsd.org/base/stable/10@288574 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286710:
mav [Sat, 3 Oct 2015 08:06:29 +0000 (08:06 +0000)]
MFC r286710:
6093 zfsctl_shares_lookup should only VN_RELE() on zfs_zget() success

Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Dan McDonald <danmcd@omniti.com>

illumos/illumos-gate@0f92170f1ec2737ee5a0e51b5f74093904811452

git-svn-id: svn://svn.freebsd.org/base/stable/10@288573 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286708: 5959 clean up per-dataset feature count code
mav [Sat, 3 Oct 2015 08:05:33 +0000 (08:05 +0000)]
MFC r286708: 5959 clean up per-dataset feature count code

Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Matthew Ahrens <mahrens@delphix.com>

illumos/illumos-gate@ca0cc3918a1789fa839194af2a9245f801a06b1a

A ZFS feature flags (large blocks) tracks its refcounts as the number of
datasets that have ever used the feature. Several features of this type
are planned to be added (new checksum functions). This code should be made
common infrastructure rather than duplicating the code for each feature.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288572 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286705: 5960 zfs recv should prefetch indirect blocks
mav [Sat, 3 Oct 2015 08:03:36 +0000 (08:03 +0000)]
MFC r286705: 5960 zfs recv should prefetch indirect blocks
5925 zfs receive -o origin=

Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Author: Paul Dagnelie <pcd@delphix.com>

While running 'zfs recv' we noticed that every 128th 8K block required a
read. We were seeing that restore_write() was calling dmu_tx_hold_write()
and the indirect block was not cached. We should prefetch upcoming indirect
blocks to avoid having to go to disk and blocking the restore_write().

Allow an incremental send stream to be received as a clone, even if the
stream does not mark it as a clone.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288571 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286689: 5981 Deadlock in dmu_objset_find_dp
mav [Sat, 3 Oct 2015 07:59:25 +0000 (07:59 +0000)]
MFC r286689: 5981 Deadlock in dmu_objset_find_dp

illumos/illumos-gate@1d3f896f5469c69c1339890ec3d68e9feddb0343

https://www.illumos.org/issues/5981
  When dmu_objset_find_dp gets called with a read lock held, it fans out
  the work to the task queue. Each task in turn acquires its own read
  lock before calling the callback. If during this process anyone tries
  to a acquire a write lock, it will stall all read lock requests.Thus
  the tasks will never finish, the read lock of the caller will never
  get freed and the write lock never acquired.  deadlock.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Arne Jansen <jansen@webgods.de>

git-svn-id: svn://svn.freebsd.org/base/stable/10@288570 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286686: 5269 zpool import slow
mav [Sat, 3 Oct 2015 07:58:28 +0000 (07:58 +0000)]
MFC r286686: 5269 zpool import slow

illumos/illumos-gate@12380e1e701fda28c9e9f32d01cafb54af279eb5

https://www.illumos.org/issues/5269
  When importing a pool (at boot or with zpool import) with many
  filesystem, the process can take minutes. It doesn't matter whether
  the pool has been exported cleanly or uncleanly.  The problem is that
  each dataset has its own log chain. On import, all datasets have to be
  checked if there are logs to replay.  The idea is to speed up this
  process by paralellizing it.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Arne Jansen <jansen@webgods.de>

git-svn-id: svn://svn.freebsd.org/base/stable/10@288569 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286683: 5765 add support for estimating send stream size with
mav [Sat, 3 Oct 2015 07:57:32 +0000 (07:57 +0000)]
MFC r286683: 5765 add support for estimating send stream size with
lzc_send_space when source is a bookmark

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: Steven Hartland <killing@multiplay.co.uk>
Reviewed by: Bayard Bell <buffer.g.overflow@gmail.com>
Approved by: Albert Lee <trisk@nexenta.com>
Author: Max Grossman <max.grossman@delphix.com>

illumos/illumos-gate@643da460c8ca583e39ce053081754e24087f84c8

git-svn-id: svn://svn.freebsd.org/base/stable/10@288568 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286677: 5695 dmu_sync'ed holes do not retain birth time
mav [Sat, 3 Oct 2015 07:55:37 +0000 (07:55 +0000)]
MFC r286677: 5695 dmu_sync'ed holes do not retain birth time

illumos/illumos-gate@70163ac57e58ace1c5c94dfbe85dca5a974eff36

https://www.illumos.org/issues/5695
  In dmu_sync_ready(), a hole block pointer will have it's logical size
  explicitly set as it's necessary for replay purposes. To "undo" this,
  dmu_sync_done() will zero out any hole that it finds. This becomes a
  problem when using the "hole_birth" feature, as this will also wipe out
  any birth time that might have happened to be set on the hole.
  ...
  As a fix, the logic to zero out a hole is only applied to old style
  holes with a birth time of zero. Holes created with the "hole_birth"
  feature enabled will have a non-zero birth time, and will be skipped
  (thus preserving the ltime, type, and level information as well).
  In addition, zdb was updated to also print the ltime, type, and level
  information for these new style holes. Previously, only the logical
  birth time would be printed.

Author: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: Bayard Bell <buffer.g.overflow@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@288567 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286655: Fix set of sign extension bugs in r286625.
mav [Sat, 3 Oct 2015 07:53:56 +0000 (07:53 +0000)]
MFC r286655: Fix set of sign extension bugs in r286625.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288566 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286647: Fix assertion panic caused by combination of r286598 and TRIM.
mav [Sat, 3 Oct 2015 07:53:08 +0000 (07:53 +0000)]
MFC r286647: Fix assertion panic caused by combination of r286598 and TRIM.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288565 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286628: Fix r286625 build on i386.
mav [Sat, 3 Oct 2015 07:52:11 +0000 (07:52 +0000)]
MFC r286628: Fix r286625 build on i386.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288564 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286626: Fix minor mismerge in r286574.
mav [Sat, 3 Oct 2015 07:51:09 +0000 (07:51 +0000)]
MFC r286626: Fix minor mismerge in r286574.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288563 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286625:
mav [Sat, 3 Oct 2015 07:50:15 +0000 (07:50 +0000)]
MFC r286625:
5376 arc_kmem_reap_now() should not result in clearing arc_no_grow

Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Steven Hartland <killing@multiplay.co.uk>
Reviewed by: Richard Elling <richard.elling@richardelling.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Matthew Ahrens <mahrens@delphix.com>

illumos/illumos-gate@2ec99e3e987d8aa273f1e9ba2b983557d058198c

git-svn-id: svn://svn.freebsd.org/base/stable/10@288562 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286623: Remove extra lock, that IMO only creates potential problems now.
mav [Sat, 3 Oct 2015 07:49:16 +0000 (07:49 +0000)]
MFC r286623: Remove extra lock, that IMO only creates potential problems now.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288561 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286605: 5812 assertion failed in zrl_tryenter(): zr_owner==NULL
mav [Sat, 3 Oct 2015 07:48:25 +0000 (07:48 +0000)]
MFC r286605: 5812 assertion failed in zrl_tryenter(): zr_owner==NULL

Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Reviewed by: Will Andrews <will@freebsd.org>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Matthew Ahrens <mahrens@delphix.com>

illumos/illumos-gate@8df173054ca442cd8845a7364c3edad9d6822351

git-svn-id: svn://svn.freebsd.org/base/stable/10@288560 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286603: 5810 zdb should print details of bpobj
mav [Sat, 3 Oct 2015 07:47:33 +0000 (07:47 +0000)]
MFC r286603: 5810 zdb should print details of bpobj

Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Will Andrews <will@freebsd.org>
Reviewed by: Simon Klinkert <simon.klinkert@gmail.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Matthew Ahrens <mahrens@delphix.com>

illumos/illumos-gate@732885fca09e11183dd0ea69aaaab5588fb7dbff

git-svn-id: svn://svn.freebsd.org/base/stable/10@288559 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286600: 5808 spa_check_logs is not necessary on readonly pools
mav [Sat, 3 Oct 2015 07:46:03 +0000 (07:46 +0000)]
MFC r286600: 5808 spa_check_logs is not necessary on readonly pools

Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Paul Dagnelie <paul.dagnelie@delphix.com>
Reviewed by: Simon Klinkert <simon.klinkert@gmail.com>
Reviewed by: Will Andrews <will@freebsd.org>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Matthew Ahrens <mahrens@delphix.com>

illumos/illumos-gate@23367a2f2caec1ccb4d918bdd0f2fc2c9cadcd06

git-svn-id: svn://svn.freebsd.org/base/stable/10@288558 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286598: 5701 zpool list reports incorrect "alloc" value for cache devices
mav [Sat, 3 Oct 2015 07:45:12 +0000 (07:45 +0000)]
MFC r286598: 5701 zpool list reports incorrect "alloc" value for cache devices

git-svn-id: svn://svn.freebsd.org/base/stable/10@288557 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r288281
alc [Sat, 3 Oct 2015 07:43:33 +0000 (07:43 +0000)]
MFC r288281
  The conversion of kmem_alloc_attr() from operating on a vm map to a vmem
  arena in r254025 introduced a bug in the case when an allocation is only
  partially successful.  Specifically, the vm object lock was not being
  acquired before freeing the allocated pages.  To address this bug, replace
  the existing code by a call to kmem_unback().

  Change the type of a variable in kmem_alloc_attr() so that an allocation
  of two or more gigabytes won't fail.

  Replace the error handling code in kmem_back() by a call to kmem_unback().

git-svn-id: svn://svn.freebsd.org/base/stable/10@288556 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286593: Local addition and mismerge fix for r286579.
mav [Sat, 3 Oct 2015 07:35:11 +0000 (07:35 +0000)]
MFC r286593: Local addition and mismerge fix for r286579.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288555 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286589: 5820 verify failed in zio_done(): BP_EQUAL(bp, io_bp_orig)
mav [Sat, 3 Oct 2015 07:34:21 +0000 (07:34 +0000)]
MFC r286589: 5820 verify failed in zio_done(): BP_EQUAL(bp, io_bp_orig)

Reviewed by: Alex Reece <alex@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Steven Hartland <killing@multiplay.co.uk>
Approved by: Garrett D'Amore <garrett@damore.org>
Author: Matthew Ahrens <mahrens@delphix.com>

illumod/illumos-gate@34e8acef009195effafdcf6417aec385e241796e

git-svn-id: svn://svn.freebsd.org/base/stable/10@288554 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286587: 5746 more checksumming in zfs send
mav [Sat, 3 Oct 2015 07:33:27 +0000 (07:33 +0000)]
MFC r286587: 5746 more checksumming in zfs send

Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Bayard Bell <buffer.g.overflow@gmail.com>
Approved by: Albert Lee <trisk@omniti.com>
Author: Matthew Ahrens <mahrens@delphix.com>

illumos/illumos-gate@98110f08fa182032082d98be2ddb9391fcd62bf1

git-svn-id: svn://svn.freebsd.org/base/stable/10@288553 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286579: 5313 Allow I/Os to be aggregated across ZIO priority classes
mav [Sat, 3 Oct 2015 07:32:34 +0000 (07:32 +0000)]
MFC r286579: 5313 Allow I/Os to be aggregated across ZIO priority classes
Reviewed by: Andriy Gapon <avg@FreeBSD.org>
Reviewed by: Will Andrews <willa@SpectraLogic.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Justin T. Gibbs <justing@spectralogic.com>

illumos/illumos-gate@fe319232d24f4ae183730a5a24a09423d8ab4429

git-svn-id: svn://svn.freebsd.org/base/stable/10@288552 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286578: Fix r286574 build in user-space.
mav [Sat, 3 Oct 2015 07:31:42 +0000 (07:31 +0000)]
MFC r286578: Fix r286574 build in user-space.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288551 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286576: Fix r286570 build with debug.
mav [Sat, 3 Oct 2015 07:30:55 +0000 (07:30 +0000)]
MFC r286576: Fix r286570 build with debug.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288550 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286575: 5056 ZFS deadlock on db_mtx and dn_holds
mav [Sat, 3 Oct 2015 07:29:56 +0000 (07:29 +0000)]
MFC r286575: 5056 ZFS deadlock on db_mtx and dn_holds

Reviewed by: Will Andrews <willa@spectralogic.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Justin Gibbs <justing@spectralogic.com>

illumos/illumos-gate@bc9014e6a81272073b9854d9f65dd59e18d18c35

git-svn-id: svn://svn.freebsd.org/base/stable/10@288549 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286574: 5445 Add more visibility via arcstats; specifically
mav [Sat, 3 Oct 2015 07:28:52 +0000 (07:28 +0000)]
MFC r286574: 5445 Add more visibility via arcstats; specifically
arc_state_t stats and differentiate between "data" and "metadata"

Reviewed by: Basil Crow <basil.crow@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Bayard Bell <bayard.bell@nexenta.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Prakash Surya <prakash.surya@delphix.com>

illumos/illumos-gate@4076b1bf41cfd9f968a33ed54a7ae76d9e996fe8

git-svn-id: svn://svn.freebsd.org/base/stable/10@288548 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286570: 5408 managing ZFS cache devices requires lots of RAM
mav [Sat, 3 Oct 2015 07:27:58 +0000 (07:27 +0000)]
MFC r286570: 5408 managing ZFS cache devices requires lots of RAM
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Don Brady <dev.fs.zfs@gmail.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Approved by: Garrett D'Amore <garrett@damore.org>
Author: Chris Williamson <Chris.Williamson@delphix.com>

illumos/illumos-gate@89c86e32293a30cdd7af530c38b2073fee01411c

Currently, every buffer cached in the L2ARC is accompanied by a 240-byte
header in memory, leading to very high memory consumption when using very
large cache devices. These changes significantly reduce this overhead.

Currently:

L1-only header = 176 bytes
L1 + L2 or L2-only header = 176 bytes + 32 byte checksum + 32 byte l2hdr
    = 240 bytes

Memory-optimized:

L1-only header = 176 bytes
L1 + L2 header = 176 bytes + 32 byte checksum = 208 bytes
L2-only header = 96 bytes + 32 byte checksum = 128 bytes

So overall:

          Trunk  Optimized
        +-----------------+
L1-only | 176 B  | 176 B  | (same)
        +-----------------+
L1 & L2 | 240 B  | 208 B  | (saved 32 bytes)
        +-----------------+
L2-only | 240 B  | 128 B  | (saved 116 bytes)
        +-----------------+

For an average blocksize of 8KB, this means that for the L2ARC, the ratio
of metadata to data has gone down from about 2.92% to 1.56%.  For a
'storage optimized' EC2 instance with 1600GB of SSD and 60GB of RAM, this
means that we expect a completely full L2ARC to use (1600 GB * 0.0156) /
60GB = 41% of the available memory, down from 78%.

Relnotes: yes

git-svn-id: svn://svn.freebsd.org/base/stable/10@288547 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286556: Avoid 128K kmem allocations in mzap_upgrade()
mav [Sat, 3 Oct 2015 07:26:48 +0000 (07:26 +0000)]
MFC r286556: Avoid 128K kmem allocations in mzap_upgrade()

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Steven Hartland <killing@multiplay.co.uk>
Approved by: Rich Lowe <richlowe@richlowe.net>

illumos/illumos-gate@be3e2ab906b80af79c7b22885f279e45ad8fb995

git-svn-id: svn://svn.freebsd.org/base/stable/10@288546 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286554: 5769 Cast 'zfs bad bloc' to ULL for x86
mav [Sat, 3 Oct 2015 07:25:59 +0000 (07:25 +0000)]
MFC r286554: 5769 Cast 'zfs bad bloc' to ULL for x86

Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <paul.dagnelie@delphix.com>
Reviewed by: Richard PALO <richard@NetBSD.org>
Approved by: Dan McDonald <danmcd@omniti.com>

illumos/illumos-gate@8c76e0763bcf0029556e106377da859f6492a7ee

git-svn-id: svn://svn.freebsd.org/base/stable/10@288545 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286551: 5694 traverse_prefetcher does not prefetch enough
mav [Sat, 3 Oct 2015 07:25:05 +0000 (07:25 +0000)]
MFC r286551: 5694 traverse_prefetcher does not prefetch enough

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Bayard Bell <buffer.g.overflow@gmail.com>
Approved by: Garrett D'Amore <garrett@damore.org>
Author: George Wilson <george.wilson@delphix.com>

illumos/illumos-gate@34d7ce052c4565b078f73b95ccbd49274e98edaa

git-svn-id: svn://svn.freebsd.org/base/stable/10@288544 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286549:
mav [Sat, 3 Oct 2015 07:24:12 +0000 (07:24 +0000)]
MFC r286549:
5693 ztest fails in dbuf_verify: buf[i] == 0, due to dedup and bp_override

Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: Bayard Bell <buffer.g.overflow@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Matthew Ahrens <mahrens@delphix.com>

illumos/illumos-gate@7f7ace370074e350853da254c65688fd43ddc695

git-svn-id: svn://svn.freebsd.org/base/stable/10@288543 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286547:
mav [Sat, 3 Oct 2015 07:23:19 +0000 (07:23 +0000)]
MFC r286547:
5661 ZFS: "compression = on" should use lz4 if feature is enabled

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Xin LI <delphij@freebsd.org>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Justin T. Gibbs <justing@spectralogic.com>

illumos/illumos-gate@db1741f555ec79def5e9846e6bfd132248514ffe

git-svn-id: svn://svn.freebsd.org/base/stable/10@288542 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286545:
mav [Sat, 3 Oct 2015 07:22:24 +0000 (07:22 +0000)]
MFC r286545:
5630 stale bonus buffer in recycled dnode_t leads to data corruption

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Will Andrews <will@freebsd.org>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Justin T. Gibbs <justing@spectralogic.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@288541 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286543: 5592 NULL pointer dereference in dsl_prop_notify_all_cb()
mav [Sat, 3 Oct 2015 07:21:27 +0000 (07:21 +0000)]
MFC r286543: 5592 NULL pointer dereference in dsl_prop_notify_all_cb()

Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Will Andrews <will@freebsd.org>
Approved by: Robert Mustacchi <rm@joyent.com>

illumos/illumos-gate@9d47dec0481d8cd53b2c1053c96bfa3f78357d6a

git-svn-id: svn://svn.freebsd.org/base/stable/10@288539 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286541: 5531 NULL pointer dereference in dsl_prop_get_ds()
mav [Sat, 3 Oct 2015 07:20:26 +0000 (07:20 +0000)]
MFC r286541: 5531 NULL pointer dereference in dsl_prop_get_ds()

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Bayard Bell <buffer.g.overflow@gmail.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Justin T. Gibbs <justing@spectralogic.com>

illumos/illumos-gate@e57a022b8f718889ffa92adbde47a8f08abcdb25

git-svn-id: svn://svn.freebsd.org/base/stable/10@288538 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f