From: Jeff Layton <jlayton@kernel.org>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
David Sterba <dsterba@suse.cz>,
Amir Goldstein <amir73il@gmail.com>,
Theodore Ts'o <tytso@mit.edu>,
Eric Biederman <ebiederm@xmission.com>,
Kees Cook <keescook@chromium.org>, Jeremy Kerr <jk@ozlabs.org>,
Arnd Bergmann <arnd@arndb.de>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Arve
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org,
linux-s390@vger.kernel.org, platform-driver-x86@vger.kernel.org,
linux-rdma@vger.kernel.org, linux-serial@vger.kernel.org,
linux-usb@vger.kernel.org, v9fs@lists.linux.dev,
linux-afs@lists.infradead.org, autofs@vger.kernel.org,
linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org,
codalist@coda.cs.cmu.edu, linux-efi@vger.kernel.org,
linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, gfs2@lists.linux.dev,
linux-um@lists.infradead.org, linux-mtd@lists.infradead.org,
jfs-discussion@lists.sourceforge.net, linux-nfs@vger.kernel.org,
linux-nilfs@vger.kernel.org,
linux-ntfs-dev@lists.sourceforge.net, ntfs3@lists.linux.dev,
ocfs2-d
Subject: Re: [PATCH 86/87] fs: switch timespec64 fields in inode to discrete integers
Date: Thu, 28 Sep 2023 13:09:08 -0400 [thread overview]
Message-ID: <555fd53b72742fe8a8d2b67c80502f749631d773.camel@kernel.org> (raw)
In-Reply-To: <20230928110554.34758-2-jlayton@kernel.org>
On Thu, 2023-09-28 at 07:05 -0400, Jeff Layton wrote:
> This shaves 8 bytes off struct inode, according to pahole.
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> include/linux/fs.h | 32 +++++++++++++++++++++++---------
> 1 file changed, 23 insertions(+), 9 deletions(-)
>
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 831657011036..de902ff2938b 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -671,9 +671,12 @@ struct inode {
> };
> dev_t i_rdev;
> loff_t i_size;
> - struct timespec64 __i_atime; /* use inode_*_atime accessors */
> - struct timespec64 __i_mtime; /* use inode_*_mtime accessors */
> - struct timespec64 __i_ctime; /* use inode_*_ctime accessors */
> + time64_t i_atime_sec;
> + time64_t i_mtime_sec;
> + time64_t i_ctime_sec;
> + u32 i_atime_nsec;
> + u32 i_mtime_nsec;
> + u32 i_ctime_nsec;
> spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
> unsigned short i_bytes;
> u8 i_blkbits;
> @@ -1519,7 +1522,9 @@ struct timespec64 inode_set_ctime_current(struct inode *inode);
> */
> static inline struct timespec64 inode_get_ctime(const struct inode *inode)
> {
> - return inode->__i_ctime;
> + struct timespec64 ts = { .tv_sec = inode->i_ctime_sec,
> + .tv_nsec = inode->i_ctime_nsec };
> + return ts;
> }
>
>
>
> /**
> @@ -1532,7 +1537,8 @@ static inline struct timespec64 inode_get_ctime(const struct inode *inode)
> static inline struct timespec64 inode_set_ctime_to_ts(struct inode *inode,
> struct timespec64 ts)
> {
> - inode->__i_ctime = ts;
> + inode->i_ctime_sec = ts.tv_sec;
> + inode->i_ctime_nsec = ts.tv_sec;
Bug above and in the other inode_set_?time_to_ts() functions. This isn't
setting the nsec field correctly.
> return ts;
> }
>
>
>
> @@ -1555,13 +1561,17 @@ static inline struct timespec64 inode_set_ctime(struct inode *inode,
>
> static inline struct timespec64 inode_get_atime(const struct inode *inode)
> {
> - return inode->__i_atime;
> + struct timespec64 ts = { .tv_sec = inode->i_atime_sec,
> + .tv_nsec = inode->i_atime_nsec };
> +
> + return ts;
> }
>
> static inline struct timespec64 inode_set_atime_to_ts(struct inode *inode,
> struct timespec64 ts)
> {
> - inode->__i_atime = ts;
> + inode->i_atime_sec = ts.tv_sec;
> + inode->i_atime_nsec = ts.tv_sec;
> return ts;
> }
>
> @@ -1575,13 +1585,17 @@ static inline struct timespec64 inode_set_atime(struct inode *inode,
>
> static inline struct timespec64 inode_get_mtime(const struct inode *inode)
> {
> - return inode->__i_mtime;
> + struct timespec64 ts = { .tv_sec = inode->i_mtime_sec,
> + .tv_nsec = inode->i_mtime_nsec };
> +
> + return ts;
> }
>
> static inline struct timespec64 inode_set_mtime_to_ts(struct inode *inode,
> struct timespec64 ts)
> {
> - inode->__i_mtime = ts;
> + inode->i_atime_sec = ts.tv_sec;
> + inode->i_atime_nsec = ts.tv_sec;
Doh! s/atime/mtime/ in the above lines.
> return ts;
> }
>
Both bugs are fixed in my tree.
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2023-09-28 17:09 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-28 11:05 [PATCH 85/87] fs: rename i_atime and i_mtime fields to __i_atime and __i_mtime Jeff Layton
2023-09-28 11:05 ` [PATCH 86/87] fs: switch timespec64 fields in inode to discrete integers Jeff Layton
2023-09-28 15:48 ` Arnd Bergmann
2023-09-28 17:06 ` Jeff Layton
2023-09-28 17:19 ` Darrick J. Wong
2023-09-28 17:40 ` Jeff Layton
2023-09-28 20:21 ` Arnd Bergmann
2023-09-28 21:26 ` Theodore Ts'o
2023-09-29 0:18 ` Linus Torvalds
2023-09-29 3:50 ` Amir Goldstein
[not found] ` <CAOQ4uxg5ctY9yCjLOjN1nETAcEuNb2UERnYuDv7PoErdxX=WUw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-09-29 16:22 ` Linus Torvalds
2023-09-29 3:27 ` Amir Goldstein
[not found] ` <6a6f37d16b55a3003af3f3dbb7778a367f68cd8d.camel-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2023-09-29 6:32 ` David Howells
2023-09-30 14:50 ` Steve French
2023-10-01 5:01 ` [OT] " Gabriel Paubert
2023-09-29 9:44 ` Christian Brauner
2023-09-29 10:16 ` Jeff Layton
2023-09-28 17:09 ` Jeff Layton [this message]
2023-09-28 11:05 ` [PATCH 87/87] fs: move i_blocks up a few places in struct inode Jeff Layton
2023-09-28 11:35 ` Amir Goldstein
2023-09-28 12:01 ` Jeff Layton
2023-09-28 17:41 ` Linus Torvalds
2023-09-28 18:01 ` Jeff Layton
2023-09-29 9:32 ` Christian Brauner
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=555fd53b72742fe8a8d2b67c80502f749631d773.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=amir73il@gmail.com \
--cc=arnd@arndb.de \
--cc=autofs@vger.kernel.org \
--cc=borntraeger@linux.ibm.com \
--cc=brauner@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=codalist@coda.cs.cmu.edu \
--cc=dsterba@suse.cz \
--cc=ebiederm@xmission.com \
--cc=gfs2@lists.linux.dev \
--cc=gor@linux.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=hca@linux.ibm.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=jk@ozlabs.org \
--cc=keescook@chromium.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-nilfs@vger.kernel.org \
--cc=linux-ntfs-dev@lists.sourceforge.net \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=ntfs3@lists.linux.dev \
--cc=platform-driver-x86@vger.kernel.org \
--cc=svens@linux.ibm.com \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
--cc=v9fs@lists.linux.dev \
--cc=viro@zeniv.linux.org.uk \
/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).