aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
Commit message (Collapse)AuthorAgeFilesLines
* Add -y option to `zpool iostat`Hajo Möller2015-06-171-8/+23
| | | | | | | | | | sysstat's iostat omits the first report when the -y option is used. This patch adds that functionality and omits the first report with statistics since system boot. Signed-off-by: Hajo Möller <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3439
* Illumos 5497 - lock contention on arcs_mtxPrakash Surya2015-06-112-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reviewed by: George Wilson <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Richard Elling <[email protected]> Approved by: Dan McDonald <[email protected]> Porting notes and other significant code changes: The illumos 5368 patch (ARC should cache more metadata), which was never picked up by ZoL, is mostly reverted by this patch. Since ZoL relies on the kernel asynchronously calling the shrinker to actually reap memory, the shrinker wakes up arc_reclaim_waiters_cv every time it runs. The arc_adapt_thread() function no longer calls arc_do_user_evicts() since the newly-added arc_user_evicts_thread() calls it periodically. Notable conflicting ZoL commits which conflicted with this patch or whose effects are either duplicated or un-done by this patch: 302f753 - Integrate ARC more tightly with Linux 39e055c - Adjust arc_p based on "bytes" in arc_shrink f521ce1 - Allow "arc_p" to drop to zero or grow to "arc_c" 77765b5 - Remove "arc_meta_used" from arc_adjust calculation 94520ca - Prune metadata from ghost lists in arc_adjust_meta Trace support for multilist_insert() and multilist_remove() has been added and produces the following output: fio-12498 [077] .... 112936.448324: zfs_multilist__insert: ml { offset 240 numsublists 80 sublistidx 63 } fio-12498 [077] .... 112936.448347: zfs_multilist__remove: ml { offset 240 numsublists 80 sublistidx 29 } The following arcstats have been removed: recycle_miss - Used by arcstat.py and arc_summary.py, both of which have been updated appropriately. l2_writes_hdr_miss The following arcstats have been added: evict_not_enough - Number of times arc_evict_state() was unable to evict enough buffers to reach its target amount. evict_l2_skip - Number of times arc_evict_hdr() skipped eviction because it was being written to the l2arc. l2_writes_lock_retry - Replaces l2_writes_hdr_miss. Number of times l2arc_write_done() failed to acquire hash_lock (and re-tries). arc_meta_min - Shows the value of the zfs_arc_meta_min module parameter (see below). The "index" column of the "dbuf" kstat has been removed since it doesn't have a direct analog in the new multilist scheme. Additional multilist- related stats could be added in the future but would likely require extensions to the mulilist API. The following module parameters have been added: zfs_arc_evict_batch_limit - Number of ARC headers to free per sub-list before moving on to the next sub-list. zfs_arc_meta_min - Enforce a floor on the amount of metadata in the ARC. zfs_arc_num_sublists_per_state - Number of multilist sub-lists per ARC state. zfs_arc_overflow_shift - Controls amount by which the ARC must exceed the target size to be considered "overflowing". Ported-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]
* Illumos 5408 - managing ZFS cache devices requires lots of RAMChris Williamson2015-06-111-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5408 managing ZFS cache devices requires lots of RAM Reviewed by: Christopher Siden <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Don Brady <[email protected]> Reviewed by: Josef 'Jeff' Sipek <[email protected]> Approved by: Garrett D'Amore <[email protected]> Porting notes: Due to the restructuring of the ARC-related structures, this patch conflicts with at least the following existing ZoL commits: 6e1d7276c94cbd7c2e19f9232f6ba4bafa62dbe0 Fix inaccurate arcstat_l2_hdr_size calculations The ARC_SPACE_HDRS constant no longer exists and has been somewhat equivalently replaced by HDR_L2ONLY_SIZE. e0b0ca983d6897bcddf05af2c0e5d01ff66f90db Add visibility in to cached dbufs The new layering of l{1,2}arc_buf_hdr_t within the arc_buf_hdr struct requires additional structure member names to be used when referencing the inner items. Also, the presence of L1 or L2 inner member is indicated by flags using the new HDR_HAS_L{1,2}HDR macros. Ported by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* Illumos 5369 - arc flags should be an enumGeorge Wilson2015-06-111-1/+1
| | | | | | | | | | | | | | | | | 5369 arc flags should be an enum 5370 consistent arc_buf_hdr_t naming scheme Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Alex Reece <[email protected]> Reviewed by: Sebastien Roy <[email protected]> Reviewed by: Richard Elling <[email protected]> Approved by: Richard Lowe <[email protected]> Porting notes: ZoL has moved some ARC definitions into arc_impl.h. Signed-off-by: Brian Behlendorf <[email protected]> Ported by: Tim Chase <[email protected]>
* Illumos 5818 - zfs {ref}compressratio is incorrect with 4k sector sizeMatthew Ahrens2015-06-101-17/+3
| | | | | | | | | | | | | | | | | 5818 zfs {ref}compressratio is incorrect with 4k sector size Reviewed by: Alex Reece <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Richard Elling <[email protected]> Reviewed by: Steven Hartland <[email protected]> Approved by: Albert Lee <[email protected]> References: https://www.illumos.org/issues/5818 https://github.com/illumos/illumos-gate/commit/81cd5c5 Ported-by: Don Brady <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3432
* Add libzfs_error_init() functionBrian Behlendorf2015-05-225-5/+15
| | | | | | | | | | | | | | All fprintf() error messages are moved out of the libzfs_init() library function where they never belonged in the first place. A libzfs_error_init() function is added to provide useful error messages for the most common causes of failure. Additionally, in libzfs_run_process() the 'rc' variable was renamed to 'error' for consistency with the rest of the code base. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Richard Yao <[email protected]>
* Illumos 5243 - zdb -b could be much fasterMatthew Ahrens2015-05-151-2/+25
| | | | | | | | | | | | | | | | 5243 zdb -b could be much faster Reviewed by: Christopher Siden <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Richard Elling <[email protected]> Approved by: Dan McDonald <[email protected]> References: https://www.illumos.org/issues/5243 https://github.com/illumos/illumos-gate/commit/f7950bf Ported-by: Don Brady <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3414
* Zdb should be able to open the root datasetTim Chase2015-05-151-1/+11
| | | | | | | | | If the pool/dataset command-line argument is specified with a trailing slash, for example, "tank/", it is interpreted as the root dataset. Signed-off-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3415
* Illumos 5810 - zdb should print details of bpobjMatthew Ahrens2015-05-111-10/+89
| | | | | | | | | | | | | | | | | | 5810 zdb should print details of bpobj Reviewed by: Prakash Surya <[email protected]> Reviewed by: Alex Reece <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Will Andrews <[email protected]> Reviewed by: Simon Klinkert <[email protected]> Approved by: Gordon Ross <[email protected]> References: https://www.illumos.org/issues/5810 https://github.com/illumos/illumos-gate/commit/732885fc Ported-by: DHE <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3387
* Update ZED copyright boilerplateChris Dunlap2015-05-1114-296/+127
| | | | | | | | | | | | | | | | | | | | | | This commit updates the copyright boilerplate within the ZED subtree. The instructions for appending a contributor copyright line have been removed. Manually maintaining copyright notices in this manner is error-prone, imprecise at a file-scope granularity, and oftentimes inaccurate. These lines can become a pernicious source of merge conflicts. A commit log is better suited to maintaining this information. Consequently, a line has been added to the boilerplate to refer to the git commit log for authoritative copyright attribution. To account for the scenario where a file may become separated from the codebase and commit history (i.e., it is copied somewhere else), a line has been added to identify the file's origin. http://softwarefreedom.org/resources/2012/ManagingCopyrightInformation.html Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3384
* ztest should randomly change recordsizeBrian Behlendorf2015-05-111-0/+3
| | | | | | | | | Improve the large block feature test coverage by extending ztest to frequently change the recordsize. This is specificially designed to catch corner cases which might otherwise go unnoticed. Signed-off-by: Brian Behlendorf <[email protected]> Issue #354
* Illumos 5027 - zfs large block supportMatthew Ahrens2015-05-114-14/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5027 zfs large block support Reviewed by: Alek Pinchuk <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Josef 'Jeff' Sipek <[email protected]> Reviewed by: Richard Elling <[email protected]> Reviewed by: Saso Kiselkov <[email protected]> Reviewed by: Brian Behlendorf <[email protected]> Approved by: Dan McDonald <[email protected]> References: https://www.illumos.org/issues/5027 https://github.com/illumos/illumos-gate/commit/b515258 Porting Notes: * Included in this patch is a tiny ISP2() cleanup in zio_init() from Illumos 5255. * Unlike the upstream Illumos commit this patch does not impose an arbitrary 128K block size limit on volumes. Volumes, like filesystems, are limited by the zfs_max_recordsize=1M module option. * By default the maximum record size is limited to 1M by the module option zfs_max_recordsize. This value may be safely increased up to 16M which is the largest block size supported by the on-disk format. At the moment, 1M blocks clearly offer a significant performance improvement but the benefits of going beyond this for the majority of workloads are less clear. * The illumos version of this patch increased DMU_MAX_ACCESS to 32M. This was determined not to be large enough when using 16M blocks because the zfs_make_xattrdir() function will fail (EFBIG) when assigning a TX. This was immediately observed under Linux because all newly created files must have a security xattr created and that was failing. Therefore, we've set DMU_MAX_ACCESS to 64M. * On 32-bit platforms a hard limit of 1M is set for blocks due to the limited virtual address space. We should be able to relax this one the ABD patches are merged. Ported-by: Brian Behlendorf <[email protected]> Closes #354
* Add the '-a' option to 'zpool export'Turbo Fredriksson2015-05-041-31/+51
| | | | | | | | | | | | | Support exporting all imported pools in one go, using 'zpool export -a'. This is accomplished by moving the export parts from zpool_do_export() in to the new function zpool_export_one(). The for_each_pool() function is used to enumerate the list of pools to be exported. Passing an argc of 0 implies the function should be called on all pools. Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes: #3203
* Illumos 4951 - ZFS administrative commands should use reserved spaceMatthew Ahrens2015-05-042-5/+9
| | | | | | | | | | | | | | | 4951 ZFS administrative commands should use reserved space, not with ENOSPC Reviewed by: John Kennedy <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Christopher Siden <[email protected]> Reviewed by: Dan McDonald <[email protected]> Approved by: Garrett D'Amore <[email protected]> References: https://www.illumos.org/issues/4373 https://github.com/illumos/illumos-gate/commit/7d46dc6 Ported by: Brian Behlendorf <[email protected]>
* Illumos 4373 - add block contents print to zstreamdumpMax Grossman2015-05-041-5/+120
| | | | | | | | | | | | | | 4373 add block contents print to zstreamdump Reviewed by: Adam Leventhal <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Josef 'Jeff' Sipek <[email protected]> Approved by: Dan McDonald <[email protected]> References: https://www.illumos.org/issues/4373 https://github.com/illumos/illumos-gate/commit/994fb6b Ported by: Brian Behlendorf <[email protected]>
* Illumos 3654,3656Matthew Ahrens2015-05-041-1/+38
| | | | | | | | | | | | | | | | | | | | | 3654 zdb should print number of ganged blocks 3656 remove unused function zap_cursor_move_to_key() Reviewed by: George Wilson <[email protected]> Reviewed by: Christopher Siden <[email protected]> Reviewed by: Dan McDonald <[email protected]> Approved by: Garrett D'Amore <[email protected]> References: https://www.illumos.org/issues/3654 https://www.illumos.org/issues/3656 https://github.com/illumos/illumos-gate/commit/d5ee8a1 Porting Notes: 3655 and 3657 were part of this commit but those hunks were dropped since they apply to mdb. Ported by: Brian Behlendorf <[email protected]>
* Illumos 5314 - Remove "dbuf phys" db->db_data pointer aliases in ZFSJustin T. Gibbs2015-04-281-2/+2
| | | | | | | | | | | | | | | | 5314 Remove "dbuf phys" db->db_data pointer aliases in ZFS Author: Justin T. Gibbs <[email protected]> Reviewed by: Andriy Gapon <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Will Andrews <[email protected]> Approved by: Dan McDonald <[email protected]> References: https://www.illumos.org/issues/5314 https://github.com/illumos/illumos-gate/commit/c137962 Ported-by: Chris Dunlop <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* Illumos 5134 - if ZFS_DEBUG or debug= is set, libzpool should enable debug ↵Matthew Ahrens2015-04-282-0/+4
| | | | | | | | | | | | | | | | | | | | | | prints 5134 if ZFS_DEBUG or debug= is set, libzpool should enable debug prints Reviewed by: Adam Leventhal <[email protected]> Reviewed by: Christopher Siden <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Saso Kiselkov <[email protected]> Approved by: Dan McDonald <[email protected]> References: https://www.illumos.org/projects/illumos-gate/issues/5134 https://github.com/illumos/illumos-gate/commit/7fa49ea Porting notes: Added dprintf_setup() to main in zfs_main.c and zpool_main.c. Ported by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2669
* Combine data-notify.sh with io-notify.shChris Dunlap2015-04-272-51/+16
| | | | | | | | | | | | | | | | | | The data-notify.sh ZEDLET serves a very similar purpose to io-notify.sh, namely, to generate a notification in response to a particular error event. Initially, data-notify.sh was separated from io-notify.sh since the "data" zevent does not (as I understand it) pertain to a specific vdev device. This stands in contrast to the "checksum" and "io" zevents (both handled by io-notify.sh) that can be attributed to a specific vdev. At the time, it seemed simpler to handle these two cases in separate scripts. This commit adds support for the "data" zevent to io-notify.sh, and symlinks io-notify.sh to data-notify.sh. It also adds the counts for vdev_read_errors, vdev_write_errors, and vdev_cksum_errors to the notification message. Signed-off-by: Chris Dunlap <[email protected]>
* Add notification to io-spare.shChris Dunlap2015-04-271-4/+52
| | | | | | | | | | | The io-spare.sh ZEDLET does not generate a notification when a failing device is replaced with a hot spare. Maybe it should tell someone. This commit adds a notification message to the io-spare.sh ZEDLET. This notification is triggered when a failing device is successfully replaced with a hot spare after encountering a checksum or io error. Signed-off-by: Chris Dunlap <[email protected]>
* Add support for Pushbullet notificationsChris Dunlap2015-04-273-1/+112
| | | | | | | | | | | | | | | | | | | | | | | This commit adds the zed_notify_pushbullet() function and hooks it into zed_notify(), thereby integrating it with the existing "notify" ZEDLETs. This enables ZED to push notifications to your desktop computer and/or mobile device(s). It is configured with the ZED_PUSHBULLET_ACCESS_TOKEN and ZED_PUSHBULLET_CHANNEL_TAG variables in zed.rc. https://www.pushbullet.com/ The Makefile install-data-local target has been replaced with install-data-hook. With the "-local" target, there is no particular guarantee of execution order. But with the zed.rc now potentially containing sensitive information (i.e., the Pushbullet access token), the recommended permissions have changed to 0600. The "-hook" target is always executed after the main rule's work is done; thus, the chmod will always take place after the zed.rc file has been installed. https://www.gnu.org/software/automake/manual/automake.html#Extending Signed-off-by: Chris Dunlap <[email protected]>
* Replace "email" ZEDLETs with "notify" ZEDLETsChris Dunlap2015-04-2715-258/+311
| | | | | | | | | | | | | | | | | | | | | | | | | Several ZEDLETs already exist for sending email in reponse to a particular zevent. While email is ubiquitous, alternative methods may be better suited for some configurations. Instead of duplicating the "email" ZEDLETs for every future notification method, it is preferable to abstract the notification method into a function. This has the added benefit of reducing the amount of code duplicated between ZEDLETs, and allowing related bugs to be fixed in a single location. This commit replaces the existing "email" ZEDLETs with corresponding "notify" ZEDLETs. In addition, the ZEDLET code for sending an email message has been moved into the zed_notify_email() function. And this zed_notify_email() has been added to a generic zed_notify() function for sending notifications via all available methods that have been configured. This commit also changes a couple of related zed.rc variables. ZED_EMAIL_INTERVAL_SECS is changed to ZED_NOTIFY_INTERVAL_SECS, and ZED_EMAIL_VERBOSE is changed to ZED_NOTIFY_VERBOSE. Note that ZED_EMAIL remains unchanged as its use is solely for the email notification method. Signed-off-by: Chris Dunlap <[email protected]>
* Cleanup ZEDLETsChris Dunlap2015-04-2711-337/+630
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit factors out several common ZEDLET code blocks into zed-functions.sh. This shortens the length of the scripts, thereby (hopefully) making them easier to understand and maintain. In addition, this commit revamps the coding style used by the scripts to be more consistent and (again, hopefully) maintainable. It now mostly follows the Google Shell Style Guide. I've tried to assimilate the following resources: Google Shell Style Guide https://google-styleguide.googlecode.com/svn/trunk/shell.xml Dash as /bin/sh https://wiki.ubuntu.com/DashAsBinSh Filenames and Pathnames in Shell: How to do it Correctly http://www.dwheeler.com/essays/filenames-in-shell.html Common shell script mistakes http://www.pixelbeat.org/programming/shell_script_mistakes.html Finally, this commit updates the exit codes used by the ZEDLETs to be more consistent with one another. All scripts run cleanly through ShellCheck <http://www.shellcheck.net/>. All scripts have been tested on bash and dash. Signed-off-by: Chris Dunlap <[email protected]>
* Memory leak in make_root_vdev()Isaac Huang2015-04-271-1/+3
| | | | | | | | | The newroot nvlist should be freed before returning. Signed-off-by: Isaac Huang <[email protected]> Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3264
* 5410 Document -S option to zfs inheritPaul B. Henson2015-04-241-1/+5
| | | | | | | | | | | | | | | 5410 Document -S option to zfs inherit 5412 Mention -S option when zfs inherit fails on quota Reviewed by: Matthew Ahrens <[email protected]> Approved by: Richard Lowe <[email protected]> References: https://www.illumos.org/issues/5410 https://github.com/illumos/illumos-gate/commit/5ff8cfa9 Ported-by: DHE <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3279
* Fix io-spare.sh to work with disk vdevsChris Dunlap2015-04-171-1/+1
| | | | | | | | | | | | | | | | | | The "zpool status" output shows the full pathname for file-type vdevs, but only the basename component for disk-type vdevs. In commit bee6665, the "basename" command was dropped from altering the vdev name used when searching the "zpool status" output. Consequently, hot-disk sparing for disk vdevs broke since "zpool status" output was now being searched for the full pathname to the disk vdev. Parsing the "zpool status" output in this manner is rather brittle. It would be preferable to search for the vdev based on its guid. But until that happens, this commit adds back the "basename" command to fix the vdev name breakage. Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3310
* Illumos 5695 - dmu_sync'ed holes do not retain birth timePrakash Surya2015-03-271-1/+3
| | | | | | | | | | | | | | | | | 5695 dmu_sync'ed holes do not retain birth time Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Christopher Siden <[email protected]> Reviewed by: Bayard Bell <[email protected]> Approved by: Dan McDonald <[email protected]> References: https://www.illumos.org/issues/5695 https://github.com/illumos/illumos-gate/commit/70163ac Ported-by: Chris Dunlop <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3229
* zpool import should honor overlay propertyNed Bass2015-03-271-14/+0
| | | | | | | | | | | | Make the 'zpool import' command honor the overlay property to allow filesystems to be mounted on a non-empty directory. As it stands now this property is only checked by the 'zfs mount' command. Move the check into 'zfs_mount()` in libzpool so the property is honored for all callers. Signed-off-by: Ned Bass <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3227
* Check all vdev labels in 'zpool import'Brian Behlendorf2015-03-252-2/+2
| | | | | | | | | | | | | | | | | | When using 'zpool import' to scan for available pools prefer vdev names which reference vdevs with more valid labels. There should be two labels at the start of the device and two labels at the end of the device. If labels are missing then the device has been damaged or is in some other way incomplete. Preferring names with fully intact labels helps weed out bad paths and improves the likelihood of being able to import the pool. This behavior only applies when scanning /dev/ for valid pools. If a cache file exists the pools described by the cache file will be used. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Chris Dunlap <[email protected]> Closes #3145 Closes #2844 Closes #3107
* Install arc_summary.pyTurbo Fredriksson2015-03-031-0/+1
| | | | | | | | | Add the arc_summary Makefile to the build system so the script is properly included in the distribution tarball and installed. Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3147
* Avoid dladdr() in ztestTim Chase2015-02-271-44/+39
| | | | | | | | | Under Linux, at least, dladdr() doesn't reliably work for functions which aren't in a DSO. Add the function name to ztest_info[]. Signed-off-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3130
* Enhancements to zpool dry run mode.Tim Chase2015-02-111-0/+28
| | | | | | | | | | In dry run mode, zpool should display more of the proposed pool configuration for "zpool add". This commit adds support for displaying cache devices. Signed-off-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #1106
* Fix build error when make debChunwei Chen2015-02-061-0/+1
| | | | | | | | | | | | | After 53698a4, the following error occurs when make deb. CCLD zed ../../lib/libzfs/.libs/libzfs.so: undefined reference to `get_system_hostid' Add libzpool.la to zed/Makefile.am to fix this Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3080
* Read spl_hostid module parameter before gethostid()Chunwei Chen2015-02-041-1/+1
| | | | | | | | | | If spl_hostid is set via module parameter, it's likely different from gethostid(). Therefore, the userspace tool should read it first before falling back to gethostid(). Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3034
* Cleanup _zed_event_add_nvpair()Chris Dunlap2015-01-301-232/+263
| | | | | | | | | | | | | | | | | | When _zed_event_add_var() was updated to be the common routine for adding zedlet environment variables, an additional snprintf() was added to the processing of each nvpair. This commit changes _zed_event_add_nvpair() to directly call _zed_event_add_var() for nvpair non-array types, thereby removing a superfluous call to snprintf(). For consistency, the helper functions for converting nvpair array types are similarly adjusted to add variables. The _zed_event_value_is_hex() and _zed_event_add_var() functions have been moved up in the file since forward declarations are not used, but no changes have been made to these functions. Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3042
* Protect against adding duplicate strings in ZEDChris Dunlap2015-01-304-151/+243
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The zed_strings container stores strings in an AVL, but does not check for duplicate strings being added. Within the AVL, strings are indexed by the string value itself. avl_add() requires the node being added must not already exist in the tree, and will assert() if this is not the case. This should not cause problems in practice. ZED uses this container in two places. In zed_conf.c, it is used to store the names of enabled zedlets as zed scans the zedlet directory listing; duplicate entries cannot occur here since duplicate names cannot occur within a directory. In zed_event.c, it is used to store the environment variables (as "NAME=VALUE" strings) that will be passed to zedlets; duplicate strings here should never happen unless there is a bug resulting in a duplicate nvpair or environment variable. This commit protects against adding a duplicate to a zed_strings container by first checking for the string being added, and removing the previous entry should one exist. This implements a "last one wins" policy. This commit also changes the prototype for zed_strings_add() to allow the string key (by which it is indexed in the AVL) to differ from the string value. By adding zedlet environment variables using the variable name as the key, multiple adds for the same variable name will result in only the last value being stored. Finally, this commit routes all additions of zedlet environment variables through the updated _zed_event_add_var(). This ensures all zedlet environment variable names are properly converted. Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3042
* Replace sysctl summary with tunables summary.Kyle Blatter2015-01-281-66/+57
| | | | | | | | | | | The original script displayed tunable parameters using sysctl calls. This patch modifies this by displaying tunable parameters found in /sys/modules/zfs/parameters/. modinfo calls are used to capture descriptions. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Kyle Blatter <[email protected]> Signed-off-by: Ned Bass <[email protected]>
* Force all lines to be 80 columnsKyle Blatter2015-01-281-33/+66
| | | | | | | | | Ensure this script conforms to the projects style guidelines by limiting line length to 80 columns. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Kyle Blatter <[email protected]> Signed-off-by: Ned Bass <[email protected]>
* Add a help option with usage informationKyle Blatter2015-01-281-4/+25
| | | | | | | | | | Add a basic help option and usage description which is consistent with arcstat.py and dbufstat.py. This also adds support for long opts. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Kyle Blatter <[email protected]> Signed-off-by: Ned Bass <[email protected]>
* Refactor arc_summary to simplify -p processingKyle Blatter2015-01-281-23/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The -p option is used to specify a specific page of output to be displayed. If omitted, all output pages would be displayed. arc_summary, as it stood, had really kludgy processing code for processing the -p option. It relied on a try-except block which was treated as an if statement and in normal operation would fail any time a user didn't specify the -p option on the command line. When the exception was thrown, the script would then display all output pages. This happened whether the -p option was omitted or malformed. Thus, in the principle use case, an exception would be raised in order to run the script as desired. The same except code would be called regardless of the exception, however, and malformed -p arguments would also cause the script to execute. Additionally, this required the function which handles the case where all output pages were to be displayed, _call_all, to be potentially called from several locations within main. This commit refactors the option processing code to simplify it and make it easier to catch runtime errors in the script. This is done by specializing the try-except block to only have an exception when the -p argument is malformed. When the -p option is correctly selected by the user, it calls a function in the unSub array directly, which will only display one page of output. Finally in the context of this refactoring the page breaks have been removed. Pages seem to have been added into the output in the FreeNAS version of the script. This patch removes pages from the output to more closely resemble the freebsd version of the script. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Kyle Blatter <[email protected]> Signed-off-by: Ned Bass <[email protected]>
* Modified arc_summary.py to run on linuxcburroughs2015-01-281-287/+24
| | | | | | | | | | | | | 1) Comment out stat sections whose kstats are not currently available 2) Port most of arc_summary to use spl kstats 3) Enable l2arc stats 5) Include compressed l2size 4) Minor style fixes / cleanup Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: cburroughs <[email protected]> Signed-off-by: Kyle Blatter <[email protected]> Signed-off-by: Ned Bass <[email protected]>
* Add arc_summary.py from FreeNAScburroughs2015-01-282-0/+1378
| | | | | | | | | | | | | | | | | | | | | | | | | | The arc_summary script is a useful utility for administrators on other ZFS platforms. It provides a quick and easy way to get a high level view of the current ARC state. Historically this was a perl script but it was rewritten in python for FreeNAS. We've decided to adopt the python version instead of the perl version for a few reasons. 1) ZoL has no existing perl dependencies, but it does have a python dependency for scripts such as arcstat.py and dbufstat.py. Using python for arc_summary.py helps us minimize dependencies. 2) Most major Linux distributions already depend heavily on python for their core infrastructure. This means it's very likely to be available even very early in the boot process. Original source: https://github.com/freenas/freenas/blob/master/gui/tools/arc_summary.py Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: cburroughs <[email protected]> Signed-off-by: Kyle Blatter <[email protected]> Signed-off-by: Ned Bass <[email protected]>
* vdev_id: use mawk-compatible regular expressionNed Bass2014-12-191-1/+1
| | | | | | | | | | | | | Slot mapping in vdev_id doesn't work on systems using mawk as the 'awk' alternative. A regular expression in map_slot() contains an unquoted empty string following the alternation (|) operator, which results in an "missing operand" error with mawk. The solution is to rearrange the expression so the alternation has two operands. Signed-off-by: Ned Bass <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes zfsonlinux/pkg-zfs#136 Closes zfsonlinux/zfs#2965
* Fix cstyle issue from c66989bBrian Behlendorf2014-12-191-2/+2
| | | | | | | Commit c66989b accidentally introduced a cstyle issue which went unnoticed. This tiny patch corrects that oversight. Signed-off-by: Brian Behlendorf <[email protected]>
* zpool upgrade return errors to stderr instead of stdoutJacek Fefliński2014-12-181-2/+2
| | | | | | Signed-off-by: Jacek Feflinski <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2955
* Print header properly when terminal resizesIsaac Huang2014-11-141-6/+15
| | | | | | | | | Added a handler for SIGWINCH, so that one header is printed per screen even when the terminal resizes. Signed-off-by: Isaac Huang <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2847
* Fix inaccurate field descriptionsIsaac Huang2014-11-141-5/+5
| | | | | | | | | | The field descriptions from arcstat.py -v for the demand accesses are inaccurate. They all begin with "Demand Data" yet the fields actually covered both demand data and demand meta-data accesses. Signed-off-by: Isaac Huang <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2842
* Improve zvol symlink handling.Dan Swartzendruber2014-11-061-0/+8
| | | | | | | | | | | | | | | | Change the zvol helper program to replace any embedded spaces in the pool or dataset names with '+' to ensure we have valid symlinks. The '+' character was choosen because it is not a valid character for a dataset name but it is allowed by udev. This ensures that all dataset names with an embedded space will be translated to a unique /dev/zvol/ symlink. Signed-off-by: Dan Swartzendruber <[email protected]> Signed-off-by: Darik Horn <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2834
* Make directory into which mount.zfs is installed configurableRichard Yao2014-10-281-1/+1
| | | | | | | | | | | Installing outside of the prefix is not permissible under Gentoo Prefix. The package manager will cause the installation process to fail if/when it sees this. I could script a workaround inside the ebuild, but it seemed to make more sense to make this more configurable. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2641
* Illumos 5164-5165 - space map fixesMatthew Ahrens2014-10-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 5164 space_map_max_blksz causes panic, does not work 5165 zdb fails assertion when run on pool with recently-enabled space map_histogram feature Reviewed by: Christopher Siden <[email protected]> Reviewed by: George Wilson <[email protected]> Reviewed by: Saso Kiselkov <[email protected]> Approved by: Dan McDonald <[email protected]> References: https://www.illumos.org/issues/5164 https://www.illumos.org/issues/5165 https://github.com/illumos/illumos-gate/commit/b1be289 Porting Notes: The metaslab_fragmentation() hunk was dropped from this patch because it was already resolved by commit 8b0a084. The comment modified in metaslab.c was updated to use the correct variable name, space_map_blksz. The upstream commit incorrectly used space_map_blksize. Ported by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2697