Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp30455829rwd; Thu, 6 Jul 2023 06:16:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlGDCugMc/fez3CJ0UUAS3BdGVbJEuq/hYz82hWwEpUWw73WwucH3N5OBxjJh1YmbGvHIgIU X-Received: by 2002:a92:da4f:0:b0:345:66f5:3404 with SMTP id p15-20020a92da4f000000b0034566f53404mr2152763ilq.0.1688649368710; Thu, 06 Jul 2023 06:16:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688649368; cv=none; d=google.com; s=arc-20160816; b=x6E7a5tF2gBsf8VyobcgDQHkxJqMQe942ZrxmphhypC62I24OrDE5+Jb81FKYNp/aA WAJME5zTpG7fGIjxDXJWxbiGxMjgzCn+cz7J5kt//6k54Zk++VBecq4Wu+uZ70Outab6 4eIISiLL/FNr42r4OStMSgCBvTbIoBwXwQ5doFHezQNYddTy10DX1xw3Z/knqoTKPtoH r7Fi+AjN9wVPLBaHNfBEmyF/2HNREhyoYq9FbL0uq4KKm0TJXzaLFM0/3zu0ytPptUAc IJ+/9O+wWT8gyl5JP9tzHEimyTG3swyZOr4CpQxookKGbc4whwFv1zNb/UbsZRgMZRvP nNpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=tgpL8tfpHtyA7CwvMhj9HF3QvzgD1ZcO/jm2G/w3dOM=; fh=TH3lCKThL6vyDVcIYkdZmq0Ojn1L5qDpKTUg0/+nuh8=; b=SGmCU6mSR3pxMDaVPqkeZjZENxlEiQqkzK4dX6w+OZpJ0wFxsvWuoGJ/+ENuh1O1c0 vQYovt+dWv5U0j7EmgTyciAHbnSCXqmJbf4ATij3VAG3lbxMEGqcyuYJwUpbX1AzyCeD COsUdvZnUEeWTckThi35hqC/d0OQUvPmpUIfRi7oEYEAWhLbEejbfOWi0kTSWZi+43uT 8nNxk6yJEbLeGRiqImKDV7bLgmASznkSLlXEsm5VSqEJxPdHVmD6nGMdOp5isCLKigCA OH1DgzR5ueV8JjLJ9mFy+GlPOMDVgmdeovqpeKWqLvXhWuKMVPMwHzFcEdV16dp5HKrV AEBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hD8s3cac; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n189-20020a6327c6000000b005526bd0c526si1415330pgn.641.2023.07.06.06.15.49; Thu, 06 Jul 2023 06:16:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hD8s3cac; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229547AbjGFNKr (ORCPT + 99 others); Thu, 6 Jul 2023 09:10:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229514AbjGFNKq (ORCPT ); Thu, 6 Jul 2023 09:10:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89DD71FC9; Thu, 6 Jul 2023 06:10:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B0CFB6195C; Thu, 6 Jul 2023 13:10:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D009C433C7; Thu, 6 Jul 2023 13:10:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688649019; bh=U4DQhi7mOPrGgIbuzx0vC/TJNm7AB04bsngGM1ZNiKY=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=hD8s3cacuL+rlBWEE+Y2STmdjnIe2imLtc3s8dw4ZBi02XMCOR+Uzpn5rn+z7Il59 oV8RrIID4kFpmzRqgk7vgpM1rCY0/PSQngyTKcahd28TuconlZPT3/heegUvR6KrP9 U8E9VsTCG/0uv1e5F0oa2RfVHiOrd2B6ym1GKJ9WCosHzReHdvae7YD72qdvEO3o0H HCwAJDBqDmkYHrWNiXSna1aMPh3Wornxb+OH1I6QAidxfg0PzErwxosFufRhPNbs8q B77t6zo5ytlZMqIM79muX1+UpGgun8zGq4Lw7g018DgqzKi84WJP8KfNOXeHp1V3VJ 0x7Al8QvkqQRA== Message-ID: <5290be64ba87d01938c578f49443ce41f9be5e77.camel@kernel.org> Subject: Re: [PATCH v2 42/92] ext4: convert to ctime accessor functions From: Jeff Layton To: Jan Kara Cc: Christian Brauner , Theodore Ts'o , Andreas Dilger , Al Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org Date: Thu, 06 Jul 2023 09:10:17 -0400 In-Reply-To: <20230706123643.3pumra5f4fthz3qq@quack3> References: <20230705185755.579053-1-jlayton@kernel.org> <20230705190309.579783-1-jlayton@kernel.org> <20230705190309.579783-40-jlayton@kernel.org> <20230706123643.3pumra5f4fthz3qq@quack3> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 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,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, 2023-07-06 at 14:36 +0200, Jan Kara wrote: > On Wed 05-07-23 15:01:07, Jeff Layton wrote: > > In later patches, we're going to change how the inode's ctime field is > > used. Switch to using accessor functions instead of raw accesses of > > inode->i_ctime. > >=20 > > Signed-off-by: Jeff Layton >=20 > Some comment below: >=20 > > diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h > > index 0a2d55faa095..d502b930431b 100644 > > --- a/fs/ext4/ext4.h > > +++ b/fs/ext4/ext4.h > > @@ -3823,6 +3823,27 @@ static inline int ext4_buffer_uptodate(struct bu= ffer_head *bh) > > return buffer_uptodate(bh); > > } > > =20 > > +static inline void ext4_inode_set_ctime(struct inode *inode, struct ex= t4_inode *raw_inode) > > +{ > > + struct timespec64 ctime =3D inode_get_ctime(inode); > > + > > + if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), i_ctime_extra)) { > > + raw_inode->i_ctime =3D cpu_to_le32(ctime.tv_sec); > > + raw_inode->i_ctime_extra =3D ext4_encode_extra_time(&ctime); > > + } else { > > + raw_inode->i_ctime =3D cpu_to_le32(clamp_t(int32_t, ctime.tv_sec, S3= 2_MIN, S32_MAX)); > > + } > > +} > > + > > +static inline void ext4_inode_get_ctime(struct inode *inode, const str= uct ext4_inode *raw_inode) > > +{ > > + struct timespec64 ctime =3D { .tv_sec =3D (signed)le32_to_cpu(raw_ino= de->i_ctime) }; > > + > > + if (EXT4_FITS_IN_INODE(raw_inode, EXT4_I(inode), i_ctime_extra)) > > + ext4_decode_extra_time(&ctime, raw_inode->i_ctime_extra); > > + inode_set_ctime(inode, ctime.tv_sec, ctime.tv_nsec); > > +} > > + >=20 > This duplication is kind of unpleasant. I was looking into it for a while > and I think we can rather do some initial cleanup (attached patch 1) and > then your conversion patch would not need to duplicate the conversion cod= e > (see attached patch 2). >=20 > =09 >=20 Thanks Jan. That looks fine at first glance. I'll plan to drop my ext4 patch and replace it with these. Cheers, --=20 Jeff Layton