From owner-svn-src-stable-10@FreeBSD.ORG Tue Sep 23 21:38:06 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ECEFA446; Tue, 23 Sep 2014 21:38:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC22AC83; Tue, 23 Sep 2014 21:38:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8NLc6gi029489; Tue, 23 Sep 2014 21:38:06 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8NLc5va029484; Tue, 23 Sep 2014 21:38:05 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201409232138.s8NLc5va029484@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Tue, 23 Sep 2014 21:38:05 +0000 (UTC) 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 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Sep 2014 21:38:07 -0000 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 \n"); fprintf(stderr, " start learn - start a BBU relearn\n"); fprintf(stderr, " bbu - 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");