linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: "J. Bruce Fields" <bfields@fieldses.org>,
	Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	y2038@lists.linaro.org, Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH v2 01/12] nfsd: use ktime_get_seconds() for timestamps
Date: Fri, 13 Dec 2019 15:10:35 +0100	[thread overview]
Message-ID: <20191213141046.1770441-2-arnd@arndb.de> (raw)
In-Reply-To: <20191213141046.1770441-1-arnd@arndb.de>

The delegation logic in nfsd uses the somewhat inefficient
seconds_since_boot() function to record time intervals.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/nfsd/nfs4state.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 369e574c5092..bfdb3366239c 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -806,7 +806,7 @@ static void nfs4_free_deleg(struct nfs4_stid *stid)
 static DEFINE_SPINLOCK(blocked_delegations_lock);
 static struct bloom_pair {
 	int	entries, old_entries;
-	time_t	swap_time;
+	time64_t swap_time;
 	int	new; /* index into 'set' */
 	DECLARE_BITMAP(set[2], 256);
 } blocked_delegations;
@@ -818,15 +818,15 @@ static int delegation_blocked(struct knfsd_fh *fh)
 
 	if (bd->entries == 0)
 		return 0;
-	if (seconds_since_boot() - bd->swap_time > 30) {
+	if (ktime_get_seconds() - bd->swap_time > 30) {
 		spin_lock(&blocked_delegations_lock);
-		if (seconds_since_boot() - bd->swap_time > 30) {
+		if (ktime_get_seconds() - bd->swap_time > 30) {
 			bd->entries -= bd->old_entries;
 			bd->old_entries = bd->entries;
 			memset(bd->set[bd->new], 0,
 			       sizeof(bd->set[0]));
 			bd->new = 1-bd->new;
-			bd->swap_time = seconds_since_boot();
+			bd->swap_time = ktime_get_seconds();
 		}
 		spin_unlock(&blocked_delegations_lock);
 	}
@@ -856,7 +856,7 @@ static void block_delegations(struct knfsd_fh *fh)
 	__set_bit((hash>>8)&255, bd->set[bd->new]);
 	__set_bit((hash>>16)&255, bd->set[bd->new]);
 	if (bd->entries == 0)
-		bd->swap_time = seconds_since_boot();
+		bd->swap_time = ktime_get_seconds();
 	bd->entries += 1;
 	spin_unlock(&blocked_delegations_lock);
 }
-- 
2.20.0


  reply	other threads:[~2019-12-13 20:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-13 14:10 [PATCH v2 00/12] nfsd: avoid 32-bit time_t Arnd Bergmann
2019-12-13 14:10 ` Arnd Bergmann [this message]
2019-12-13 14:10 ` [PATCH v2 02/12] nfsd: print 64-bit timestamps in client_info_show Arnd Bergmann
2019-12-13 14:10 ` [PATCH v2 03/12] nfsd: handle nfs3 timestamps as unsigned Arnd Bergmann
2019-12-13 14:10 ` [PATCH v2 04/12] nfsd: use timespec64 in encode_time_delta Arnd Bergmann
2019-12-13 14:10 ` [PATCH v2 05/12] nfsd: make 'boot_time' 64-bit wide Arnd Bergmann
2019-12-13 14:10 ` [PATCH v2 06/12] nfsd: pass a 64-bit guardtime to nfsd_setattr() Arnd Bergmann
2019-12-13 14:10 ` [PATCH v2 07/12] nfsd: use time64_t in nfsd_proc_setattr() check Arnd Bergmann
2019-12-13 14:10 ` [PATCH v2 08/12] nfsd: fix delay timer on 32-bit architectures Arnd Bergmann
2019-12-13 14:10 ` [PATCH v2 09/12] nfsd: fix jiffies/time_t mixup in LRU list Arnd Bergmann
2019-12-13 14:10 ` [PATCH v2 10/12] nfsd: use boottime for lease expiry alculation Arnd Bergmann
2019-12-13 16:26   ` Chuck Lever
2019-12-13 16:40     ` Arnd Bergmann
2019-12-13 18:23       ` Chuck Lever
2019-12-13 21:09         ` Arnd Bergmann
2019-12-13 21:13         ` Bruce Fields
2019-12-13 21:19           ` Arnd Bergmann
2019-12-20  2:57   ` J. Bruce Fields
2019-12-13 14:10 ` [PATCH v2 11/12] nfsd: use ktime_get_real_seconds() in nfs4_verifier Arnd Bergmann
2019-12-13 14:10 ` [PATCH v2 12/12] nfsd: remove nfs4_reset_lease() declarations Arnd Bergmann
2019-12-18 17:21 ` [PATCH v2 00/12] nfsd: avoid 32-bit time_t Arnd Bergmann
2019-12-18 17:24   ` J. Bruce Fields
2019-12-18 18:05     ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191213141046.1770441-2-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).