xfs
[Top] [All Lists]

Re: [RFC 11/32] xfs: convert to struct inode_time

To: "H. Peter Anvin" <hpa@xxxxxxxxx>
Subject: Re: [RFC 11/32] xfs: convert to struct inode_time
From: Theodore Ts'o <tytso@xxxxxxx>
Date: Mon, 2 Jun 2014 18:29:54 -0400
Cc: Chuck Lever <chuck.lever@xxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Nicolas Pitre <nicolas.pitre@xxxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx>, LKML Kernel <linux-kernel@xxxxxxxxxxxxxxx>, linux-arch@xxxxxxxxxxxxxxx, joseph@xxxxxxxxxxxxxxxx, john.stultz@xxxxxxxxxx, Christoph Hellwig <hch@xxxxxxxxxxxxx>, tglx@xxxxxxxxxxxxx, geert@xxxxxxxxxxxxxx, lftan@xxxxxxxxxx, linux-fsdevel <linux-fsdevel@xxxxxxxxxxxxxxx>, xfs@xxxxxxxxxxx, Linux NFS Mailing List <linux-nfs@xxxxxxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=thunk.org; s=ef5046eb; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=0T9a35mm5XUD9Vbom7uySJgsvp5GUEUECVW/aGhcHSA=; b=Ar1jCBkhCcftKHJqkpj/87WevcX9d1XjloI0qDFmjRSB3k4lV+vP2+W+gcJC8SL/cdWHbGXsh7XuaHsu9eZNF1ml9/7w6d9AwG1mcS0QxHZrBf+PAtYXS753yOgckXYKBTWS90fmsdnScyjuVueNJLT4VGayD01u/iclxUOSZq0=;
In-reply-to: <538CB085.5000502@xxxxxxxxx>
Mail-followup-to: Theodore Ts'o <tytso@xxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, Chuck Lever <chuck.lever@xxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Nicolas Pitre <nicolas.pitre@xxxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx>, LKML Kernel <linux-kernel@xxxxxxxxxxxxxxx>, linux-arch@xxxxxxxxxxxxxxx, joseph@xxxxxxxxxxxxxxxx, john.stultz@xxxxxxxxxx, Christoph Hellwig <hch@xxxxxxxxxxxxx>, tglx@xxxxxxxxxxxxx, geert@xxxxxxxxxxxxxx, lftan@xxxxxxxxxx, linux-fsdevel <linux-fsdevel@xxxxxxxxxxxxxxx>, xfs@xxxxxxxxxxx, Linux NFS Mailing List <linux-nfs@xxxxxxxxxxxxxxx>
References: <1401480116-1973111-1-git-send-email-arnd@xxxxxxxx> <8618458.1EVJCoVbkH@wuerfel> <alpine.LFD.2.11.1406012121430.17310@xxxxxxxxxxx> <4178301.j9kWdGCRLC@wuerfel> <6868F108-F0B2-423F-AE31-90DF86A5B7DD@xxxxxxxxxx> <20140602153124.GH30598@xxxxxxxxx> <538CB085.5000502@xxxxxxxxx>
User-agent: Mutt/1.5.23 (2014-03-12)
On Mon, Jun 02, 2014 at 10:12:37AM -0700, H. Peter Anvin wrote:
> > It would be problematic for time(2) or gettimeofday(2) to return
> > TIME_UNDEFINED, since there are programs that care about time ticking
> > forward, but I could imagine a new interface which would be permitted
> > to return a flag indicating that we don't know the current time
> > (because the CMOS battery had run down, etc.) so instead we're going
> > to be counting the number of seconds since the system was booted.
> 
> This assumes that we actually know that that is the case, which may be
> an aggressive assumption.

We won't know if the RTC clock is wrong, true --- but the kernel will
know if (a) the hardware doesn't have RTC clock at all, or if (b) the
RTC clock is ticking some time that can't be encoded using the current
time_t type.  So in that case, the fallback would be to be for the
kernel to tick starting with time_t == 0 when the system is initially
booted, and the "time indefinite flag" would be set.

Now assume that we have a new system call, gettimestampofday(2), which
returns a new timestamp structure which has a 64-bit ts_sec field, the
ts_nsec field (ala struct timespec), and a ts_flags field, where the
kernel could signal things like "time invalid", or "time can't be
encoded in the legacy time_t type", or "I'm not sure if the time is
correct" --- i.e., because the RTC battery isn't working.

Not all hardware might be able to support the last, of course, but if
the battery is low, or the system has been exposed to very low
temperatures (or large amounts of cosmic radiation, etc.)  the RTC
time may just be plain wrong.  No system is going to be perfect, but
it should be possible to make htings better, at for certain classes of
hardware.

And since we are already returning (time_t) -1 in some cases, we might
as well try to make things a bit more formal.

                                        - Ted

<Prev in Thread] Current Thread [Next in Thread>