mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
OpenZFS 8677 - Open-Context Channel Programs
Authored by: Serapheim Dimitropoulos <serapheim@delphix.com> Reviewed by: Matt Ahrens <mahrens@delphix.com> Reviewed by: Chris Williamson <chris.williamson@delphix.com> Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com> Approved by: Robert Mustacchi <rm@joyent.com> Ported-by: Don Brady <don.brady@delphix.com> We want to be able to run channel programs outside of synching context. This would greatly improve performance for channel programs that just gather information, as they won't have to wait for synching context anymore. === What is implemented? This feature introduces the following: - A new command line flag in "zfs program" to specify our intention to run in open context. (The -n option) - A new flag/option within the channel program ioctl which selects the context. - Appropriate error handling whenever we try a channel program in open-context that contains zfs.sync* expressions. - Documentation for the new feature in the manual pages. === How do we handle zfs.sync functions in open context? When such a function is found by the interpreter and we are running in open context we abort the script and we spit out a descriptive runtime error. For example, given the script below ... arg = ... fs = arg["argv"][1] err = zfs.sync.destroy(fs) msg = "destroying " .. fs .. " err=" .. err return msg if we run it in open context, we will get back the following error: Channel program execution failed: [string "channel program"]:3: running functions from the zfs.sync submodule requires passing sync=TRUE to lzc_channel_program() (i.e. do not specify the "-n" command line argument) stack traceback: [C]: in function 'destroy' [string "channel program"]:3: in main chunk === What about testing? We've introduced new wrappers for all channel program tests that run each channel program as both (startard & open-context) and expect the appropriate behavior depending on the program using the zfs.sync module. OpenZFS-issue: https://www.illumos.org/issues/8677 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/17a49e15 Closes #6558
This commit is contained in:
committed by
Brian Behlendorf
parent
8d103d8856
commit
5b72a38d68
+10
-1
@@ -17,7 +17,8 @@
|
||||
.Nm zfs program
|
||||
.Nd executes ZFS channel programs
|
||||
.Sh SYNOPSIS
|
||||
.Cm zfs program
|
||||
.Cm "zfs program"
|
||||
.Op Fl n
|
||||
.Op Fl t Ar instruction-limit
|
||||
.Op Fl m Ar memory-limit
|
||||
.Ar pool
|
||||
@@ -45,6 +46,14 @@ will be run on
|
||||
and any attempts to access or modify other pools will cause an error.
|
||||
.Sh OPTIONS
|
||||
.Bl -tag -width "-t"
|
||||
.It Fl n
|
||||
Executes a read-only channel program, which runs faster.
|
||||
The program cannot change on-disk state by calling functions from the
|
||||
zfs.sync submodule.
|
||||
The program can be used to gather information such as properties and
|
||||
determining if changes would succeed (zfs.check.*).
|
||||
Without this flag, all pending changes must be synced to disk before a
|
||||
channel program can complete.
|
||||
.It Fl t Ar instruction-limit
|
||||
Execution time limit, in number of Lua instructions to execute.
|
||||
If a channel program executes more than the specified number of instructions,
|
||||
|
||||
+11
-1
@@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
.\" Copyright 2011 Joshua M. Clulow <josh@sysmgr.org>
|
||||
.\" Copyright (c) 2011, 2016 by Delphix. All rights reserved.
|
||||
.\" Copyright (c) 2011, 2017 by Delphix. All rights reserved.
|
||||
.\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
||||
.\" Copyright (c) 2014, Joyent, Inc. All rights reserved.
|
||||
.\" Copyright (c) 2014 by Adam Stevko. All rights reserved.
|
||||
@@ -272,6 +272,7 @@
|
||||
.Ar snapshot Ar snapshot Ns | Ns Ar filesystem
|
||||
.Nm
|
||||
.Cm program
|
||||
.Op Fl n
|
||||
.Op Fl t Ar timeout
|
||||
.Op Fl m Ar memory_limit
|
||||
.Ar pool script
|
||||
@@ -4042,6 +4043,7 @@ Display the path's inode change time as the first column of output.
|
||||
.It Xo
|
||||
.Nm
|
||||
.Cm program
|
||||
.Op Fl n
|
||||
.Op Fl t Ar timeout
|
||||
.Op Fl m Ar memory_limit
|
||||
.Ar pool script
|
||||
@@ -4063,6 +4065,14 @@ For full documentation of the ZFS channel program interface, see the manual
|
||||
page for
|
||||
.Xr zfs-program 8 .
|
||||
.Bl -tag -width ""
|
||||
.It Fl n
|
||||
Executes a read-only channel program, which runs faster.
|
||||
The program cannot change on-disk state by calling functions from
|
||||
the zfs.sync submodule.
|
||||
The program can be used to gather information such as properties and
|
||||
determining if changes would succeed (zfs.check.*).
|
||||
Without this flag, all pending changes must be synced to disk before
|
||||
a channel program can complete.
|
||||
.It Fl t Ar timeout
|
||||
Execution time limit, in milliseconds.
|
||||
If a channel program executes for longer than the provided timeout, it will
|
||||
|
||||
Reference in New Issue
Block a user