Date: Tue, 23 Sep 2014 21:38:05 +0000 (UTC) From: Steven Hartland <smh@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r272041 - stable/10/usr.sbin/mfiutil Message-ID: <201409232138.s8NLc5va029484@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: smh Date: Tue Sep 23 21:38:05 2014 New Revision: 272041 URL: http://svnweb.freebsd.org/changeset/base/272041 Log: MFC r271429, r271882: Add support for controlling mfi(4) controller properties Approved by: re (glebius) Sponsored by: Multiplay Added: stable/10/usr.sbin/mfiutil/mfi_properties.c - copied, changed from r257820, head/usr.sbin/mfiutil/mfi_properties.c Modified: stable/10/usr.sbin/mfiutil/Makefile stable/10/usr.sbin/mfiutil/mfiutil.8 stable/10/usr.sbin/mfiutil/mfiutil.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/mfiutil/Makefile ============================================================================== --- stable/10/usr.sbin/mfiutil/Makefile Tue Sep 23 20:35:48 2014 (r272040) +++ stable/10/usr.sbin/mfiutil/Makefile Tue Sep 23 21:38:05 2014 (r272041) @@ -2,7 +2,8 @@ PROG= mfiutil SRCS= mfiutil.c mfi_bbu.c mfi_cmd.c mfi_config.c mfi_drive.c mfi_evt.c \ - mfi_flash.c mfi_patrol.c mfi_show.c mfi_volume.c mfi_foreign.c + mfi_flash.c mfi_patrol.c mfi_show.c mfi_volume.c mfi_foreign.c \ + mfi_properties.c MAN8= mfiutil.8 CFLAGS.gcc+= -fno-builtin-strftime Copied and modified: stable/10/usr.sbin/mfiutil/mfi_properties.c (from r257820, head/usr.sbin/mfiutil/mfi_properties.c) ============================================================================== --- head/usr.sbin/mfiutil/mfi_properties.c Thu Nov 7 21:47:59 2013 (r257820, copy source) +++ stable/10/usr.sbin/mfiutil/mfi_properties.c Tue Sep 23 21:38:05 2014 (r272041) @@ -68,7 +68,7 @@ mfi_ctrl_set_properties(int fd, struct m static int mfi_ctrl_rebuild_rate(int ac, char **av) { - int error, fd; + int error, fd; struct mfi_ctrl_props ctrl_props; if (ac > 2) { @@ -76,40 +76,40 @@ mfi_ctrl_rebuild_rate(int ac, char **av) return(-1); } - fd = mfi_open(mfi_unit, O_RDWR); - if (fd < 0) { - error = errno; - warn("mfi_open"); - return (error); - } + fd = mfi_open(mfi_unit, O_RDWR); + if (fd < 0) { + error = errno; + warn("mfi_open"); + return (error); + } error = mfi_ctrl_get_properties(fd, &ctrl_props); - if ( error < 0) { - error = errno; - warn("Failed to get controller properties"); - close(fd); - return (error); - } + if ( error < 0) { + error = errno; + warn("Failed to get controller properties"); + close(fd); + return (error); + } /* * User requested a change to the rebuild rate */ if (ac > 1) { ctrl_props.rebuild_rate = atoi(av[ac - 1]); error = mfi_ctrl_set_properties(fd, &ctrl_props); - if ( error < 0) { - error = errno; - warn("Failed to set controller properties"); - close(fd); - return (error); - } + if ( error < 0) { + error = errno; + warn("Failed to set controller properties"); + close(fd); + return (error); + } error = mfi_ctrl_get_properties(fd, &ctrl_props); - if ( error < 0) { - error = errno; - warn("Failed to get controller properties"); - close(fd); - return (error); - } + if ( error < 0) { + error = errno; + warn("Failed to get controller properties"); + close(fd); + return (error); + } } printf ("controller rebuild rate: %%%u \n", ctrl_props.rebuild_rate); @@ -120,7 +120,7 @@ MFI_COMMAND(ctrlprop, rebuild, mfi_ctrl_ static int mfi_ctrl_alarm_enable(int ac, char **av) { - int error, fd; + int error, fd; struct mfi_ctrl_props ctrl_props; if (ac > 2) { @@ -128,40 +128,40 @@ mfi_ctrl_alarm_enable(int ac, char **av) return(-1); } - fd = mfi_open(mfi_unit, O_RDWR); - if (fd < 0) { - error = errno; - warn("mfi_open"); - return (error); - } + fd = mfi_open(mfi_unit, O_RDWR); + if (fd < 0) { + error = errno; + warn("mfi_open"); + return (error); + } error = mfi_ctrl_get_properties(fd, &ctrl_props); - if ( error < 0) { - error = errno; - warn("Failed to get controller properties"); - close(fd); - return (error); - } + if ( error < 0) { + error = errno; + warn("Failed to get controller properties"); + close(fd); + return (error); + } printf ("controller alarm was : %s\n", (ctrl_props.alarm_enable ? "enabled" : "disabled")); if (ac > 1) { ctrl_props.alarm_enable = atoi(av[ac - 1]); error = mfi_ctrl_set_properties(fd, &ctrl_props); - if ( error < 0) { - error = errno; - warn("Failed to set controller properties"); - close(fd); - return (error); - } + if ( error < 0) { + error = errno; + warn("Failed to set controller properties"); + close(fd); + return (error); + } error = mfi_ctrl_get_properties(fd, &ctrl_props); - if ( error < 0) { - error = errno; - warn("Failed to get controller properties"); - close(fd); - return (error); - } + if ( error < 0) { + error = errno; + warn("Failed to get controller properties"); + close(fd); + return (error); + } } printf ("controller alarm was : %s\n", (ctrl_props.alarm_enable ? "enabled" : "disabled")); Modified: stable/10/usr.sbin/mfiutil/mfiutil.8 ============================================================================== --- stable/10/usr.sbin/mfiutil/mfiutil.8 Tue Sep 23 20:35:48 2014 (r272040) +++ stable/10/usr.sbin/mfiutil/mfiutil.8 Tue Sep 23 21:38:05 2014 (r272041) @@ -168,6 +168,12 @@ .Nm .Op Fl u Ar unit .Cm bbu Ar setting Ar value +.Nm +.Op Fl u Ar unit +.Cm ctrlprop Ar rebuild Op Ar rate +.Nm +.Op Fl u Ar unit +.Cm ctrlprop Ar alarm Op Ar 0/1 .Sh DESCRIPTION The .Nm @@ -659,6 +665,12 @@ inclusive. Modes 1, 2 and 3 enable a transparent learn cycle, whereas modes 4 and 5 do not. The BBU's data retention time is greater when transparent learning is not used. .El +.It Cm ctrlprop Ar rebuild Op Ar rate +With no arguments display the rate of rebuild (percentage)a for volumes. +With an integer argument (0-100), set that value as the new rebuild rate for volumes. +.It Cm ctrlprop Ar alarm Op Ar 0/1 +With no arguments display the current alarm enable/disable status. +With a 0, disable alarms. With a 1, enable alarms. .El .Sh EXAMPLES Configure the cache for volume mfid0 to cache only writes: @@ -699,6 +711,10 @@ patrol read starting in 5 minutes: Display the second detected foreign configuration: .Pp .Dl Nm Cm show foreign 1 +.Pp +Set the current rebuild rate for volumes to 40%: +.Dl Nm Cm ctrlprop rebuild 40 +.Pp .Sh SEE ALSO .Xr mfi 4 .Sh HISTORY Modified: stable/10/usr.sbin/mfiutil/mfiutil.c ============================================================================== --- stable/10/usr.sbin/mfiutil/mfiutil.c Tue Sep 23 20:35:48 2014 (r272040) +++ stable/10/usr.sbin/mfiutil/mfiutil.c Tue Sep 23 21:38:05 2014 (r272041) @@ -93,6 +93,8 @@ usage(void) fprintf(stderr, " flash <firmware>\n"); fprintf(stderr, " start learn - start a BBU relearn\n"); fprintf(stderr, " bbu <setting> <value> - set BBU properties\n"); + fprintf(stderr, " ctrlprop rebuild [rate] - get/set the volume rebuild rate\n"); + fprintf(stderr, " ctrlprop alarm [0/1] - enable/disable controller alarms\n"); #ifdef DEBUG fprintf(stderr, " debug - debug 'show config'\n"); fprintf(stderr, " dump - display 'saved' config\n");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409232138.s8NLc5va029484>