All of lore.kernel.org
 help / color / mirror / Atom feed
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 Hjønnevåg" <arve@android.com>,
	"Todd Kjos" <tkjos@android.com>,
	"Martijn Coenen" <maco@android.com>,
	"Joel Fernandes" <joel@joelfernandes.org>,
	"Carlos Llamas" <cmllamas@google.com>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Mattia Dongili" <malattia@linux.it>,
	"Dennis Dalessandro" <dennis.dalessandro@cornelisnetworks.com>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Leon Romanovsky" <leon@kernel.org>,
	"Brad Warrum" <bwarrum@linux.ibm.com>,
	"Ritu Agarwal" <rituagar@linux.ibm.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Mark Gross" <markgross@kernel.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Eric Van Hensbergen" <ericvh@kernel.org>,
	"Latchesar Ionkov" <lucho@ionkov.net>,
	"Dominique Martinet" <asmadeus@codewreck.org>,
	"Christian Schoenebeck" <linux_oss@crudebyte.com>,
	"David Sterba" <dsterba@suse.com>,
	"David Howells" <dhowells@redhat.com>,
	"Marc Dionne" <marc.dionne@auristor.com>,
	"Ian Kent" <raven@themaw.net>,
	"Luis de Bethencourt" <luisbg@kernel.org>,
	"Salah Triki" <salah.triki@gmail.com>,
	"Tigran A. Aivazian" <aivazian.tigran@gmail.com>,
	"Chris Mason" <clm@fb.com>, "Josef Bacik" <josef@toxicpanda.com>,
	"Xiubo Li" <xiubli@redhat.com>,
	"Ilya Dryomov" <idryomov@gmail.com>,
	"Jan Harkes" <jaharkes@cs.cmu.edu>,
	coda@cs.cmu.edu, "Joel Becker" <jlbec@evilplan.org>,
	"Christoph Hellwig" <hch@lst.de>,
	"Nicolas Pitre" <nico@fluxnic.net>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"Gao Xiang" <xiang@kernel.org>, "Chao Yu" <chao@kernel.org>,
	"Yue Hu" <huyue2@coolpad.com>,
	"Jeffle Xu" <jefflexu@linux.alibaba.com>,
	"Namjae Jeon" <linkinjeon@kernel.org>,
	"Sungjong Seo" <sj1557.seo@samsung.com>,
	"Jan Kara" <jack@suse.com>,
	"Andreas Dilger" <adilger.kernel@dilger.ca>,
	"Jaegeuk Kim" <jaegeuk@kernel.org>,
	"OGAWA Hirofumi" <hirofumi@mail.parknet.co.jp>,
	"Christoph Hellwig" <hch@infradead.org>,
	"Miklos Szeredi" <miklos@szeredi.hu>,
	"Bob Peterson" <rpeterso@redhat.com>,
	"Andreas Gruenbacher" <agruenba@redhat.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Anton Ivanov" <anton.ivanov@cambridgegreys.com>,
	"Johannes Berg" <johannes@sipsolutions.net>,
	"Mikulas Patocka" <mikulas@artax.karlin.mff.cuni.cz>,
	"Mike Kravetz" <mike.kravetz@oracle.com>,
	"Muchun Song" <muchun.song@linux.dev>, "Jan Kara" <jack@suse.cz>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Dave Kleikamp" <shaggy@kernel.org>, "Tejun Heo" <tj@kernel.org>,
	"Trond Myklebust" <trond.myklebust@hammerspace.com>,
	"Anna Schumaker" <anna@kernel.org>,
	"Chuck Lever" <chuck.lever@oracle.com>,
	"Neil Brown" <neilb@suse.de>,
	"Olga Kornievskaia" <kolga@netapp.com>,
	"Dai Ngo" <Dai.Ngo@oracle.com>, "Tom Talpey" <tom@talpey.com>,
	"Ryusuke Konishi" <konishi.ryusuke@gmail.com>,
	"Anton Altaparmakov" <anton@tuxera.com>,
	"Konstantin Komarov" <almaz.alexandrovich@paragon-software.com>,
	"Mark Fasheh" <mark@fasheh.com>,
	"Joseph Qi" <joseph.qi@linux.alibaba.com>,
	"Bob Copeland" <me@bobcopeland.com>,
	"Mike Marshall" <hubcap@omnibond.com>,
	"Martin Brandenburg" <martin@omnibond.com>,
	"Luis Chamberlain" <mcgrof@kernel.org>,
	"Iurii Zaikin" <yzaikin@google.com>,
	"Tony Luck" <tony.luck@intel.com>,
	"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
	"Anders Larsen" <al@alarsen.net>,
	"Steve French" <sfrench@samba.org>,
	"Paulo Alcantara" <pc@manguebit.com>,
	"Ronnie Sahlberg" <lsahlber@redhat.com>,
	"Shyam Prasad N" <sprasad@microsoft.com>,
	"Sergey Senozhatsky" <senozhatsky@chromium.org>,
	"Phillip Lougher" <phillip@squashfs.org.uk>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Evgeniy Dushistov" <dushistov@mail.ru>,
	"Chandan Babu R" <chandan.babu@oracle.com>,
	"Darrick J. Wong" <djwong@kernel.org>,
	"Damien Le Moal" <dlemoal@kernel.org>,
	"Naohiro Aota" <naohiro.aota@wdc.com>,
	"Johannes Thumshirn" <jth@kernel.org>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Song Liu" <song@kernel.org>,
	"Yonghong Song" <yonghong.song@linux.dev>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"KP Singh" <kpsingh@kernel.org>,
	"Stanislav Fomichev" <sdf@google.com>,
	"Hao Luo" <haoluo@google.com>, "Jiri Olsa" <jolsa@kernel.org>,
	"Hugh Dickins" <hughd@google.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"John Johansen" <john.johansen@canonical.com>,
	"Paul Moore" <paul@paul-moore.com>,
	"James Morris" <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	"Stephen Smalley" <stephen.smalley.work@gmail.com>,
	"Eric Paris" <eparis@parisplace.org>
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-devel@lists.linux.dev,
	linux-karma-devel@lists.sourceforge.net,
	devel@lists.orangefs.org, linux-unionfs@vger.kernel.org,
	linux-hardening@vger.kernel.org, reiserfs-devel@vger.kernel.org,
	linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
	linux-trace-kernel@vger.kernel.org, linux-xfs@vger.kernel.org,
	bpf@vger.kernel.org, netdev@vger.kernel.org,
	apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org,
	selinux@vger.kernel.org
Subject: [PATCH 86/87] fs: switch timespec64 fields in inode to discrete integers
Date: Thu, 28 Sep 2023 07:05:53 -0400	[thread overview]
Message-ID: <20230928110554.34758-2-jlayton@kernel.org> (raw)
In-Reply-To: <20230928110554.34758-1-jlayton@kernel.org>

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;
 	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;
 	return ts;
 }
 
-- 
2.41.0


WARNING: multiple messages have this Message-ID (diff)
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 Hjønnevåg" <arve@android.com>,
	"Todd Kjos" <tkjos@android.com>,
	"Martijn Coenen" <maco@android.com>,
	"Joel Fernandes" <joel@joelfernandes.org>,
	"Carlos Llamas" <cmllamas@google.com>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Mattia Dongili" <malattia@linux.it>,
	"Dennis Dalessandro" <dennis.dalessandro@cornelisnetworks.com>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Leon Romanovsky" <leon@kernel.org>,
	"Brad Warrum" <bwarrum@linux.ibm.com>,
	"Ritu Agarwal" <rituagar@linux.ibm.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Mark Gross" <markgross@kernel.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Eric Van Hensbergen" <ericvh@kernel.org>,
	"Latchesar Ionkov" <lucho@ionkov.net>,
	"Dominique Martinet" <asmadeus@codewreck.org>,
	"Christian Schoenebeck" <linux_oss@crudebyte.com>,
	"David Sterba" <dsterba@suse.com>,
	"David Howells" <dhowells@redhat.com>,
	"Marc Dionne" <marc.dionne@auristor.com>,
	"Ian Kent" <raven@themaw.net>,
	"Luis de Bethencourt" <luisbg@kernel.org>,
	"Salah Triki" <salah.triki@gmail.com>,
	"Tigran A. Aivazian" <aivazian.tigran@gmail.com>,
	"Chris Mason" <clm@fb.com>, "Josef Bacik" <josef@toxicpanda.com>,
	"Xiubo Li" <xiubli@redhat.com>,
	"Ilya Dryomov" <idryomov@gmail.com>,
	"Jan Harkes" <jaharkes@cs.cmu.edu>,
	coda@cs.cmu.edu, "Joel Becker" <jlbec@evilplan.org>,
	"Christoph Hellwig" <hch@lst.de>,
	"Nicolas Pitre" <nico@fluxnic.net>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"Gao Xiang" <xiang@kernel.org>, "Chao Yu" <chao@kernel.org>,
	"Yue Hu" <huyue2@coolpad.com>,
	"Jeffle Xu" <jefflexu@linux.alibaba.com>,
	"Namjae Jeon" <linkinjeon@kernel.org>,
	"Sungjong Seo" <sj1557.seo@samsung.com>,
	"Jan Kara" <jack@suse.com>,
	"Andreas Dilger" <adilger.kernel@dilger.ca>,
	"Jaegeuk Kim" <jaegeuk@kernel.org>,
	"OGAWA Hirofumi" <hirofumi@mail.parknet.co.jp>,
	"Christoph Hellwig" <hch@infradead.org>,
	"Miklos Szeredi" <miklos@szeredi.hu>,
	"Bob Peterson" <rpeterso@redhat.com>,
	"Andreas Gruenbacher" <agruenba@redhat.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Anton Ivanov" <anton.ivanov@cambridgegreys.com>,
	"Johannes Berg" <johannes@sipsolutions.net>,
	"Mikulas Patocka" <mikulas@artax.karlin.mff.cuni.cz>,
	"Mike Kravetz" <mike.kravetz@oracle.com>,
	"Muchun Song" <muchun.song@linux.dev>, "Jan Kara" <jack@suse.cz>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Dave Kleikamp" <shaggy@kernel.org>, "Tejun Heo" <tj@kernel.org>,
	"Trond Myklebust" <trond.myklebust@hammerspace.com>,
	"Anna Schumaker" <anna@kernel.org>,
	"Chuck Lever" <chuck.lever@oracle.com>,
	"Neil Brown" <neilb@suse.de>,
	"Olga Kornievskaia" <kolga@netapp.com>,
	"Dai Ngo" <Dai.Ngo@oracle.com>, "Tom Talpey" <tom@talpey.com>,
	"Ryusuke Konishi" <konishi.ryusuke@gmail.com>,
	"Anton Altaparmakov" <anton@tuxera.com>,
	"Konstantin Komarov" <almaz.alexandrovich@paragon-software.com>,
	"Mark Fasheh" <mark@fasheh.com>,
	"Joseph Qi" <joseph.qi@linux.alibaba.com>,
	"Bob Copeland" <me@bobcopeland.com>,
	"Mike Marshall" <hubcap@omnibond.com>,
	"Martin Brandenburg" <martin@omnibond.com>,
	"Luis Chamberlain" <mcgrof@kernel.org>,
	"Iurii Zaikin" <yzaikin@google.com>,
	"Tony Luck" <tony.luck@intel.com>,
	"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
	"Anders Larsen" <al@alarsen.net>,
	"Steve French" <sfrench@samba.org>,
	"Paulo Alcantara" <pc@manguebit.com>,
	"Ronnie Sahlberg" <lsahlber@redhat.com>,
	"Shyam Prasad N" <sprasad@microsoft.com>,
	"Sergey Senozhatsky" <senozhatsky@chromium.org>,
	"Phillip Lougher" <phillip@squashfs.org.uk>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Evgeniy Dushistov" <dushistov@mail.ru>,
	"Chandan Babu R" <chandan.babu@oracle.com>,
	"Darrick J. Wong" <djwong@kernel.org>,
	"Damien Le Moal" <dlemoal@kernel.org>,
	"Naohiro Aota" <naohiro.aota@wdc.com>,
	"Johannes Thumshirn" <jth@kernel.org>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Song Liu" <song@kernel.org>,
	"Yonghong Song" <yonghong.song@linux.dev>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"KP Singh" <kpsingh@kernel.org>,
	"Stanislav Fomichev" <sdf@google.com>,
	"Hao Luo" <haoluo@google.com>, "Jiri Olsa" <jolsa@kernel.org>,
	"Hugh Dickins" <hughd@google.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"John Johansen" <john.johansen@canonical.com>,
	"Paul Moore" <paul@paul-moore.com>,
	"James Morris" <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	"Stephen Smalley" <stephen.smalley.work@gmail.com>,
	"Eric Paris" <eparis@parisplace.org>
Cc: jfs-discussion@lists.sourceforge.net, linux-efi@vger.kernel.org,
	platform-driver-x86@vger.kernel.org, gfs2@lists.linux.dev,
	linux-mm@kvack.org, linux-mtd@lists.infradead.org,
	linux-hardening@vger.kernel.org, linux-afs@lists.infradead.org,
	linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org,
	linux-rdma@vger.kernel.org, linux-unionfs@vger.kernel.org,
	codalist@coda.cs.cmu.edu, linux-serial@vger.kernel.org,
	linux-ext4@vger.kernel.org, devel@lists.orangefs.org,
	linux-trace-kernel@vger.kernel.org, linux-cifs@vger.kernel.org,
	selinux@vger.kernel.org, apparmor@lists.ubuntu.com,
	autofs@vger.kernel.org, linux-um@lists.infradead.org,
	reiserfs-devel@vger.kernel.org, ocfs2-devel@lists.linux.dev,
	ceph-devel@vger.kernel.org, linux-nfs@vger.kernel.org,
	linux-ntfs-dev@lists.sourceforge.net,
	linuxppc-dev@lists.ozlabs.org, v9fs@lists.linux.dev,
	linux-usb@vger.kernel.org, samba-technical@lists.samba.org,
	linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-xfs@vger.kernel.org, linux-security-module@vger.kernel.org,
	netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	bpf@vger.kernel.org, ntfs3@lists.linux.dev,
	linux-erofs@lists.ozlabs.org,
	linux-karma-devel@lists.sourceforge.net,
	linux-btrfs@vger.kernel.org
Subject: [f2fs-dev] [PATCH 86/87] fs: switch timespec64 fields in inode to discrete integers
Date: Thu, 28 Sep 2023 07:05:53 -0400	[thread overview]
Message-ID: <20230928110554.34758-2-jlayton@kernel.org> (raw)
In-Reply-To: <20230928110554.34758-1-jlayton@kernel.org>

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;
 	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;
 	return ts;
 }
 
-- 
2.41.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

WARNING: multiple messages have this Message-ID (diff)
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 Hjønnevåg" <arve@android.com>,
	"Todd Kjos" <tkjos@android.com>,
	"Martijn Coenen" <maco@android.com>,
	"Joel Fernandes" <joel@joelfernandes.org>,
	"Carlos Llamas" <cmllamas@google.com>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Mattia Dongili" <malattia@linux.it>,
	"Dennis Dalessandro" <dennis.dalessandro@cornelisnetworks.com>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Leon Romanovsky" <leon@kernel.org>,
	"Brad Warrum" <bwarrum@linux.ibm.com>,
	"Ritu Agarwal" <rituagar@linux.ibm.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Mark Gross" <markgross@kernel.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Eric Van Hensbergen" <ericvh@kernel.org>,
	"Latchesar Ionkov" <lucho@ionkov.net>,
	"Dominique Martinet" <asmadeus@codewreck.org>,
	"Christian Schoenebeck" <linux_oss@crudebyte.com>,
	"David Sterba" <dsterba@suse.com>,
	"David Howells" <dhowells@redhat.com>,
	"Marc Dionne" <marc.dionne@auristor.com>,
	"Ian Kent" <raven@themaw.net>,
	"Luis de Bethencourt" <luisbg@kernel.org>,
	"Salah Triki" <salah.triki@gmail.com>,
	"Tigran A. Aivazian" <aivazian.tigran@gmail.com>,
	"Chris Mason" <clm@fb.com>, "Josef Bacik" <josef@toxicpanda.com>,
	"Xiubo Li" <xiubli@redhat.com>,
	"Ilya Dryomov" <idryomov@gmail.com>,
	"Jan Harkes" <jaharkes@cs.cmu.edu>,
	coda@cs.cmu.edu, "Joel Becker" <jlbec@evilplan.org>,
	"Christoph Hellwig" <hch@lst.de>,
	"Nicolas Pitre" <nico@fluxnic.net>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"Gao Xiang" <xiang@kernel.org>, "Chao Yu" <chao@kernel.org>,
	"Yue Hu" <huyue2@coolpad.com>,
	"Jeffle Xu" <jefflexu@linux.alibaba.com>,
	"Namjae Jeon" <linkinjeon@kernel.org>,
	"Sungjong Seo" <sj1557.seo@samsung.com>,
	"Jan Kara" <jack@suse.com>,
	"Andreas Dilger" <adilger.kernel@dilger.ca>,
	"Jaegeuk Kim" <jaegeuk@kernel.org>,
	"OGAWA Hirofumi" <hirofumi@mail.parknet.co.jp>,
	"Christoph Hellwig" <hch@infradead.org>,
	"Miklos Szeredi" <miklos@szeredi.hu>,
	"Bob Peterson" <rpeterso@redhat.com>,
	"Andreas Gruenbacher" <agruenba@redhat.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Anton Ivanov" <anton.ivanov@cambridgegreys.com>,
	"Johannes Berg" <johannes@sipsolutions.net>,
	"Mikulas Patocka" <mikulas@artax.karlin.mff.cuni.cz>,
	"Mike Kravetz" <mike.kravetz@oracle.com>,
	"Muchun Song" <muchun.song@linux.dev>, "Jan Kara" <jack@suse.cz>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Dave Kleikamp" <shaggy@kernel.org>, "Tejun Heo" <tj@kernel.org>,
	"Trond Myklebust" <trond.myklebust@hammerspace.com>,
	"Anna Schumaker" <anna@kernel.org>,
	"Chuck Lever" <chuck.lever@oracle.com>,
	"Neil Brown" <neilb@suse.de>,
	"Olga Kornievskaia" <kolga@netapp.com>,
	"Dai Ngo" <Dai.Ngo@oracle.com>, "Tom Talpey" <tom@talpey.com>,
	"Ryusuke Konishi" <konishi.ryusuke@gmail.com>,
	"Anton Altaparmakov" <anton@tuxera.com>,
	"Konstantin Komarov" <almaz.alexandrovich@paragon-software.com>,
	"Mark Fasheh" <mark@fasheh.com>,
	"Joseph Qi" <joseph.qi@linux.alibaba.com>,
	"Bob Copeland" <me@bobcopeland.com>,
	"Mike Marshall" <hubcap@omnibond.com>,
	"Martin Brandenburg" <martin@omnibond.com>,
	"Luis Chamberlain" <mcgrof@kernel.org>,
	"Iurii Zaikin" <yzaikin@google.com>,
	"Tony Luck" <tony.luck@intel.com>,
	"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
	"Anders Larsen" <al@alarsen.net>,
	"Steve French" <sfrench@samba.org>,
	"Paulo Alcantara" <pc@manguebit.com>,
	"Ronnie Sahlberg" <lsahlber@redhat.com>,
	"Shyam Prasad N" <sprasad@microsoft.com>,
	"Sergey Senozhatsky" <senozhatsky@chromium.org>,
	"Phillip Lougher" <phillip@squashfs.org.uk>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Evgeniy Dushistov" <dushistov@mail.ru>,
	"Chandan Babu R" <chandan.babu@oracle.com>,
	"Darrick J. Wong" <djwong@kernel.org>,
	"Damien Le Moal" <dlemoal@kernel.org>,
	"Naohiro Aota" <naohiro.aota@wdc.com>,
	"Johannes Thumshirn" <jth@kernel.org>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Song Liu" <song@kernel.org>,
	"Yonghong Song" <yonghong.song@linux.dev>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"KP Singh" <kpsingh@kernel.org>,
	"Stanislav Fomichev" <sdf@google.com>,
	"Hao Luo" <haoluo@google.com>, "Jiri Olsa" <jolsa@kernel.org>,
	"Hugh Dickins" <hughd@google.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"John Johansen" <john.johansen@canonical.com>,
	"Paul Moore" <paul@paul-moore.com>,
	"James Morris" <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	"Stephen Smalley" <stephen.smalley.work@gmail.com>,
	"Eric Paris" <eparis@parisplace.org>
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-devel@lists.linux.dev,
	linux-karma-devel@lists.sourceforge.net,
	devel@lists.orangefs.org, linux-unionfs@vger.kernel.org,
	linux-hardening@vger.kernel.org, reiserfs-devel@vger.kernel.org,
	linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
	linux-trace-kernel@vger.kernel.org, linux-xfs@vger.kernel.org,
	bpf@vger.kernel.org, netdev@vger.kernel.org,
	apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org,
	selinux@vger.kernel.org
Subject: [PATCH 86/87] fs: switch timespec64 fields in inode to discrete integers
Date: Thu, 28 Sep 2023 07:05:53 -0400	[thread overview]
Message-ID: <20230928110554.34758-2-jlayton@kernel.org> (raw)
In-Reply-To: <20230928110554.34758-1-jlayton@kernel.org>

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;
 	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;
 	return ts;
 }
 
-- 
2.41.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
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 Hjønnevåg" <arve@android.com>,
	"Todd Kjos" <tkjos@android.com>,
	"Martijn Coenen" <maco@android.com>,
	"Joel Fernandes" <joel@joelfernandes.org>,
	"Carlos Llamas" <cmllamas@google.com>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Mattia Dongili" <malattia@linux.it>,
	"Dennis Dalessandro" <dennis.dalessandro@cornelisnetworks.com>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Leon Romanovsky" <leon@kernel.org>,
	"Brad Warrum" <bwarrum@linux.ibm.com>,
	"Ritu Agarwal" <rituagar@linux.ibm.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Mark Gross" <markgross@kernel.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Eric Van Hensbergen" <ericvh@kernel.org>,
	"Latchesar Ionkov" <lucho@ionkov.net>,
	"Dominique Martinet" <asmadeus@codewreck.org>,
	"Christian Schoenebeck" <linux_oss@crudebyte.com>,
	"David Sterba" <dsterba@suse.com>,
	"David Howells" <dhowells@redhat.com>,
	"Marc Dionne" <marc.dionne@auristor.com>,
	"Ian Kent" <raven@themaw.net>,
	"Luis de Bethencourt" <luisbg@kernel.org>,
	"Salah Triki" <salah.triki@gmail.com>,
	"Tigran A. Aivazian" <aivazian.tigran@gmail.com>,
	"Chris Mason" <clm@fb.com>, "Josef Bacik" <josef@toxicpanda.com>,
	"Xiubo Li" <xiubli@redhat.com>,
	"Ilya Dryomov" <idryomov@gmail.com>,
	"Jan Harkes" <jaharkes@cs.cmu.edu>,
	coda@cs.cmu.edu, "Joel Becker" <jlbec@evilplan.org>,
	"Christoph Hellwig" <hch@lst.de>,
	"Nicolas Pitre" <nico@fluxnic.net>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"Gao Xiang" <xiang@kernel.org>, "Chao Yu" <chao@kernel.org>,
	"Yue Hu" <huyue2@coolpad.com>,
	"Jeffle Xu" <jefflexu@linux.alibaba.com>,
	"Namjae Jeon" <linkinjeon@kernel.org>,
	"Sungjong Seo" <sj1557.seo@samsung.com>,
	"Jan Kara" <jack@suse.com>,
	"Andreas Dilger" <adilger.kernel@dilger.ca>,
	"Jaegeuk Kim" <jaegeuk@kernel.org>,
	"OGAWA Hirofumi" <hirofumi@mail.parknet.co.jp>,
	"Christoph Hellwig" <hch@infradead.org>,
	"Miklos Szeredi" <miklos@szeredi.hu>,
	"Bob Peterson" <rpeterso@redhat.com>,
	"Andreas Gruenbacher" <agruenba@redhat.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Anton Ivanov" <anton.ivanov@cambridgegreys.com>,
	"Johannes Berg" <johannes@sipsolutions.net>,
	"Mikulas Patocka" <mikulas@artax.karlin.mff.cuni.cz>,
	"Mike Kravetz" <mike.kravetz@oracle.com>,
	"Muchun Song" <muchun.song@linux.dev>, "Jan Kara" <jack@suse.cz>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Dave Kleikamp" <shaggy@kernel.org>, "Tejun Heo" <tj@kernel.org>,
	"Trond Myklebust" <trond.myklebust@hammerspace.com>,
	"Anna Schumaker" <anna@kernel.org>,
	"Chuck Lever" <chuck.lever@oracle.com>,
	"Neil Brown" <neilb@suse.de>,
	"Olga Kornievskaia" <kolga@netapp.com>,
	"Dai Ngo" <Dai.Ngo@oracle.com>, "Tom Talpey" <tom@talpey.com>,
	"Ryusuke Konishi" <konishi.ryusuke@gmail.com>,
	"Anton Altaparmakov" <anton@tuxera.com>,
	"Konstantin Komarov" <almaz.alexandrovich@paragon-software.com>,
	"Mark Fasheh" <mark@fasheh.com>,
	"Joseph Qi" <joseph.qi@linux.alibaba.com>,
	"Bob Copeland" <me@bobcopeland.com>,
	"Mike Marshall" <hubcap@omnibond.com>,
	"Martin Brandenburg" <martin@omnibond.com>,
	"Luis Chamberlain" <mcgrof@kernel.org>,
	"Iurii Zaikin" <yzaikin@google.com>,
	"Tony Luck" <tony.luck@intel.com>,
	"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
	"Anders Larsen" <al@alarsen.net>,
	"Steve French" <sfrench@samba.org>,
	"Paulo Alcantara" <pc@manguebit.com>,
	"Ronnie Sahlberg" <lsahlber@redhat.com>,
	"Shyam Prasad N" <sprasad@microsoft.com>,
	"Sergey Senozhatsky" <senozhatsky@chromium.org>,
	"Phillip Lougher" <phillip@squashfs.org.uk>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Evgeniy Dushistov" <dushistov@mail.ru>,
	"Chandan Babu R" <chandan.babu@oracle.com>,
	"Darrick J. Wong" <djwong@kernel.org>,
	"Damien Le Moal" <dlemoal@kernel.org>,
	"Naohiro Aota" <naohiro.aota@wdc.com>,
	"Johannes Thumshirn" <jth@kernel.org>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Song Liu" <song@kernel.org>,
	"Yonghong Song" <yonghong.song@linux.dev>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"KP Singh" <kpsingh@kernel.org>,
	"Stanislav Fomichev" <sdf@google.com>,
	"Hao Luo" <haoluo@google.com>, "Jiri Olsa" <jolsa@kernel.org>,
	"Hugh Dickins" <hughd@google.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"John Johansen" <john.johansen@canonical.com>,
	"Paul Moore" <paul@paul-moore.com>,
	"James Morris" <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	"Stephen Smalley" <stephen.smalley.work@gmail.com>,
	"Eric Paris" <eparis@parisplace.org>
Cc: jfs-discussion@lists.sourceforge.net, linux-efi@vger.kernel.org,
	platform-driver-x86@vger.kernel.org, gfs2@lists.linux.dev,
	linux-mm@kvack.org, linux-mtd@lists.infradead.org,
	linux-hardening@vger.kernel.org, linux-afs@lists.infradead.org,
	linux-s390@vger.kernel.org, linux-nilfs@vger.kernel.org,
	linux-rdma@vger.kernel.org, linux-unionfs@vger.kernel.org,
	codalist@coda.cs.cmu.edu, linux-serial@vger.kernel.org,
	linux-ext4@vger.kernel.org, devel@lists.orangefs.org,
	linux-trace-kernel@vger.kernel.org, linux-cifs@vger.kernel.org,
	selinux@vger.kernel.org, apparmor@lists.ubuntu.com,
	autofs@vger.kernel.org, linux-um@lists.infradead.org,
	reiserfs-devel@vger.kernel.org, ocfs2-devel@lists.linux.dev,
	ceph-devel@vger.kernel.org, linux-nfs@vger.kernel.org,
	linux-ntfs-dev@lists.sourceforge.net,
	linuxppc-dev@lists.ozlabs.org, v9fs@lists.linux.dev,
	linux-usb@vger.kernel.org, samba-technical@lists.samba.org,
	linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-xfs@vger.kernel. org,
	linux-security-module@vger.kernel.org, netdev@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, bpf@vger.kernel.org,
	ntfs3@lists.linux.dev, linux-erofs@lists.ozlabs.org,
	linux-karma-devel@lists.sourceforge.net,
	linux-btrfs@vger.kernel.org
Subject: [PATCH 86/87] fs: switch timespec64 fields in inode to discrete integers
Date: Thu, 28 Sep 2023 07:05:53 -0400	[thread overview]
Message-ID: <20230928110554.34758-2-jlayton@kernel.org> (raw)
In-Reply-To: <20230928110554.34758-1-jlayton@kernel.org>

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;
 	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;
 	return ts;
 }
 
-- 
2.41.0


WARNING: multiple messages have this Message-ID (diff)
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 Hjønnevåg" <arve@android.com>,
	"Todd Kjos" <tkjos@android.com>,
	"Martijn Coenen" <maco@android.com>,
	"Joel Fernandes" <joel@joelfernandes.org>,
	"Carlos Llamas" <cmllamas@google.com>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Mattia Dongili" <malattia@linux.it>,
	"Dennis Dalessandro" <dennis.dalessandro@cornelisnetworks.com>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Leon Romanovsky" <leon@kernel.org>,
	"Brad Warrum" <bwarrum@linux.ibm.com>,
	"Ritu Agarwal" <rituagar@linux.ibm.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Mark Gross" <markgross@kernel.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Eric Van Hensbergen" <ericvh@kernel.org>,
	"Latchesar Ionkov" <lucho@ionkov.net>,
	"Dominique Martinet" <asmadeus@codewreck.org>,
	"Christian Schoenebeck" <linux_oss@crudebyte.com>,
	"David Sterba" <dsterba@suse.com>,
	"David Howells" <dhowells@redhat.com>,
	"Marc Dionne" <marc.dionne@auristor.com>,
	"Ian Kent" <raven@themaw.net>,
	"Luis de Bethencourt" <luisbg@kernel.org>,
	"Salah Triki" <salah.triki@gmail.com>,
	"Tigran A. Aivazian" <aivazian.tigran@gmail.com>,
	"Chris Mason" <clm@fb.com>, "Josef Bacik" <josef@toxicpanda.com>,
	"Xiubo Li" <xiubli@redhat.com>,
	"Ilya Dryomov" <idryomov@gmail.com>,
	"Jan Harkes" <jaharkes@cs.cmu.edu>,
	coda@cs.cmu.edu, "Joel Becker" <jlbec@evilplan.org>,
	"Christoph Hellwig" <hch@lst.de>,
	"Nicolas Pitre" <nico@fluxnic.net>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Ard Biesheuvel" <ardb@kernel.org>,
	"Gao Xiang" <xiang@kernel.org>, "Chao Yu" <chao@kernel.org>,
	"Yue Hu" <huyue2@coolpad.com>,
	"Jeffle Xu" <jefflexu@linux.alibaba.com>,
	"Namjae Jeon" <linkinjeon@kernel.org>,
	"Sungjong Seo" <sj1557.seo@samsung.com>,
	"Jan Kara" <jack@suse.com>,
	"Andreas Dilger" <adilger.kernel@dilger.ca>,
	"Jaegeuk Kim" <jaegeuk@kernel.org>,
	"OGAWA Hirofumi" <hirofumi@mail.parknet.co.jp>,
	"Christoph Hellwig" <hch@infradead.org>,
	"Miklos Szeredi" <miklos@szeredi.hu>,
	"Bob Peterson" <rpeterso@redhat.com>,
	"Andreas Gruenbacher" <agruenba@redhat.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Anton Ivanov" <anton.ivanov@cambridgegreys.com>,
	"Johannes Berg" <johannes@sipsolutions.net>,
	"Mikulas Patocka" <mikulas@artax.karlin.mff.cuni.cz>,
	"Mike Kravetz" <mike.kravetz@oracle.com>,
	"Muchun Song" <muchun.song@linux.dev>, "Jan Kara" <jack@suse.cz>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Dave Kleikamp" <shaggy@kernel.org>, "Tejun Heo" <tj@kernel.org>,
	"Trond Myklebust" <trond.myklebust@hammerspace.com>,
	"Anna Schumaker" <anna@kernel.org>,
	"Chuck Lever" <chuck.lever@oracle.com>,
	"Neil Brown" <neilb@suse.de>,
	"Olga Kornievskaia" <kolga@netapp.com>,
	"Dai Ngo" <Dai.Ngo@oracle.com>, "Tom Talpey" <tom@talpey.com>,
	"Ryusuke Konishi" <konishi.ryusuke@gmail.com>,
	"Anton Altaparmakov" <anton@tuxera.com>,
	"Konstantin Komarov" <almaz.alexandrovich@paragon-software.com>,
	"Mark Fasheh" <mark@fasheh.com>,
	"Joseph Qi" <joseph.qi@linux.alibaba.com>,
	"Bob Copeland" <me@bobcopeland.com>,
	"Mike Marshall" <hubcap@omnibond.com>,
	"Martin Brandenburg" <martin@omnibond.com>,
	"Luis Chamberlain" <mcgrof@kernel.org>,
	"Iurii Zaikin" <yzaikin@google.com>,
	"Tony Luck" <tony.luck@intel.com>,
	"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
	"Anders Larsen" <al@alarsen.net>,
	"Steve French" <sfrench@samba.org>,
	"Paulo Alcantara" <pc@manguebit.com>,
	"Ronnie Sahlberg" <lsahlber@redhat.com>,
	"Shyam Prasad N" <sprasad@microsoft.com>,
	"Sergey Senozhatsky" <senozhatsky@chromium.org>,
	"Phillip Lougher" <phillip@squashfs.org.uk>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Evgeniy Dushistov" <dushistov@mail.ru>,
	"Chandan Babu R" <chandan.babu@oracle.com>,
	"Darrick J. Wong" <djwong@kernel.org>,
	"Damien Le Moal" <dlemoal@kernel.org>,
	"Naohiro Aota" <naohiro.aota@wdc.com>,
	"Johannes Thumshirn" <jth@kernel.org>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"Song Liu" <song@kernel.org>,
	"Yonghong Song" <yonghong.song@linux.dev>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"KP Singh" <kpsingh@kernel.org>,
	"Stanislav Fomichev" <sdf@google.com>,
	"Hao Luo" <haoluo@google.com>, "Jiri Olsa" <jolsa@kernel.org>,
	"Hugh Dickins" <hughd@google.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"John Johansen" <john.johansen@canonical.com>,
	"Paul Moore" <paul@paul-moore.com>,
	"James Morris" <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	"Stephen Smalley" <stephen.smalley.work@gmail.com>,
	"Eric Paris" <eparis@parisplace.org>
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-devel@lists.linux.dev,
	linux-karma-devel@lists.sourceforge.net,
	devel@lists.orangefs.org, linux-unionfs@vger.kernel.org,
	linux-hardening@vger.kernel.org, reiserfs-devel@vger.kernel.org,
	linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
	linux-trace-kernel@vger.kernel.org, linux-xfs@vger.kernel.org,
	bpf@vger.kernel.org, netdev@vger.kernel.org,
	apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org,
	selinux@vger.kernel.org
Subject: [PATCH 86/87] fs: switch timespec64 fields in inode to discrete integers
Date: Thu, 28 Sep 2023 07:05:53 -0400	[thread overview]
Message-ID: <20230928110554.34758-2-jlayton@kernel.org> (raw)
In-Reply-To: <20230928110554.34758-1-jlayton@kernel.org>

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;
 	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;
 	return ts;
 }
 
-- 
2.41.0


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

WARNING: multiple messages have this Message-ID (diff)
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 Hjønnevåg" <arve@android.com>,
	"Todd Kjos" <tkjos@android.com>,
	"Martijn Coenen" <maco@android.com>
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-devel@lists.linux.dev,
	linux-karma-devel@lists.sourceforge.net, devel@lists.
Subject: [PATCH 86/87] fs: switch timespec64 fields in inode to discrete integers
Date: Thu, 28 Sep 2023 07:05:53 -0400	[thread overview]
Message-ID: <20230928110554.34758-2-jlayton@kernel.org> (raw)
In-Reply-To: <20230928110554.34758-1-jlayton@kernel.org>

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;
 	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;
 	return ts;
 }
 
-- 
2.41.0



  reply	other threads:[~2023-09-28 11:06 UTC|newest]

Thread overview: 161+ 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 ` Jeff Layton
2023-09-28 11:05 ` Jeff Layton
2023-09-28 11:05 ` Jeff Layton
2023-09-28 11:05 ` Jeff Layton
2023-09-28 11:05 ` [f2fs-dev] " Jeff Layton
2023-09-28 11:05 ` Jeff Layton [this message]
2023-09-28 11:05   ` [PATCH 86/87] fs: switch timespec64 fields in inode to discrete integers Jeff Layton
2023-09-28 11:05   ` Jeff Layton
2023-09-28 11:05   ` Jeff Layton
2023-09-28 11:05   ` Jeff Layton
2023-09-28 11:05   ` [f2fs-dev] " Jeff Layton
2023-09-28 15:48   ` Arnd Bergmann
2023-09-28 15:48     ` Arnd Bergmann
2023-09-28 15:48     ` Arnd Bergmann
2023-09-28 15:48     ` Arnd Bergmann
2023-09-28 15:48     ` [f2fs-dev] " Arnd Bergmann
2023-09-28 15:48     ` Arnd Bergmann
2023-09-28 17:06     ` Jeff Layton
2023-09-28 17:06       ` Jeff Layton
2023-09-28 17:06       ` Jeff Layton
2023-09-28 17:06       ` Jeff Layton
2023-09-28 17:06       ` Jeff Layton
2023-09-28 17:06       ` [f2fs-dev] " Jeff Layton
2023-09-28 17:19       ` Darrick J. Wong
2023-09-28 17:19         ` Darrick J. Wong
2023-09-28 17:19         ` Darrick J. Wong
2023-09-28 17:19         ` Darrick J. Wong
2023-09-28 17:19         ` Darrick J. Wong
2023-09-28 17:19         ` Darrick J. Wong
2023-09-28 17:19         ` [f2fs-dev] " Darrick J. Wong
2023-09-28 17:40         ` Jeff Layton
2023-09-28 17:40           ` Jeff Layton
2023-09-28 17:40           ` Jeff Layton
2023-09-28 17:40           ` Jeff Layton
2023-09-28 17:40           ` Jeff Layton
2023-09-28 17:40           ` Jeff Layton
2023-09-28 17:40           ` [f2fs-dev] " Jeff Layton
2023-09-28 20:21           ` Arnd Bergmann
2023-09-28 20:21             ` Arnd Bergmann
2023-09-28 20:21             ` Arnd Bergmann
2023-09-28 20:21             ` Arnd Bergmann
2023-09-28 20:21             ` Arnd Bergmann
2023-09-28 20:21             ` Arnd Bergmann
2023-09-28 20:21             ` [f2fs-dev] " Arnd Bergmann
2023-09-28 21:26           ` Theodore Ts'o
2023-09-28 21:26             ` Theodore Ts'o
2023-09-28 21:26             ` Theodore Ts'o
2023-09-28 21:26             ` Theodore Ts'o
2023-09-28 21:26             ` Theodore Ts'o
2023-09-28 21:26             ` Theodore Ts'o
2023-09-28 21:26             ` [f2fs-dev] " Theodore Ts'o
2023-09-29  0:18             ` Linus Torvalds
2023-09-29  0:18               ` Linus Torvalds
2023-09-29  0:18               ` Linus Torvalds
2023-09-29  0:18               ` Linus Torvalds
2023-09-29  0:18               ` Linus Torvalds
2023-09-29  0:18               ` Linus Torvalds
2023-09-29  0:18               ` [f2fs-dev] " Linus Torvalds
2023-09-29  3:50               ` Amir Goldstein
2023-09-29  3:50                 ` Amir Goldstein
2023-09-29  3:50                 ` Amir Goldstein
2023-09-29  3:50                 ` Amir Goldstein
2023-09-29  3:50                 ` Amir Goldstein
2023-09-29  3:50                 ` Amir Goldstein
2023-09-29  3:50                 ` [f2fs-dev] " Amir Goldstein
2023-09-29 16:22                 ` Linus Torvalds
2023-09-29 16:22                   ` Linus Torvalds
2023-09-29 16:22                   ` Linus Torvalds
2023-09-29 16:22                   ` Linus Torvalds
2023-09-29 16:22                   ` Linus Torvalds
2023-09-29 16:22                   ` [f2fs-dev] " Linus Torvalds
2023-09-29 16:22                   ` Linus Torvalds
2023-09-29  3:27         ` Amir Goldstein
2023-09-29  3:27           ` Amir Goldstein
2023-09-29  3:27           ` Amir Goldstein
2023-09-29  3:27           ` Amir Goldstein
2023-09-29  3:27           ` Amir Goldstein
2023-09-29  3:27           ` Amir Goldstein
2023-09-29  3:27           ` [f2fs-dev] " Amir Goldstein
2023-09-29  6:32         ` David Howells
2023-09-29  6:32           ` David Howells
2023-09-29  6:32           ` David Howells
2023-09-29  6:32           ` David Howells
2023-09-29  6:32           ` David Howells
2023-09-29  6:32           ` David Howells
2023-09-29  6:32           ` [f2fs-dev] " David Howells
2023-09-30 14:50           ` Steve French
2023-09-30 14:50             ` Steve French
2023-09-30 14:50             ` Steve French
2023-09-30 14:50             ` Steve French
2023-09-30 14:50             ` Steve French
2023-09-30 14:50             ` Steve French
2023-09-30 14:50             ` [f2fs-dev] " Steve French
2023-10-01  5:01             ` [OT] " Gabriel Paubert
2023-10-01  5:01               ` Gabriel Paubert
2023-10-01  5:01               ` Gabriel Paubert
2023-10-01  5:01               ` Gabriel Paubert
2023-10-01  5:01               ` [f2fs-dev] " Gabriel Paubert
2023-10-01  5:01               ` Gabriel Paubert
2023-09-29  9:44       ` Christian Brauner
2023-09-29  9:44         ` Christian Brauner
2023-09-29  9:44         ` Christian Brauner
2023-09-29  9:44         ` Christian Brauner
2023-09-29  9:44         ` Christian Brauner
2023-09-29  9:44         ` Christian Brauner
2023-09-29  9:44         ` [f2fs-dev] " Christian Brauner
2023-09-29 10:16         ` Jeff Layton
2023-09-29 10:16           ` Jeff Layton
2023-09-29 10:16           ` Jeff Layton
2023-09-29 10:16           ` Jeff Layton
2023-09-29 10:16           ` Jeff Layton
2023-09-29 10:16           ` Jeff Layton
2023-09-29 10:16           ` [f2fs-dev] " Jeff Layton
2023-09-28 17:09   ` Jeff Layton
2023-09-28 17:09     ` Jeff Layton
2023-09-28 17:09     ` Jeff Layton
2023-09-28 17:09     ` Jeff Layton
2023-09-28 17:09     ` Jeff Layton
2023-09-28 17:09     ` [f2fs-dev] " Jeff Layton
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:05   ` Jeff Layton
2023-09-28 11:05   ` Jeff Layton
2023-09-28 11:05   ` Jeff Layton
2023-09-28 11:05   ` Jeff Layton
2023-09-28 11:05   ` [f2fs-dev] " Jeff Layton
2023-09-28 11:35   ` Amir Goldstein
2023-09-28 11:35     ` Amir Goldstein
2023-09-28 11:35     ` Amir Goldstein
2023-09-28 11:35     ` Amir Goldstein
2023-09-28 11:35     ` Amir Goldstein
2023-09-28 11:35     ` Amir Goldstein
2023-09-28 11:35     ` [f2fs-dev] " Amir Goldstein
2023-09-28 12:01     ` Jeff Layton
2023-09-28 12:01       ` Jeff Layton
2023-09-28 12:01       ` Jeff Layton
2023-09-28 12:01       ` Jeff Layton
2023-09-28 12:01       ` Jeff Layton
2023-09-28 12:01       ` Jeff Layton
2023-09-28 12:01       ` [f2fs-dev] " Jeff Layton
2023-09-28 17:41   ` Linus Torvalds
2023-09-28 17:41     ` Linus Torvalds
2023-09-28 17:41     ` Linus Torvalds
2023-09-28 17:41     ` Linus Torvalds
2023-09-28 17:41     ` Linus Torvalds
2023-09-28 17:41     ` [f2fs-dev] " Linus Torvalds
2023-09-28 17:41     ` Linus Torvalds
2023-09-28 18:01     ` Jeff Layton
2023-09-28 18:01       ` Jeff Layton
2023-09-28 18:01       ` Jeff Layton
2023-09-28 18:01       ` Jeff Layton
2023-09-28 18:01       ` Jeff Layton
2023-09-28 18:01       ` Jeff Layton
2023-09-28 18:01       ` [f2fs-dev] " Jeff Layton
2023-09-29  9:32     ` Christian Brauner
2023-09-29  9:32       ` Christian Brauner
2023-09-29  9:32       ` Christian Brauner
2023-09-29  9:32       ` Christian Brauner
2023-09-29  9:32       ` Christian Brauner
2023-09-29  9:32       ` Christian Brauner
2023-09-29  9:32       ` [f2fs-dev] " 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=20230928110554.34758-2-jlayton@kernel.org \
    --to=jlayton@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=agordeev@linux.ibm.com \
    --cc=agruenba@redhat.com \
    --cc=aivazian.tigran@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=al@alarsen.net \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=amir73il@gmail.com \
    --cc=andrii@kernel.org \
    --cc=anna@kernel.org \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=anton@tuxera.com \
    --cc=apparmor@lists.ubuntu.com \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=arve@android.com \
    --cc=asmadeus@codewreck.org \
    --cc=ast@kernel.org \
    --cc=autofs@vger.kernel.org \
    --cc=borntraeger@linux.ibm.com \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=bwarrum@linux.ibm.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=chandan.babu@oracle.com \
    --cc=chao@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=chuck.lever@oracle.com \
    --cc=clm@fb.com \
    --cc=cmllamas@google.com \
    --cc=coda@cs.cmu.edu \
    --cc=codalist@coda.cs.cmu.edu \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=devel@lists.orangefs.org \
    --cc=dhowells@redhat.com \
    --cc=djwong@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=dushistov@mail.ru \
    --cc=dwmw2@infradead.org \
    --cc=ebiederm@xmission.com \
    --cc=edumazet@google.com \
    --cc=eparis@parisplace.org \
    --cc=ericvh@kernel.org \
    --cc=gfs2@lists.linux.dev \
    --cc=gor@linux.ibm.com \
    --cc=gpiccoli@igalia.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=haoluo@google.com \
    --cc=hca@linux.ibm.com \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=hdegoede@redhat.com \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=hubcap@omnibond.com \
    --cc=hughd@google.com \
    --cc=huyue2@coolpad.com \
    --cc=idryomov@gmail.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jack@suse.com \
    --cc=jack@suse.cz \
    --cc=jaegeuk@kernel.org \
    --cc=jaharkes@cs.cmu.edu \
    --cc=jefflexu@linux.alibaba.com \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=jgg@ziepe.ca \
    --cc=jirislaby@kernel.org \
    --cc=jk@ozlabs.org \
    --cc=jlbec@evilplan.org \
    --cc=jmorris@namei.org \
    --cc=joel@joelfernandes.org \
    --cc=johannes@sipsolutions.net \
    --cc=john.fastabend@gmail.com \
    --cc=john.johansen@canonical.com \
    --cc=jolsa@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=jth@kernel.org \
    --cc=keescook@chromium.org \
    --cc=kolga@netapp.com \
    --cc=konishi.ryusuke@gmail.com \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linkinjeon@kernel.org \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-cifs@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-hardening@vger.kernel.org \
    --cc=linux-karma-devel@lists.sourceforge.net \
    --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-security-module@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lsahlber@redhat.com \
    --cc=lucho@ionkov.net \
    --cc=luisbg@kernel.org \
    --cc=maco@android.com \
    --cc=malattia@linux.it \
    --cc=marc.dionne@auristor.com \
    --cc=mark@fasheh.com \
    --cc=markgross@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=martin@omnibond.com \
    --cc=mcgrof@kernel.org \
    --cc=me@bobcopeland.com \
    --cc=mhiramat@kernel.org \
    --cc=mike.kravetz@oracle.com \
    --cc=miklos@szeredi.hu \
    --cc=mikulas@artax.karlin.mff.cuni.cz \
    --cc=mpe@ellerman.id.au \
    --cc=muchun.song@linux.dev \
    --cc=naohiro.aota@wdc.com \
    --cc=neilb@suse.de \
    --cc=netdev@vger.kernel.org \
    --cc=nico@fluxnic.net \
    --cc=npiggin@gmail.com \
    --cc=ntfs3@lists.linux.dev \
    --cc=ocfs2-devel@lists.linux.dev \
    --cc=pabeni@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=pc@manguebit.com \
    --cc=phillip@squashfs.org.uk \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=raven@themaw.net \
    --cc=reiserfs-devel@vger.kernel.org \
    --cc=richard@nod.at \
    --cc=rituagar@linux.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=rpeterso@redhat.com \
    --cc=salah.triki@gmail.com \
    --cc=samba-technical@lists.samba.org \
    --cc=sdf@google.com \
    --cc=selinux@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=serge@hallyn.com \
    --cc=sfrench@samba.org \
    --cc=shaggy@kernel.org \
    --cc=sj1557.seo@samsung.com \
    --cc=song@kernel.org \
    --cc=sprasad@microsoft.com \
    --cc=stephen.smalley.work@gmail.com \
    --cc=surenb@google.com \
    --cc=svens@linux.ibm.com \
    --cc=tj@kernel.org \
    --cc=tkjos@android.com \
    --cc=tom@talpey.com \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=trond.myklebust@hammerspace.com \
    --cc=tytso@mit.edu \
    --cc=v9fs@lists.linux.dev \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xiang@kernel.org \
    --cc=xiubli@redhat.com \
    --cc=yonghong.song@linux.dev \
    --cc=yzaikin@google.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.