From owner-freebsd-fs@FreeBSD.ORG Tue Jun 15 07:53:39 2010 Return-Path: Delivered-To: fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A05D81065676 for ; Tue, 15 Jun 2010 07:53:39 +0000 (UTC) (envelope-from alexander@leidinger.net) Received: from mail.ebusiness-leidinger.de (mail.ebusiness-leidinger.de [217.11.53.44]) by mx1.freebsd.org (Postfix) with ESMTP id 30C038FC2D for ; Tue, 15 Jun 2010 07:53:38 +0000 (UTC) Received: from outgoing.leidinger.net (pD954FFFD.dip.t-dialin.net [217.84.255.253]) by mail.ebusiness-leidinger.de (Postfix) with ESMTPSA id 551C184405C; Tue, 15 Jun 2010 09:53:34 +0200 (CEST) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id 3351A5562; Tue, 15 Jun 2010 09:53:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=Leidinger.net; s=outgoing-alex; t=1276588411; bh=JJ9yoxs57KBQ8WSg75eOExej7vA8ElMFt22vdF+7wm4=; h=Message-ID:Date:From:To:Cc:Subject:References:In-Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding; b=w4MWHE3AB4YFkR71lJBREUenk1betU6+x6Abc0RC+bPm2y/N2q477b7123HHMmW+S d7udqVZcuw8b2tuy8F+4W9fUUx10BV+z/rJX6CO121/StIvxsZfucvtMlkmqao6+j1 32l4g6FeMAkzlHrzpTR6gtRwe7/Lvm87Xmy0sD+Rs/U311U5YMjzQkzFxkoJZWU6WD F2xybahdeebp2BAQcu+JoTNBEyQs/cRiy6f/z2B70g9bl0+iI4+znSdxjhGqc/wrFm noUw1MYPwzucFTXrxb6kvapl/L9hIPPrlj2qGoXntMVT/A4h6uGyGUhl9LCugGRxpQ kCvYaELYq7Iuw== Received: (from www@localhost) by webmail.leidinger.net (8.14.4/8.13.8/Submit) id o5F7rUdh011672; Tue, 15 Jun 2010 09:53:30 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Received: from pslux.ec.europa.eu (pslux.ec.europa.eu [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Tue, 15 Jun 2010 09:53:30 +0200 Message-ID: <20100615095330.89843jrd13kffdkw@webmail.leidinger.net> Date: Tue, 15 Jun 2010 09:53:30 +0200 From: Alexander Leidinger To: jhell References: <20100609162627.11355zjzwnf7nj8k@webmail.leidinger.net> <4C0FAE2A.7050103@dataix.net> <4C0FB1DE.9080508@dataix.net> <20100610115324.10161biomkjndvy8@webmail.leidinger.net> <20100610173825.164930ekkryr5tes@webmail.leidinger.net> <4C1138D0.7070901@dataix.net> <20100611104219.51344ag1ah7br4kk@webmail.leidinger.net> <4C137ACE.9080900@dataix.net> In-Reply-To: <4C137ACE.9080900@dataix.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Dynamic Internet Messaging Program (DIMP) H3 (1.1.4) X-EBL-MailScanner-Information: Please contact the ISP for more information X-EBL-MailScanner-ID: 551C184405C.A693E X-EBL-MailScanner: Found to be clean X-EBL-MailScanner-SpamCheck: not spam, spamhaus-ZEN, SpamAssassin (not cached, score=-1.023, required 6, autolearn=disabled, ALL_TRUSTED -1.00, DKIM_SIGNED 0.10, DKIM_VALID -0.10, DKIM_VALID_AU -0.10, TW_ZF 0.08) X-EBL-MailScanner-From: alexander@leidinger.net X-EBL-MailScanner-Watermark: 1277193216.95304@D+Z2CRnq1/W9p1apuzjCrQ X-EBL-Spam-Status: No Cc: fs@freebsd.org Subject: Re: Do we want a periodic script for a zfs scrub? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jun 2010 07:53:39 -0000 Quoting jhell (from Sat, 12 Jun 2010 08:17:18 -0400): > On 06/11/2010 04:42, Alexander Leidinger wrote: > : #!/bin/sh > : > : lastscrub=$(zpool history exports |grep scrub |tail -1 |cut -f1 -d.) > : todayjul=$(date -j -f "%Y-%m-%d" "+%j" $(date "+%Y-%m-%d")) > : scrubjul=$(date -j -f "%Y-%m-%d" "+%j" $lastscrub) > : > : echo $lastscrub Last Scrub From zpool history > : echo $todayjul Today converted to julian > : echo $scrubjul Last scrub converted to julian > : > : expired=$(($todayjul-$scrubjul)) >> >> Apart from the fact that we can do this with one $(( ))... what happens >> if/when time_t is extended to 64 bits on 32 bit platforms? Can we get >> into trouble with the shell-arithmetic or not? It depends upon the >> bit-size of the shell integers, and the signedness of them. Jilles (our >> shell maintainer) suggested also to use the seconds since epoch and I >> asked him the same question. I'm waiting for an answer from him. >> > > I do not think this would be a problem for the script as the script is > relying on date for the conversion except for the subtraction that is > taking place. > > If there was a problem then I would believe it would have to be > corrected in date(1) & possibly sh(1), I could be wrong though. The question is if the integer arithmetic in shell is supposed/allowed to handle 64bit unsigned integers on 32bit machines or not. > Another situation that had come to mind is when & certainly being > possible that the time on the system could drop to before the last scrub > has taken place causing (using the above script for example) todayjul to > be less than scrubjul and in that case would output a negative integer > that would skew results until the system time has been restored to its > correct & current date & time. I think there are more places which are screwed up when the time is not correct, so I will not say "hey, yeah! let's add some code for this" now (I see no problem if there is no scrub until the date of the machine is fixed). Bye, Alexander. -- Be sure to evaluate the bird-hand/bush ratio. http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137