Message ID | 20230928110413.33032-50-jlayton@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3233840vqu; Thu, 28 Sep 2023 04:20:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEzvrWhZ/FdOhIOAqLYw7qmi7RBabjfq1fpYT2nCPqFPEBuAGoqjeiaurKzIeeWuXcpVcMP X-Received: by 2002:a05:6358:9189:b0:134:f326:e819 with SMTP id j9-20020a056358918900b00134f326e819mr956362rwa.29.1695900023595; Thu, 28 Sep 2023 04:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695900023; cv=none; d=google.com; s=arc-20160816; b=B8OBv+PwV/CGpLEH3/+TW4lzLbJSBvXrCop159jEZ35hSUX3RbaigLIHjH0U84sX/D BZuTOaQmSM5mO4prP/9DX/L2ihIoEUZs9aqjbUCJRh0jpiHYXwZAhooZq71babg1gDbe XFzCILCd46m3/hM1WcSN/ERAg3sLdT1EW9NK5iObD4evb/FgpvQ1Jo2sACQ8tv7O3BBu OyW+FuUcvdMkrraK5a/UpX1z1hn484coURHEI+TXqM+qXxwQGzRIZhljvkaRYxABKegz IHotyz5ujX2a6wD5TAUqlKykmvWenNmojE/NAY0+26piRAQJnDu84jpzDrm6Yr5R6DDd C/Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=leS0MOde2MA/h+p4fuBihAwzJ+KaaX79XH7IGoNlsko=; fh=5DM+f8QbZjQfJ9YZvXfjL+erGmfU1TzZ2/he2Dg+EUY=; b=abPhCK1Df2ZZ4xdDcvsidPKL66pzHKedfeSHr3sSbcEcl6vsCQoQHv0nEaQs289BZQ lRYG+3uPbRxDpx2v/L++lnMIxRc2jjGTjtFKnk63SYTnqSdqIjQUovnUlbmHDBtha929 kF/sFtz5fzMY2NjTy+SKWilr8HC3Gga5kEDtprRMWsbgbdBU5wrt+BZ3Cl9nqBMGZqzT iTirjJXfBqSlJbkJafI7hKUu2PMpNfwnpXPWvVNTH+LjCp0/l4l7G5qWpDmO2OoQOYcS kRcUgKNUT8nVAOrWcxD66v6c5WwEJZwH74q881r6ag6GaTNty6vbij7E7mEiOe/5SM7B gtAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WCIomNvB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id t64-20020a638143000000b0058572c8d5dasi3108626pgd.241.2023.09.28.04.20.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 04:20:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WCIomNvB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 4B12C8582FDE; Thu, 28 Sep 2023 04:09:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232494AbjI1LIg (ORCPT <rfc822;pwkd43@gmail.com> + 21 others); Thu, 28 Sep 2023 07:08:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232087AbjI1LH3 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 28 Sep 2023 07:07:29 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D37F219A8; Thu, 28 Sep 2023 04:05:14 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A0FEC433C7; Thu, 28 Sep 2023 11:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695899114; bh=UZbYji3vGdjWb2eeDZnDkQs3Num0C8JGBZvtY9Wk2uU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WCIomNvBbCcyXwBR2i9dwdEJRvhjHbaAVB6/bk4o7MvRbSGOoQHnF0VioXsJ5rAlU vtxNIbwERmrDajJ5WmuXfTMRZ8P4dJdSnartvY92TuO7LRXwGCoLVSobu3uiqeOAyv 89b2Hga3sKmfjAN9dQQ+KsS8D+GFH5WcAAmJyDZSJqx7Kb3Y9UUQkgWtKFfcosPq+F 7myn7E0kaFdrNP4ipOCTkKBGJV9KztNd1vE/5fQ0Cxtk37ROFNcY2rniyyfOX60Gwa iSdnJl7y/SAqrSicTS6GyL82LcH747l2XZ2fYVXoI725ETQPb8qJCRw9BmQW4Vs+Th yiJDFs9bv3ENA== From: Jeff Layton <jlayton@kernel.org> To: Alexander Viro <viro@zeniv.linux.org.uk>, Christian Brauner <brauner@kernel.org>, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Neil Brown <neilb@suse.de>, Olga Kornievskaia <kolga@netapp.com>, Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>, linux-nfs@vger.kernel.org Subject: [PATCH 51/87] fs/nfsd: convert to new inode {a,m}time accessors Date: Thu, 28 Sep 2023 07:03:00 -0400 Message-ID: <20230928110413.33032-50-jlayton@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230928110413.33032-1-jlayton@kernel.org> References: <20230928110300.32891-1-jlayton@kernel.org> <20230928110413.33032-1-jlayton@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 28 Sep 2023 04:09:10 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778280063205823458 X-GMAIL-MSGID: 1778280063205823458 |
Series |
fs: new accessor methods for atime and mtime
|
|
Commit Message
Jeff Layton
Sept. 28, 2023, 11:03 a.m. UTC
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/nfsd/blocklayout.c | 3 ++-
fs/nfsd/nfs3proc.c | 4 ++--
fs/nfsd/nfs4proc.c | 8 ++++----
fs/nfsd/nfsctl.c | 2 +-
4 files changed, 9 insertions(+), 8 deletions(-)
Comments
On Thu, Sep 28, 2023 at 07:03:00AM -0400, Jeff Layton wrote: > Signed-off-by: Jeff Layton <jlayton@kernel.org> > --- > fs/nfsd/blocklayout.c | 3 ++- > fs/nfsd/nfs3proc.c | 4 ++-- > fs/nfsd/nfs4proc.c | 8 ++++---- > fs/nfsd/nfsctl.c | 2 +- > 4 files changed, 9 insertions(+), 8 deletions(-) > > diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c > index 01d7fd108cf3..bdc582777738 100644 > --- a/fs/nfsd/blocklayout.c > +++ b/fs/nfsd/blocklayout.c > @@ -119,10 +119,11 @@ nfsd4_block_commit_blocks(struct inode *inode, struct nfsd4_layoutcommit *lcp, > { > loff_t new_size = lcp->lc_last_wr + 1; > struct iattr iattr = { .ia_valid = 0 }; > + struct timespec64 mtime = inode_get_mtime(inode); Nit: Please use reverse Christmas tree for new variable declarations. > int error; > > if (lcp->lc_mtime.tv_nsec == UTIME_NOW || > - timespec64_compare(&lcp->lc_mtime, &inode->i_mtime) < 0) > + timespec64_compare(&lcp->lc_mtime, &mtime) < 0) > lcp->lc_mtime = current_time(inode); > iattr.ia_valid |= ATTR_ATIME | ATTR_CTIME | ATTR_MTIME; > iattr.ia_atime = iattr.ia_ctime = iattr.ia_mtime = lcp->lc_mtime; > diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c > index 268ef57751c4..b1c90a901d3e 100644 > --- a/fs/nfsd/nfs3proc.c > +++ b/fs/nfsd/nfs3proc.c > @@ -294,8 +294,8 @@ nfsd3_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, > status = nfserr_exist; > break; > case NFS3_CREATE_EXCLUSIVE: > - if (d_inode(child)->i_mtime.tv_sec == v_mtime && > - d_inode(child)->i_atime.tv_sec == v_atime && > + if (inode_get_mtime(d_inode(child)).tv_sec == v_mtime && > + inode_get_atime(d_inode(child)).tv_sec == v_atime && "inode_get_atime(yada).tv_sec" seems to be a frequently-repeated idiom, at least in this patch. Would it be helpful to have an additional helper that extracted just the seconds field, and one that extracts just the nsec field? > d_inode(child)->i_size == 0) { > break; > } > diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c > index 4199ede0583c..b17309aac0d5 100644 > --- a/fs/nfsd/nfs4proc.c > +++ b/fs/nfsd/nfs4proc.c > @@ -322,8 +322,8 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, > status = nfserr_exist; > break; > case NFS4_CREATE_EXCLUSIVE: > - if (d_inode(child)->i_mtime.tv_sec == v_mtime && > - d_inode(child)->i_atime.tv_sec == v_atime && > + if (inode_get_mtime(d_inode(child)).tv_sec == v_mtime && > + inode_get_atime(d_inode(child)).tv_sec == v_atime && > d_inode(child)->i_size == 0) { > open->op_created = true; > break; /* subtle */ > @@ -331,8 +331,8 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, > status = nfserr_exist; > break; > case NFS4_CREATE_EXCLUSIVE4_1: > - if (d_inode(child)->i_mtime.tv_sec == v_mtime && > - d_inode(child)->i_atime.tv_sec == v_atime && > + if (inode_get_mtime(d_inode(child)).tv_sec == v_mtime && > + inode_get_atime(d_inode(child)).tv_sec == v_atime && > d_inode(child)->i_size == 0) { > open->op_created = true; > goto set_attr; /* subtle */ > diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c > index 7ed02fb88a36..846559e4769b 100644 > --- a/fs/nfsd/nfsctl.c > +++ b/fs/nfsd/nfsctl.c > @@ -1132,7 +1132,7 @@ static struct inode *nfsd_get_inode(struct super_block *sb, umode_t mode) > /* Following advice from simple_fill_super documentation: */ > inode->i_ino = iunique(sb, NFSD_MaxReserved); > inode->i_mode = mode; > - inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); > + simple_inode_init_ts(inode); An observation about the whole series: Should these helpers use the usual naming convention of: <subsystem>-<subject>-<verb> So we get: simple_inode_ts_init(inode); inode_atime_get(inode) > switch (mode & S_IFMT) { > case S_IFDIR: > inode->i_fop = &simple_dir_operations; > -- > 2.41.0 > Otherwise, for the patch(es) touching nfsd: Acked-by: Chuck Lever <chuck.lever@oracle.com>
On Thu, 2023-09-28 at 09:56 -0400, Chuck Lever wrote: > On Thu, Sep 28, 2023 at 07:03:00AM -0400, Jeff Layton wrote: > > Signed-off-by: Jeff Layton <jlayton@kernel.org> > > --- > > fs/nfsd/blocklayout.c | 3 ++- > > fs/nfsd/nfs3proc.c | 4 ++-- > > fs/nfsd/nfs4proc.c | 8 ++++---- > > fs/nfsd/nfsctl.c | 2 +- > > 4 files changed, 9 insertions(+), 8 deletions(-) > > > > diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c > > index 01d7fd108cf3..bdc582777738 100644 > > --- a/fs/nfsd/blocklayout.c > > +++ b/fs/nfsd/blocklayout.c > > @@ -119,10 +119,11 @@ nfsd4_block_commit_blocks(struct inode *inode, struct nfsd4_layoutcommit *lcp, > > { > > loff_t new_size = lcp->lc_last_wr + 1; > > struct iattr iattr = { .ia_valid = 0 }; > > + struct timespec64 mtime = inode_get_mtime(inode); > > Nit: Please use reverse Christmas tree for new variable declarations. > Ok > > > int error; > > > > if (lcp->lc_mtime.tv_nsec == UTIME_NOW || > > - timespec64_compare(&lcp->lc_mtime, &inode->i_mtime) < 0) > > + timespec64_compare(&lcp->lc_mtime, &mtime) < 0) > > lcp->lc_mtime = current_time(inode); > > iattr.ia_valid |= ATTR_ATIME | ATTR_CTIME | ATTR_MTIME; > > iattr.ia_atime = iattr.ia_ctime = iattr.ia_mtime = lcp->lc_mtime; > > diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c > > index 268ef57751c4..b1c90a901d3e 100644 > > --- a/fs/nfsd/nfs3proc.c > > +++ b/fs/nfsd/nfs3proc.c > > @@ -294,8 +294,8 @@ nfsd3_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, > > status = nfserr_exist; > > break; > > case NFS3_CREATE_EXCLUSIVE: > > - if (d_inode(child)->i_mtime.tv_sec == v_mtime && > > - d_inode(child)->i_atime.tv_sec == v_atime && > > + if (inode_get_mtime(d_inode(child)).tv_sec == v_mtime && > > + inode_get_atime(d_inode(child)).tv_sec == v_atime && > > "inode_get_atime(yada).tv_sec" seems to be a frequently-repeated > idiom, at least in this patch. Would it be helpful to have an > additional helper that extracted just the seconds field, and one > that extracts just the nsec field? > I don't know that extra helpers will make that any clearer. > > > d_inode(child)->i_size == 0) { > > break; > > } > > diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c > > index 4199ede0583c..b17309aac0d5 100644 > > --- a/fs/nfsd/nfs4proc.c > > +++ b/fs/nfsd/nfs4proc.c > > @@ -322,8 +322,8 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, > > status = nfserr_exist; > > break; > > case NFS4_CREATE_EXCLUSIVE: > > - if (d_inode(child)->i_mtime.tv_sec == v_mtime && > > - d_inode(child)->i_atime.tv_sec == v_atime && > > + if (inode_get_mtime(d_inode(child)).tv_sec == v_mtime && > > + inode_get_atime(d_inode(child)).tv_sec == v_atime && > > d_inode(child)->i_size == 0) { > > open->op_created = true; > > break; /* subtle */ > > @@ -331,8 +331,8 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, > > status = nfserr_exist; > > break; > > case NFS4_CREATE_EXCLUSIVE4_1: > > - if (d_inode(child)->i_mtime.tv_sec == v_mtime && > > - d_inode(child)->i_atime.tv_sec == v_atime && > > + if (inode_get_mtime(d_inode(child)).tv_sec == v_mtime && > > + inode_get_atime(d_inode(child)).tv_sec == v_atime && > > d_inode(child)->i_size == 0) { > > open->op_created = true; > > goto set_attr; /* subtle */ > > diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c > > index 7ed02fb88a36..846559e4769b 100644 > > --- a/fs/nfsd/nfsctl.c > > +++ b/fs/nfsd/nfsctl.c > > @@ -1132,7 +1132,7 @@ static struct inode *nfsd_get_inode(struct super_block *sb, umode_t mode) > > /* Following advice from simple_fill_super documentation: */ > > inode->i_ino = iunique(sb, NFSD_MaxReserved); > > inode->i_mode = mode; > > - inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); > > + simple_inode_init_ts(inode); > > An observation about the whole series: Should these helpers use the > usual naming convention of: > > <subsystem>-<subject>-<verb> > > So we get: > > simple_inode_ts_init(inode); > > inode_atime_get(inode) > This was already bikeshedded during the ctime series, and the near universal preference at the time was to go with inode_set_ctime and inode_get_ctime. I'm just following suit with the new accessors. > > > switch (mode & S_IFMT) { > > case S_IFDIR: > > inode->i_fop = &simple_dir_operations; > > -- > > 2.41.0 > > > > Otherwise, for the patch(es) touching nfsd: > > Acked-by: Chuck Lever <chuck.lever@oracle.com> > Thanks!
On Thu, Sep 28, 2023 at 10:09:19AM -0400, Jeff Layton wrote: > On Thu, 2023-09-28 at 09:56 -0400, Chuck Lever wrote: > > On Thu, Sep 28, 2023 at 07:03:00AM -0400, Jeff Layton wrote: > > > Signed-off-by: Jeff Layton <jlayton@kernel.org> > > > --- > > > fs/nfsd/blocklayout.c | 3 ++- > > > fs/nfsd/nfs3proc.c | 4 ++-- > > > fs/nfsd/nfs4proc.c | 8 ++++---- > > > fs/nfsd/nfsctl.c | 2 +- > > > 4 files changed, 9 insertions(+), 8 deletions(-) > > > > > > diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c > > > index 01d7fd108cf3..bdc582777738 100644 > > > --- a/fs/nfsd/blocklayout.c > > > +++ b/fs/nfsd/blocklayout.c > > > @@ -119,10 +119,11 @@ nfsd4_block_commit_blocks(struct inode *inode, struct nfsd4_layoutcommit *lcp, > > > { > > > loff_t new_size = lcp->lc_last_wr + 1; > > > struct iattr iattr = { .ia_valid = 0 }; > > > + struct timespec64 mtime = inode_get_mtime(inode); > > > > Nit: Please use reverse Christmas tree for new variable declarations. > > > > Ok > > > > > > int error; > > > > > > if (lcp->lc_mtime.tv_nsec == UTIME_NOW || > > > - timespec64_compare(&lcp->lc_mtime, &inode->i_mtime) < 0) > > > + timespec64_compare(&lcp->lc_mtime, &mtime) < 0) > > > lcp->lc_mtime = current_time(inode); > > > iattr.ia_valid |= ATTR_ATIME | ATTR_CTIME | ATTR_MTIME; > > > iattr.ia_atime = iattr.ia_ctime = iattr.ia_mtime = lcp->lc_mtime; > > > diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c > > > index 268ef57751c4..b1c90a901d3e 100644 > > > --- a/fs/nfsd/nfs3proc.c > > > +++ b/fs/nfsd/nfs3proc.c > > > @@ -294,8 +294,8 @@ nfsd3_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, > > > status = nfserr_exist; > > > break; > > > case NFS3_CREATE_EXCLUSIVE: > > > - if (d_inode(child)->i_mtime.tv_sec == v_mtime && > > > - d_inode(child)->i_atime.tv_sec == v_atime && > > > + if (inode_get_mtime(d_inode(child)).tv_sec == v_mtime && > > > + inode_get_atime(d_inode(child)).tv_sec == v_atime && > > > > "inode_get_atime(yada).tv_sec" seems to be a frequently-repeated > > idiom, at least in this patch. Would it be helpful to have an > > additional helper that extracted just the seconds field, and one > > that extracts just the nsec field? > > > > I don't know that extra helpers will make that any clearer. To clarify my review comment: I understand that eventually the timestamps stored in the inode will be a single scalar value that is to be converted to a timespec64 structure. So for accessors who want only one of the tv_sec or tv_nsec fields: scalar -> timespec64 -> tv_sec It might be more efficient to skip extracting the tv_nsec field when that value isn't going to be used. Perhaps the compiler might observe that the tv_nsec result isn't used and remove that dead code. But IMO it would be easier for humans to understand and more dependably optimized to write the helpers so the tv_nsec part of the computation wasn't even in there in these cases. > > > d_inode(child)->i_size == 0) { > > > break; > > > } > > > diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c > > > index 4199ede0583c..b17309aac0d5 100644 > > > --- a/fs/nfsd/nfs4proc.c > > > +++ b/fs/nfsd/nfs4proc.c > > > @@ -322,8 +322,8 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, > > > status = nfserr_exist; > > > break; > > > case NFS4_CREATE_EXCLUSIVE: > > > - if (d_inode(child)->i_mtime.tv_sec == v_mtime && > > > - d_inode(child)->i_atime.tv_sec == v_atime && > > > + if (inode_get_mtime(d_inode(child)).tv_sec == v_mtime && > > > + inode_get_atime(d_inode(child)).tv_sec == v_atime && > > > d_inode(child)->i_size == 0) { > > > open->op_created = true; > > > break; /* subtle */ > > > @@ -331,8 +331,8 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, > > > status = nfserr_exist; > > > break; > > > case NFS4_CREATE_EXCLUSIVE4_1: > > > - if (d_inode(child)->i_mtime.tv_sec == v_mtime && > > > - d_inode(child)->i_atime.tv_sec == v_atime && > > > + if (inode_get_mtime(d_inode(child)).tv_sec == v_mtime && > > > + inode_get_atime(d_inode(child)).tv_sec == v_atime && > > > d_inode(child)->i_size == 0) { > > > open->op_created = true; > > > goto set_attr; /* subtle */ > > > diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c > > > index 7ed02fb88a36..846559e4769b 100644 > > > --- a/fs/nfsd/nfsctl.c > > > +++ b/fs/nfsd/nfsctl.c > > > @@ -1132,7 +1132,7 @@ static struct inode *nfsd_get_inode(struct super_block *sb, umode_t mode) > > > /* Following advice from simple_fill_super documentation: */ > > > inode->i_ino = iunique(sb, NFSD_MaxReserved); > > > inode->i_mode = mode; > > > - inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); > > > + simple_inode_init_ts(inode); > > > > An observation about the whole series: Should these helpers use the > > usual naming convention of: > > > > <subsystem>-<subject>-<verb> > > > > So we get: > > > > simple_inode_ts_init(inode); > > > > inode_atime_get(inode) > > > > This was already bikeshedded during the ctime series, and the near > universal preference at the time was to go with inode_set_ctime and > inode_get_ctime. I'm just following suit with the new accessors. When this was reviewed before, there were only ctime accessors. Now we have two more sets of accessor utilities. Just an observation. I can drop it here. > > > switch (mode & S_IFMT) { > > > case S_IFDIR: > > > inode->i_fop = &simple_dir_operations; > > > -- > > > 2.41.0 > > > > > > > Otherwise, for the patch(es) touching nfsd: > > > > Acked-by: Chuck Lever <chuck.lever@oracle.com> > > > > Thanks! > -- > Jeff Layton <jlayton@kernel.org>
diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c index 01d7fd108cf3..bdc582777738 100644 --- a/fs/nfsd/blocklayout.c +++ b/fs/nfsd/blocklayout.c @@ -119,10 +119,11 @@ nfsd4_block_commit_blocks(struct inode *inode, struct nfsd4_layoutcommit *lcp, { loff_t new_size = lcp->lc_last_wr + 1; struct iattr iattr = { .ia_valid = 0 }; + struct timespec64 mtime = inode_get_mtime(inode); int error; if (lcp->lc_mtime.tv_nsec == UTIME_NOW || - timespec64_compare(&lcp->lc_mtime, &inode->i_mtime) < 0) + timespec64_compare(&lcp->lc_mtime, &mtime) < 0) lcp->lc_mtime = current_time(inode); iattr.ia_valid |= ATTR_ATIME | ATTR_CTIME | ATTR_MTIME; iattr.ia_atime = iattr.ia_ctime = iattr.ia_mtime = lcp->lc_mtime; diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c index 268ef57751c4..b1c90a901d3e 100644 --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c @@ -294,8 +294,8 @@ nfsd3_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, status = nfserr_exist; break; case NFS3_CREATE_EXCLUSIVE: - if (d_inode(child)->i_mtime.tv_sec == v_mtime && - d_inode(child)->i_atime.tv_sec == v_atime && + if (inode_get_mtime(d_inode(child)).tv_sec == v_mtime && + inode_get_atime(d_inode(child)).tv_sec == v_atime && d_inode(child)->i_size == 0) { break; } diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 4199ede0583c..b17309aac0d5 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -322,8 +322,8 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, status = nfserr_exist; break; case NFS4_CREATE_EXCLUSIVE: - if (d_inode(child)->i_mtime.tv_sec == v_mtime && - d_inode(child)->i_atime.tv_sec == v_atime && + if (inode_get_mtime(d_inode(child)).tv_sec == v_mtime && + inode_get_atime(d_inode(child)).tv_sec == v_atime && d_inode(child)->i_size == 0) { open->op_created = true; break; /* subtle */ @@ -331,8 +331,8 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, status = nfserr_exist; break; case NFS4_CREATE_EXCLUSIVE4_1: - if (d_inode(child)->i_mtime.tv_sec == v_mtime && - d_inode(child)->i_atime.tv_sec == v_atime && + if (inode_get_mtime(d_inode(child)).tv_sec == v_mtime && + inode_get_atime(d_inode(child)).tv_sec == v_atime && d_inode(child)->i_size == 0) { open->op_created = true; goto set_attr; /* subtle */ diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 7ed02fb88a36..846559e4769b 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -1132,7 +1132,7 @@ static struct inode *nfsd_get_inode(struct super_block *sb, umode_t mode) /* Following advice from simple_fill_super documentation: */ inode->i_ino = iunique(sb, NFSD_MaxReserved); inode->i_mode = mode; - inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); + simple_inode_init_ts(inode); switch (mode & S_IFMT) { case S_IFDIR: inode->i_fop = &simple_dir_operations;