Received: by 10.213.65.68 with SMTP id h4csp171040imn; Thu, 15 Mar 2018 13:06:06 -0700 (PDT) X-Google-Smtp-Source: AG47ELtqibbMGuyoUpWJLDoAmbgRj9QMyNViPbBpgmWxpbdJFd8qYslreuBwX41RRIw6GzQ/00vB X-Received: by 2002:a17:902:6884:: with SMTP id i4-v6mr6919172plk.259.1521144365925; Thu, 15 Mar 2018 13:06:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521144365; cv=none; d=google.com; s=arc-20160816; b=slYMDTCFUSf5Hrwv4wLxAIV+XhO5DG3bdwb+dQJk3YmPBTxpQFhN5qNuJXkZxuGObl IK8fyFS0eS00YA28OqiSmJjQfgC4VO2dSp1SFgTRrkBu+x6fWuD1ZnTnRIULGECXl3dx /jO5P5WKgrfQ1QHf4OPmzwUQfgqDmh98/D4CQhvhcPSUpXd7bYVdQ6bdGaX0QpwQzDRQ wcvdX9EHbHgupj7jiJfTqh/AcW9xCdm/dfafXrV/5XBFZZykbv9kitofnPKevM8jP0i4 3QV4krOm+S+uxMPNbvHFyPm/iK7zweqaTKckvj9Cy8jbb5C4dpx1PKBbccLgjq/kP1pX 4QnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:to:cc:in-reply-to:date:subject :mime-version:message-id:from:dkim-signature :arc-authentication-results; bh=XIIQTko6SpSGjPgDfSr03ixJio9jIqIG+QHtUOnizso=; b=sYpdb82xUqiN2SrRqLBqYPPE+g65ZCJs5wxVJreIDAGFyN718hzFAdARxsg0iGkZWG iboNzuSpeD32XKaR2N962zAQWBNF8htZmA8TeSW5rVtpH+A2yiwqnrwv475NxNBJACKe tpvX36SK5PftPtmF9WewfhBQ6boABcmWFXHqFReuLZzLwimKv58a6calM7tM4wdb4TD3 72Rym+NcHtxYoGoNXvFeRqvwiNQzUpUja/Ox3Ia4VEftxf0VEMOWRoOjBvbKfU7bFYut JUnO992Zom8Fme1UujxKpOTyOcO44uCM/lgFBpTeIvlVFyOyGg6rkZOjpyb1B0h06l0u Vzgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dilger-ca.20150623.gappssmtp.com header.s=20150623 header.b=z73FFlpu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h1si4244557pfn.266.2018.03.15.13.05.50; Thu, 15 Mar 2018 13:06:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@dilger-ca.20150623.gappssmtp.com header.s=20150623 header.b=z73FFlpu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752769AbeCOUE0 (ORCPT + 99 others); Thu, 15 Mar 2018 16:04:26 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:43232 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752655AbeCOUEY (ORCPT ); Thu, 15 Mar 2018 16:04:24 -0400 Received: by mail-pg0-f67.google.com with SMTP id e9so3176761pgs.10 for ; Thu, 15 Mar 2018 13:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dilger-ca.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=XIIQTko6SpSGjPgDfSr03ixJio9jIqIG+QHtUOnizso=; b=z73FFlpukzDwAabXDRJzLhTYhyU7X1gMFxJCUizjbkZ2XiagwG/Keuy+iImBS0Lna6 GjOI3/gaDCFnvcdMkMsb1OerrpUO2cD0/CWUQfLYavYOlpp/5qMvFXSgr3HZSrQPpJNx XzF5O0gevnxCIxsmfelf/d9TYzyDMUXDxwrhiYRXTjRvx+b6AMMetXvWV5FZhURDB++M mGO42Xh0f1c/HQIhyUFJ44KzOS4CqlvlyAXuq7Zvx2o8X4OnAyGm/VUP3aYtTBpWyzEk UYnvnqmrG39lZHWixLPfj8wTpDtZURGpi0V4pY3le4hjvhknlbpDOrp8ogHAIBFal9Ym lAoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=XIIQTko6SpSGjPgDfSr03ixJio9jIqIG+QHtUOnizso=; b=MPeQI9SlINgglXUBjVjkyylIUDKuzjpRgfz7kVH0LK1hryUXhXMUvSNMsKRzTeCiiD crD7AXp7teBreRrC4COXtIp1Ek+Dre3f7/pETUwLULjf9N3eYLJbNx6v3Nk94cOUBuuB NsLulNZyRJkupOEHgjwmn3L4VtDW7xlJNzKgF1ekoMK96NW4U23EeVa5tiaSFUtEfaiE Py/rsAG0BNCNlX5OJFDkW7TdRXCWXIxtIzQf95/9LG+firUEOY+gSHBVx3UjpVoERo2T GxLF7N11su0YNLtrcPpSC8WSPsA/99EshgAFkJs25VNPadIeQf5T6Jqv7lxHmpN27d6Y 8hjw== X-Gm-Message-State: AElRT7FMrufLpXvENyt1rjjV+SDS1vJ9gcW3Fv7Xm5dOb7vGM0gbpS+G OsJxQoGuIlDe8ORxaY0Ql5fzSA== X-Received: by 10.99.5.137 with SMTP id 131mr7401900pgf.99.1521144263865; Thu, 15 Mar 2018 13:04:23 -0700 (PDT) Received: from cabot-wlan.adilger.int (S0106a84e3fe4b223.cg.shawcable.net. [70.77.216.213]) by smtp.gmail.com with ESMTPSA id f5sm11216264pgn.56.2018.03.15.13.04.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 13:04:22 -0700 (PDT) From: Andreas Dilger Message-Id: <35F18E78-D604-4B3E-B73D-8DB88B648C78@dilger.ca> Content-Type: multipart/signed; boundary="Apple-Mail=_BCD56DE1-C216-4C39-9DA3-B550D214E66F"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [RFC v2 03/83] Add super.h. Date: Thu, 15 Mar 2018 14:04:17 -0600 In-Reply-To: Cc: Arnd Bergmann , "Darrick J. Wong" , Linux FS Devel , Linux Kernel Mailing List , "linux-nvdimm@lists.01.org" , Dan Williams , "Rudoff, Andy" , coughlan@redhat.com, Steven Swanson , Dave Chinner , Jan Kara , swhiteho@redhat.com, miklos@szeredi.hu, Jian Xu , Andiry Xu To: Andiry Xu References: <1520705944-6723-1-git-send-email-jix024@eng.ucsd.edu> <1520705944-6723-4-git-send-email-jix024@eng.ucsd.edu> <20180315045401.GB4860@magnolia> X-Mailer: Apple Mail (2.3273) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Apple-Mail=_BCD56DE1-C216-4C39-9DA3-B550D214E66F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Mar 15, 2018, at 11:51 AM, Andiry Xu wrote: >=20 > On Thu, Mar 15, 2018 at 2:05 AM, Arnd Bergmann wrote: >> On Thu, Mar 15, 2018 at 7:11 AM, Andiry Xu = wrote: >>> On Wed, Mar 14, 2018 at 9:54 PM, Darrick J. Wong >>> wrote: >>>> On Sat, Mar 10, 2018 at 10:17:44AM -0800, Andiry Xu wrote: >>=20 >>>>> + /* s_mtime and s_wtime should be together and their order = should not be >>>>> + * changed. we use an 8 byte write to update both of them = atomically >>>>> + */ >>>>> + __le32 s_mtime; /* mount time */ >>>>> + __le32 s_wtime; /* write time */ >>>>=20 >>>> Hmmm, 32-bit timestamps? 2038 isn't that far away... >>>>=20 >>>=20 >>> I will try fixing this in the next version. >>=20 >> I would also recommend adding nanosecond-resolution timestamps. >> In theory, a signed 64-bit nanosecond field is sufficient for each = timestamp >> (it's good for several hundred years), but the more common format = uses >> 64-bit seconds and 32-bit nanoseconds in other file systems. >>=20 >> Unfortunately it looks, you will have to come up with a more = sophisticated >> update method above, even if you leave out the nanoseconds, you can't >> easily rely on a 16-byte atomic update across architectures to deal = with >> the two 64-bit timestamps. For the superblock fields, you might be = able >> to get away with using second resolution, and then encoding the >> timestamps as a signed 64-bit 'mkfs time' along with two unsigned >> 32-bit times added on top, which gives you a range of 136 years mount >> a file system after its creation. >>=20 >=20 > I will take a look at other file systems. >=20 > Superblock mtime is not a big problem as it is updated rarely. 64-bit > seconds and 32-bit nanoseconds make the inode and log entry bigger, > and updating file->atime cannot be done with a single 64bit update. > That may be annoying and needs to use journaling. If the 64-bit atomicity was really a performance issue, you could do something like: __u32 time_high =3D seconds >> 32; __u64 time_low =3D seconds << 32 | nanoseconds; and then you only need to update time_high with a journal operation if = it has changed from the current time_high value (about once every 140 = years), and the time_low can be set atomically. It needs a few extra cycles = each time (hidden with an unlikely()) vs. just setting both, but that is a = win if it avoids other CPU or IO overhead. Cheers, Andreas --Apple-Mail=_BCD56DE1-C216-4C39-9DA3-B550D214E66F Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIzBAEBCAAdFiEEDb73u6ZejP5ZMprvcqXauRfMH+AFAlqq0cEACgkQcqXauRfM H+DRCxAAsrmnJRLKprl2A1oLrDWNBQZFiPO1m+3BXcneIrHbr3WXS2bGPZp5Nv6W DS6cmAXS1ZGkstxSTP+1vot59/Uh9KetE28sdvrzlwzk7/8eej53wQs04yVMAuh/ z416SkUInDEW7oKLMA+E8gL1u16l0RnBSaIkHunDd6NPWNQ3HR5NMWqivV0UpI2T xT58NgQxwSS3zJpVgwnmwcY9l6sAhG0qyml542VLYtlHx4QNQuTmzdhY0rQhbKbp mDS/XRgj5z26MqLQj2pGWzlGiHU6GyBTwvdg59mj3hTb4P29G24g33Cm4mOgm9Oc 8D1EmxQj1fzC+Y/rf5BF19lR8cr4BdPVEveHM8NmbOImu6ZVEPNUl7n7RYGV3aax G0zEw9zswhNmuY445x+y2ZvaO+qTQO/qsKz8My4mHW0wkdoC3cHEjoUeUwQhYy0A ucquJsRjysUj5c+luIj96XqudbgA7DGx85WXkvBc3doLWdQo2xIwgN6v4oNRrJEP qRwu0EaQMZh3Ka2SGcxnS+lWRbH1CF1uQSqDLxzr3aniQLPd6NDfLVmn1Yy5CXrZ 6YrhdL9z6DC4A9FMJrDX22fnGxabYuxyehmTklXP6whX4gJ9w2XLVvlDoYqoWPW5 aUP/llSAHNMCzzR+qL3RPsbtfUftbAy0Yt6lJj5WG+R/yu63k5w= =xcW6 -----END PGP SIGNATURE----- --Apple-Mail=_BCD56DE1-C216-4C39-9DA3-B550D214E66F--