From owner-freebsd-stable@FreeBSD.ORG Tue Feb 16 20:05:18 2010 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E1E91065672 for ; Tue, 16 Feb 2010 20:05:18 +0000 (UTC) (envelope-from peterjeremy@acm.org) Received: from mail35.syd.optusnet.com.au (mail35.syd.optusnet.com.au [211.29.133.51]) by mx1.freebsd.org (Postfix) with ESMTP id 890FB8FC08 for ; Tue, 16 Feb 2010 20:05:17 +0000 (UTC) Received: from server.vk2pj.dyndns.org (c122-106-232-148.belrs3.nsw.optusnet.com.au [122.106.232.148]) by mail35.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o1GK5D8c021797 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 17 Feb 2010 07:05:15 +1100 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.3/8.14.3) with ESMTP id o1GK5Buc096238; Wed, 17 Feb 2010 07:05:12 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.3/8.14.3/Submit) id o1GK5BN0096237; Wed, 17 Feb 2010 07:05:11 +1100 (EST) (envelope-from peter) Date: Wed, 17 Feb 2010 07:05:11 +1100 From: Peter Jeremy To: Jeremy Chadwick Message-ID: <20100216200511.GA95812@server.vk2pj.dyndns.org> References: <20100215090756.GA54764@icarus.home.lan> <20100215105000.101326yj01j0f64g@webmail.leidinger.net> <20100215122744.GA57382@icarus.home.lan> <20100215161105.14071eiflhc9le68@webmail.leidinger.net> <4B79BA9C.3020402@quip.cz> <4B7AD0A3.9080701@barryp.org> <20100216175946.GA98082@icarus.home.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="T4sUOijqQbZv57TR" Content-Disposition: inline In-Reply-To: <20100216175946.GA98082@icarus.home.lan> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-stable@freebsd.org Subject: Re: ZFS tuning [was: hardware for home use large storage] X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2010 20:05:18 -0000 --T4sUOijqQbZv57TR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2010-Feb-16 09:59:46 -0800, Jeremy Chadwick w= rote: >On Tue, Feb 16, 2010 at 11:06:43AM -0600, Barry Pederson wrote: >> maybe something like this tacked on the end of the script (excuse my >> Perl, I'm a Python guy). >>=20 >> ---- >> #### Loader Settings ############# >> open(LOADER, '/boot/loader.conf'); >> print "\n/boot/loader.conf settings:\n"; >> while (){ >> chomp; >> if (/^\s*(zfs|vfs\.zfs|vm\.kmem)/){ >> print "\t$_\n"; >> } >> } >> ---- > >Major problems with the above code: > >1) Opens /boot/loader.conf for rw access; should be read-only Wrong. It opens /boot/loader.conf read-only, as it should. >2) Makes the assumption /boot/loader.conf exists Accepted but it was offered as a proof-of-concept. >3) Does not close the fd This is hardly a "major problem" in a short once-through script. >4) Excessively quotes variables for no justified reason If you mean including the $_ inside "", this is a standard perl idiom. >5) Makes some bad assumptions about the contents of the file (ex. > comments with the word "zfs" in them would match) Wrong. It only matches "zfs" as the first non-blank text on a line - which means it can't be a comment. So that's one real deficiency in a proof-of-concept script written by someone who does not claim to be comfortable with perl. >The code should really be something like what's below. This should >be much more manageable as well (@tunables that is), although I always >worry when using grep()... Whilst we are picking nits, your script has the following issues: - unnecessary trailing wildcard matches in the regexps - "grep" misused as "map" - "die" is probably not appropriate for embedding into another script - No useful error message if /boot/loader.conf can't be opened. - Doesn't correctly handle optional whitespace around "=3D" - No heading to explain what is being reported. - Doesn't allow for "zfs" as a top-level identifier Overall, Barry's script makes an excellent proof-of-concept - which is what he was offering. --=20 Peter Jeremy --T4sUOijqQbZv57TR Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkt6+ncACgkQ/opHv/APuIe16gCfWqYstXAOODj2df8aMU3Zjxar qrQAoIu2f6tpKPIuXzcH845+L1iUnJSF =uJH4 -----END PGP SIGNATURE----- --T4sUOijqQbZv57TR--