Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3145734rdh; Thu, 28 Sep 2023 04:14:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFz0Kxr5Qdxp0atbWt49puWrKeGbulHTKjzaNqHcTCM8IIZEI6X0ev/rB/rQ5qqUDR7DxF5 X-Received: by 2002:a05:6358:785:b0:14b:d9de:3008 with SMTP id n5-20020a056358078500b0014bd9de3008mr1066636rwj.5.1695899656819; Thu, 28 Sep 2023 04:14:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695899656; cv=none; d=google.com; s=arc-20160816; b=XkjkHYxGtYMlNz0R9zKdpK9c8o76NpNW6mGvWjei1+UJ0kAQSVtEnLlQvAnUKsukBg sI9gjdebel7O15CrU8SS3YHTCBbZiQ+ygF+veaL9Ke3gZDRoehEhBjH6HIkHYZS9I79r kLDK+ZQ3Of/VraCDdXytocVBACfAa8DM4aIF8sf+5wn3GpaWoV6/JlDmckFARvG7qNA7 ra2Hn2UGT45tzG/lpuYmge2G+RvAV4q464A9RSTngI9ehRY+u9a8CBv6xsUMpVlATSJG RdP/giKLInILS44eziJ8xoX+eRmPFY+X/6bFAX5Esg4pG++3ic0eyXlr3zZ/AgcA/6kk iOBg== 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:to:from :dkim-signature; bh=7C9Don8gSgbbYwPXXvtKNEi+Xzup+v5/3AbmR0odyPA=; fh=c1hve9LK7bidUltaxotdOOkNtWZ8Drk/KOyPdUWU/OI=; b=vORxjW1jpoVcC0xOkC1C9SLVJbmMGsm7tgCKNQDyIepZf0wBkondiy3rQwMlyh2yr7 HJMLlY0cqnfyl/BTP1oNZ4ARXlaFE8T5GA7yuojSEpHe4/dfq+bt6TqKC61fjiLU3Jnv ErdKDi8XUb6++s8d1fgG87M6MbenAZ20lcCUe8kty6uM5AkBgQu3EXj9bmcVjnoN54Wr LEQq/PlGhWURhRROLShNIhR7qDRLHRaAUVlrBRZexmPpcpO6xZoenUAlro0mbcfsp3pj cxpY3I8KcTKzjd6kYo9fAyO2zp1fKhDO17vlCioN3tbzzWfYJ5n6xNw4qOphSZLkyBLN yLtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=it9kxg8a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id x186-20020a6386c3000000b005648d3f2031si17602759pgd.362.2023.09.28.04.14.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 04:14:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=it9kxg8a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 25EB9836CE67; Thu, 28 Sep 2023 04:08:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232089AbjI1LHe (ORCPT + 99 others); Thu, 28 Sep 2023 07:07:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231851AbjI1LFh (ORCPT ); Thu, 28 Sep 2023 07:05:37 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 099A610FE; Thu, 28 Sep 2023 04:04:58 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FE21C433C8; Thu, 28 Sep 2023 11:04:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695899097; bh=LKLhIsUTFieq68OcX4ILSefLHySzq9aIRjDYBRwnayg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=it9kxg8aa+2XWHa3Eb/OhbYUr/Et5qT+JxeCzVJ9ZE2GlFoXb9Cd/l9gdZwjxEies dxllCJ2pTJ+IbnaA/yk0qYNhq0DSHXBP7mIkYJVxpjXAZ2tm1+D6LEny9pHKonI4hV j5bEKsyAnNuF1KZ+DM5M5n6d2k1S7dNViLC/NdNQcX8VJdqs1q1KHR+1rMVZqOF5xS 10g7ss/rckbaLCQjFm2wTfK06xoASWzcrDRNN2Dxj7uZtvKk9GPo6l91Q9GrcYMA4i UktliHZ2EMISMphafK8DSHBQqxfTAJEh2s83krJ8qR6iZhhOPRR3gUBZ8I+6Vf75T3 mbOiM3cjC4hsA== From: Jeff Layton To: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 38/87] fs/fuse: convert to new inode {a,m}time accessors Date: Thu, 28 Sep 2023 07:02:47 -0400 Message-ID: <20230928110413.33032-37-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=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 28 Sep 2023 04:08:11 -0700 (PDT) Signed-off-by: Jeff Layton --- fs/fuse/control.c | 2 +- fs/fuse/dir.c | 6 +++--- fs/fuse/inode.c | 25 ++++++++++++------------- fs/fuse/readdir.c | 6 ++++-- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/fs/fuse/control.c b/fs/fuse/control.c index ab62e4624256..284a35006462 100644 --- a/fs/fuse/control.c +++ b/fs/fuse/control.c @@ -235,7 +235,7 @@ static struct dentry *fuse_ctl_add_dentry(struct dentry *parent, inode->i_mode = mode; inode->i_uid = fc->user_id; inode->i_gid = fc->group_id; - inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode); + simple_inode_init_ts(inode); /* setting ->i_op to NULL is not allowed */ if (iop) inode->i_op = iop; diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index d707e6987da9..bc2e2ee7eb20 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1812,8 +1812,8 @@ int fuse_flush_times(struct inode *inode, struct fuse_file *ff) memset(&outarg, 0, sizeof(outarg)); inarg.valid = FATTR_MTIME; - inarg.mtime = inode->i_mtime.tv_sec; - inarg.mtimensec = inode->i_mtime.tv_nsec; + inarg.mtime = inode_get_mtime(inode).tv_sec; + inarg.mtimensec = inode_get_mtime(inode).tv_nsec; if (fm->fc->minor >= 23) { inarg.valid |= FATTR_CTIME; inarg.ctime = inode_get_ctime(inode).tv_sec; @@ -1956,7 +1956,7 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr, /* the kernel maintains i_mtime locally */ if (trust_local_cmtime) { if (attr->ia_valid & ATTR_MTIME) - inode->i_mtime = attr->ia_mtime; + inode_set_mtime_to_ts(inode, attr->ia_mtime); if (attr->ia_valid & ATTR_CTIME) inode_set_ctime_to_ts(inode, attr->ia_ctime); /* FIXME: clear I_DIRTY_SYNC? */ diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 2e4eb7cf26fb..ab70dc3f00fa 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -188,12 +188,10 @@ void fuse_change_attributes_common(struct inode *inode, struct fuse_attr *attr, attr->mtimensec = min_t(u32, attr->mtimensec, NSEC_PER_SEC - 1); attr->ctimensec = min_t(u32, attr->ctimensec, NSEC_PER_SEC - 1); - inode->i_atime.tv_sec = attr->atime; - inode->i_atime.tv_nsec = attr->atimensec; + inode_set_atime(inode, attr->atime, attr->atimensec); /* mtime from server may be stale due to local buffered write */ if (!(cache_mask & STATX_MTIME)) { - inode->i_mtime.tv_sec = attr->mtime; - inode->i_mtime.tv_nsec = attr->mtimensec; + inode_set_mtime(inode, attr->mtime, attr->mtimensec); } if (!(cache_mask & STATX_CTIME)) { inode_set_ctime(inode, attr->ctime, attr->ctimensec); @@ -276,8 +274,8 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr, attr->size = i_size_read(inode); if (cache_mask & STATX_MTIME) { - attr->mtime = inode->i_mtime.tv_sec; - attr->mtimensec = inode->i_mtime.tv_nsec; + attr->mtime = inode_get_mtime(inode).tv_sec; + attr->mtimensec = inode_get_mtime(inode).tv_nsec; } if (cache_mask & STATX_CTIME) { attr->ctime = inode_get_ctime(inode).tv_sec; @@ -290,7 +288,7 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr, return; } - old_mtime = inode->i_mtime; + old_mtime = inode_get_mtime(inode); fuse_change_attributes_common(inode, attr, sx, attr_valid, cache_mask); oldsize = inode->i_size; @@ -337,8 +335,7 @@ static void fuse_init_inode(struct inode *inode, struct fuse_attr *attr, { inode->i_mode = attr->mode & S_IFMT; inode->i_size = attr->size; - inode->i_mtime.tv_sec = attr->mtime; - inode->i_mtime.tv_nsec = attr->mtimensec; + inode_set_mtime(inode, attr->mtime, attr->mtimensec); inode_set_ctime(inode, attr->ctime, attr->ctimensec); if (S_ISREG(inode->i_mode)) { fuse_init_common(inode); @@ -1423,17 +1420,19 @@ EXPORT_SYMBOL_GPL(fuse_dev_free); static void fuse_fill_attr_from_inode(struct fuse_attr *attr, const struct fuse_inode *fi) { + struct timespec64 atime = inode_get_atime(&fi->inode); + struct timespec64 mtime = inode_get_mtime(&fi->inode); struct timespec64 ctime = inode_get_ctime(&fi->inode); *attr = (struct fuse_attr){ .ino = fi->inode.i_ino, .size = fi->inode.i_size, .blocks = fi->inode.i_blocks, - .atime = fi->inode.i_atime.tv_sec, - .mtime = fi->inode.i_mtime.tv_sec, + .atime = atime.tv_sec, + .mtime = mtime.tv_sec, .ctime = ctime.tv_sec, - .atimensec = fi->inode.i_atime.tv_nsec, - .mtimensec = fi->inode.i_mtime.tv_nsec, + .atimensec = atime.tv_nsec, + .mtimensec = mtime.tv_nsec, .ctimensec = ctime.tv_nsec, .mode = fi->inode.i_mode, .nlink = fi->inode.i_nlink, diff --git a/fs/fuse/readdir.c b/fs/fuse/readdir.c index 9e6d587b3e67..c66a54d6c7d3 100644 --- a/fs/fuse/readdir.c +++ b/fs/fuse/readdir.c @@ -476,7 +476,7 @@ static int fuse_readdir_cached(struct file *file, struct dir_context *ctx) if (!fi->rdc.cached) { /* Starting cache? Set cache mtime. */ if (!ctx->pos && !fi->rdc.size) { - fi->rdc.mtime = inode->i_mtime; + fi->rdc.mtime = inode_get_mtime(inode); fi->rdc.iversion = inode_query_iversion(inode); } spin_unlock(&fi->rdc.lock); @@ -488,8 +488,10 @@ static int fuse_readdir_cached(struct file *file, struct dir_context *ctx) * changed, and reset the cache if so. */ if (!ctx->pos) { + struct timespec64 mtime = inode_get_mtime(inode); + if (inode_peek_iversion(inode) != fi->rdc.iversion || - !timespec64_equal(&fi->rdc.mtime, &inode->i_mtime)) { + !timespec64_equal(&fi->rdc.mtime, &mtime)) { fuse_rdc_reset(inode); goto retry_locked; } -- 2.41.0