All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 87/89] fs: rename inode i_atime and i_mtime fields
@ 2023-10-04 18:55 ` Jeff Layton
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2023-10-04 18:55 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Linus Torvalds, David Sterba,
	Amir Goldstein, Theodore Ts'o, Eric Biederman, Kees Cook,
	Jeremy Kerr, Arnd Bergmann, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas,
	Suren Baghdasaryan, Mattia Dongili, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Brad Warrum, Ritu Agarwal,
	Hans de Goede, Ilpo Järvinen, Mark Gross, Jiri Slaby,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, David Howells, Marc Dionne,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Chris Mason, Josef Bacik, Xiubo Li, Ilya Dryomov, Jan Harkes,
	coda, Joel Becker, Christoph Hellwig, Nicolas Pitre,
	Rafael J. Wysocki, Ard Biesheuvel, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, Namjae Jeon, Sungjong Seo, Jan Kara, Andreas Dilger,
	Jaegeuk Kim, OGAWA Hirofumi, Christoph Hellwig, Miklos Szeredi,
	Bob Peterson, Andreas Gruenbacher, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Mikulas Patocka, Mike Kravetz,
	Muchun Song, Jan Kara, David Woodhouse, Dave Kleikamp, Tejun Heo,
	Trond Myklebust, Anna Schumaker, Chuck Lever, Neil Brown,
	Olga Kornievskaia, Dai Ngo, Tom Talpey, Ryusuke Konishi,
	Anton Altaparmakov, Konstantin Komarov, Mark Fasheh, Joseph Qi,
	Bob Copeland, Mike Marshall, Martin Brandenburg,
	Luis Chamberlain, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Sergey Senozhatsky, Phillip Lougher,
	Steven Rostedt, Masami Hiramatsu, Evgeniy Dushistov,
	Chandan Babu R, Darrick J. Wong, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hugh Dickins, Andrew Morton, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John Johansen, Paul Moore,
	James Morris, Serge E. Hallyn, Stephen Smalley, Eric Paris,
	Kent Overstreet, Brian Foster
  Cc: linux-fsdevel, linux-kernel, linux-mm, linuxppc-dev, linux-s390,
	platform-driver-x86, linux-rdma, linux-serial, linux-usb, v9fs,
	linux-afs, autofs, linux-btrfs, ceph-devel, codalist, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, gfs2, linux-um,
	linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux, linux-bcachefs

Rename these two fields to discourage direct access (and to help ensure
that we mop up any leftover direct accesses).

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3ca610d42176..84fdaf399fbe 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -671,8 +671,8 @@ struct inode {
 	};
 	dev_t			i_rdev;
 	loff_t			i_size;
-	struct timespec64	i_atime;
-	struct timespec64	i_mtime;
+	struct timespec64	__i_atime;
+	struct timespec64	__i_mtime;
 	struct timespec64	__i_ctime; /* use inode_*_ctime accessors! */
 	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
 	unsigned short          i_bytes;
@@ -1517,23 +1517,23 @@ struct timespec64 inode_set_ctime_current(struct inode *inode);
 
 static inline time64_t inode_get_atime_sec(const struct inode *inode)
 {
-	return inode->i_atime.tv_sec;
+	return inode->__i_atime.tv_sec;
 }
 
 static inline long inode_get_atime_nsec(const struct inode *inode)
 {
-	return inode->i_atime.tv_nsec;
+	return inode->__i_atime.tv_nsec;
 }
 
 static inline struct timespec64 inode_get_atime(const struct inode *inode)
 {
-	return inode->i_atime;
+	return inode->__i_atime;
 }
 
 static inline struct timespec64 inode_set_atime_to_ts(struct inode *inode,
 						      struct timespec64 ts)
 {
-	inode->i_atime = ts;
+	inode->__i_atime = ts;
 	return ts;
 }
 
@@ -1547,23 +1547,23 @@ static inline struct timespec64 inode_set_atime(struct inode *inode,
 
 static inline time64_t inode_get_mtime_sec(const struct inode *inode)
 {
-	return inode->i_mtime.tv_sec;
+	return inode->__i_mtime.tv_sec;
 }
 
 static inline long inode_get_mtime_nsec(const struct inode *inode)
 {
-	return inode->i_mtime.tv_nsec;
+	return inode->__i_mtime.tv_nsec;
 }
 
 static inline struct timespec64 inode_get_mtime(const struct inode *inode)
 {
-	return inode->i_mtime;
+	return inode->__i_mtime;
 }
 
 static inline struct timespec64 inode_set_mtime_to_ts(struct inode *inode,
 						      struct timespec64 ts)
 {
-	inode->i_mtime = ts;
+	inode->__i_mtime = ts;
 	return ts;
 }
 
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [f2fs-dev] [PATCH v2 87/89] fs: rename inode i_atime and i_mtime fields
@ 2023-10-04 18:55 ` Jeff Layton
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2023-10-04 18:55 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Linus Torvalds, David Sterba,
	Amir Goldstein, Theodore Ts'o, Eric Biederman, Kees Cook,
	Jeremy Kerr, Arnd Bergmann, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas,
	Suren Baghdasaryan, Mattia Dongili, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Brad Warrum, Ritu Agarwal,
	Hans de Goede, Ilpo Järvinen, Mark Gross, Jiri Slaby,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, David Howells, Marc Dionne,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Chris Mason, Josef Bacik, Xiubo Li, Ilya Dryomov, Jan Harkes,
	coda, Joel Becker, Christoph Hellwig, Nicolas Pitre,
	Rafael J. Wysocki, Ard Biesheuvel, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, Namjae Jeon, Sungjong Seo, Jan Kara, Andreas Dilger,
	Jaegeuk Kim, OGAWA Hirofumi, Christoph Hellwig, Miklos Szeredi,
	Bob Peterson, Andreas Gruenbacher, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Mikulas Patocka, Mike Kravetz,
	Muchun Song, Jan Kara, David Woodhouse, Dave Kleikamp, Tejun Heo,
	Trond Myklebust, Anna Schumaker, Chuck Lever, Neil Brown,
	Olga Kornievskaia, Dai Ngo, Tom Talpey, Ryusuke Konishi,
	Anton Altaparmakov, Konstantin Komarov, Mark Fasheh, Joseph Qi,
	Bob Copeland, Mike Marshall, Martin Brandenburg,
	Luis Chamberlain, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Sergey Senozhatsky, Phillip Lougher,
	Steven Rostedt, Masami Hiramatsu, Evgeniy Dushistov,
	Chandan Babu R, Darrick J. Wong, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hugh Dickins, Andrew Morton, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John Johansen, Paul Moore,
	James Morris, Serge E. Hallyn, Stephen Smalley, Eric Paris,
	Kent Overstreet, Brian Foster
  Cc: jfs-discussion, linux-efi, platform-driver-x86, gfs2, linux-mm,
	linux-mtd, linux-hardening, linux-afs, linux-s390, linux-nilfs,
	linux-rdma, linux-unionfs, codalist, linux-bcachefs,
	linux-serial, linux-ext4, devel, linux-trace-kernel, linux-cifs,
	selinux, apparmor, autofs, linux-um, reiserfs-devel, ocfs2-devel,
	ceph-devel, linux-nfs, linux-ntfs-dev, linuxppc-dev, v9fs,
	linux-usb, samba-technical, linux-kernel, linux-f2fs-devel,
	linux-xfs, linux-security-module, netdev, linux-fsdevel, bpf,
	ntfs3, linux-erofs, linux-karma-devel, linux-btrfs

Rename these two fields to discourage direct access (and to help ensure
that we mop up any leftover direct accesses).

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3ca610d42176..84fdaf399fbe 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -671,8 +671,8 @@ struct inode {
 	};
 	dev_t			i_rdev;
 	loff_t			i_size;
-	struct timespec64	i_atime;
-	struct timespec64	i_mtime;
+	struct timespec64	__i_atime;
+	struct timespec64	__i_mtime;
 	struct timespec64	__i_ctime; /* use inode_*_ctime accessors! */
 	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
 	unsigned short          i_bytes;
@@ -1517,23 +1517,23 @@ struct timespec64 inode_set_ctime_current(struct inode *inode);
 
 static inline time64_t inode_get_atime_sec(const struct inode *inode)
 {
-	return inode->i_atime.tv_sec;
+	return inode->__i_atime.tv_sec;
 }
 
 static inline long inode_get_atime_nsec(const struct inode *inode)
 {
-	return inode->i_atime.tv_nsec;
+	return inode->__i_atime.tv_nsec;
 }
 
 static inline struct timespec64 inode_get_atime(const struct inode *inode)
 {
-	return inode->i_atime;
+	return inode->__i_atime;
 }
 
 static inline struct timespec64 inode_set_atime_to_ts(struct inode *inode,
 						      struct timespec64 ts)
 {
-	inode->i_atime = ts;
+	inode->__i_atime = ts;
 	return ts;
 }
 
@@ -1547,23 +1547,23 @@ static inline struct timespec64 inode_set_atime(struct inode *inode,
 
 static inline time64_t inode_get_mtime_sec(const struct inode *inode)
 {
-	return inode->i_mtime.tv_sec;
+	return inode->__i_mtime.tv_sec;
 }
 
 static inline long inode_get_mtime_nsec(const struct inode *inode)
 {
-	return inode->i_mtime.tv_nsec;
+	return inode->__i_mtime.tv_nsec;
 }
 
 static inline struct timespec64 inode_get_mtime(const struct inode *inode)
 {
-	return inode->i_mtime;
+	return inode->__i_mtime;
 }
 
 static inline struct timespec64 inode_set_mtime_to_ts(struct inode *inode,
 						      struct timespec64 ts)
 {
-	inode->i_mtime = ts;
+	inode->__i_mtime = ts;
 	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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 87/89] fs: rename inode i_atime and i_mtime fields
@ 2023-10-04 18:55 ` Jeff Layton
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2023-10-04 18:55 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Linus Torvalds, David Sterba,
	Amir Goldstein, Theodore Ts'o, Eric Biederman, Kees Cook,
	Jeremy Kerr, Arnd Bergmann, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas,
	Suren Baghdasaryan, Mattia Dongili, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Brad Warrum, Ritu Agarwal,
	Hans de Goede, Ilpo Järvinen, Mark Gross, Jiri Slaby,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, David Howells, Marc Dionne,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Chris Mason, Josef Bacik, Xiubo Li, Ilya Dryomov, Jan Harkes,
	coda, Joel Becker, Christoph Hellwig, Nicolas Pitre,
	Rafael J. Wysocki, Ard Biesheuvel, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, Namjae Jeon, Sungjong Seo, Jan Kara, Andreas Dilger,
	Jaegeuk Kim, OGAWA Hirofumi, Christoph Hellwig, Miklos Szeredi,
	Bob Peterson, Andreas Gruenbacher, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Mikulas Patocka, Mike Kravetz,
	Muchun Song, Jan Kara, David Woodhouse, Dave Kleikamp, Tejun Heo,
	Trond Myklebust, Anna Schumaker, Chuck Lever, Neil Brown,
	Olga Kornievskaia, Dai Ngo, Tom Talpey, Ryusuke Konishi,
	Anton Altaparmakov, Konstantin Komarov, Mark Fasheh, Joseph Qi,
	Bob Copeland, Mike Marshall, Martin Brandenburg,
	Luis Chamberlain, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Sergey Senozhatsky, Phillip Lougher,
	Steven Rostedt, Masami Hiramatsu, Evgeniy Dushistov,
	Chandan Babu R, Darrick J. Wong, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hugh Dickins, Andrew Morton, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John Johansen, Paul Moore,
	James Morris, Serge E. Hallyn, Stephen Smalley, Eric Paris,
	Kent Overstreet, Brian Foster
  Cc: linux-fsdevel, linux-kernel, linux-mm, linuxppc-dev, linux-s390,
	platform-driver-x86, linux-rdma, linux-serial, linux-usb, v9fs,
	linux-afs, autofs, linux-btrfs, ceph-devel, codalist, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, gfs2, linux-um,
	linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux, linux-bcachefs

Rename these two fields to discourage direct access (and to help ensure
that we mop up any leftover direct accesses).

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3ca610d42176..84fdaf399fbe 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -671,8 +671,8 @@ struct inode {
 	};
 	dev_t			i_rdev;
 	loff_t			i_size;
-	struct timespec64	i_atime;
-	struct timespec64	i_mtime;
+	struct timespec64	__i_atime;
+	struct timespec64	__i_mtime;
 	struct timespec64	__i_ctime; /* use inode_*_ctime accessors! */
 	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
 	unsigned short          i_bytes;
@@ -1517,23 +1517,23 @@ struct timespec64 inode_set_ctime_current(struct inode *inode);
 
 static inline time64_t inode_get_atime_sec(const struct inode *inode)
 {
-	return inode->i_atime.tv_sec;
+	return inode->__i_atime.tv_sec;
 }
 
 static inline long inode_get_atime_nsec(const struct inode *inode)
 {
-	return inode->i_atime.tv_nsec;
+	return inode->__i_atime.tv_nsec;
 }
 
 static inline struct timespec64 inode_get_atime(const struct inode *inode)
 {
-	return inode->i_atime;
+	return inode->__i_atime;
 }
 
 static inline struct timespec64 inode_set_atime_to_ts(struct inode *inode,
 						      struct timespec64 ts)
 {
-	inode->i_atime = ts;
+	inode->__i_atime = ts;
 	return ts;
 }
 
@@ -1547,23 +1547,23 @@ static inline struct timespec64 inode_set_atime(struct inode *inode,
 
 static inline time64_t inode_get_mtime_sec(const struct inode *inode)
 {
-	return inode->i_mtime.tv_sec;
+	return inode->__i_mtime.tv_sec;
 }
 
 static inline long inode_get_mtime_nsec(const struct inode *inode)
 {
-	return inode->i_mtime.tv_nsec;
+	return inode->__i_mtime.tv_nsec;
 }
 
 static inline struct timespec64 inode_get_mtime(const struct inode *inode)
 {
-	return inode->i_mtime;
+	return inode->__i_mtime;
 }
 
 static inline struct timespec64 inode_set_mtime_to_ts(struct inode *inode,
 						      struct timespec64 ts)
 {
-	inode->i_mtime = ts;
+	inode->__i_mtime = ts;
 	return ts;
 }
 
-- 
2.41.0


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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 87/89] fs: rename inode i_atime and i_mtime fields
@ 2023-10-04 18:55 ` Jeff Layton
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2023-10-04 18:55 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Linus Torvalds, David Sterba,
	Amir Goldstein, Theodore Ts'o, Eric Biederman, Kees Cook,
	Jeremy Kerr, Arnd Bergmann, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas,
	Suren Baghdasaryan, Mattia Dongili, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Brad Warrum, Ritu Agarwal,
	Hans de Goede, Ilpo Järvinen, Mark Gross, Jiri Slaby,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, David Howells, Marc Dionne,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Chris Mason, Josef Bacik, Xiubo Li, Ilya Dryomov, Jan Harkes,
	coda, Joel Becker, Christoph Hellwig, Nicolas Pitre,
	Rafael J. Wysocki, Ard Biesheuvel, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, Namjae Jeon, Sungjong Seo, Jan Kara, Andreas Dilger,
	Jaegeuk Kim, OGAWA Hirofumi, Christoph Hellwig, Miklos Szeredi,
	Bob Peterson, Andreas Gruenbacher, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Mikulas Patocka, Mike Kravetz,
	Muchun Song, Jan Kara, David Woodhouse, Dave Kleikamp, Tejun Heo,
	Trond Myklebust, Anna Schumaker, Chuck Lever, Neil Brown,
	Olga Kornievskaia, Dai Ngo, Tom Talpey, Ryusuke Konishi,
	Anton Altaparmakov, Konstantin Komarov, Mark Fasheh, Joseph Qi,
	Bob Copeland, Mike Marshall, Martin Brandenburg,
	Luis Chamberlain, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Sergey Senozhatsky, Phillip Lougher,
	Steven Rostedt, Masami Hiramatsu, Evgeniy Dushistov,
	Chandan Babu R, Darrick J. Wong, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hugh Dickins, Andrew Morton, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John Johansen, Paul Moore,
	James Morris, Serge E. Hallyn, Stephen Smalley, Eric Paris,
	Kent Overstreet, Brian Foster
  Cc: linux-fsdevel, linux-kernel, linux-mm, linuxppc-dev, linux-s390,
	platform-driver-x86, linux-rdma, linux-serial, linux-usb, v9fs,
	linux-afs, autofs, linux-btrfs, ceph-devel, codalist, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, gfs2, linux-um,
	linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux, linux-bcachefs

Rename these two fields to discourage direct access (and to help ensure
that we mop up any leftover direct accesses).

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3ca610d42176..84fdaf399fbe 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -671,8 +671,8 @@ struct inode {
 	};
 	dev_t			i_rdev;
 	loff_t			i_size;
-	struct timespec64	i_atime;
-	struct timespec64	i_mtime;
+	struct timespec64	__i_atime;
+	struct timespec64	__i_mtime;
 	struct timespec64	__i_ctime; /* use inode_*_ctime accessors! */
 	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
 	unsigned short          i_bytes;
@@ -1517,23 +1517,23 @@ struct timespec64 inode_set_ctime_current(struct inode *inode);
 
 static inline time64_t inode_get_atime_sec(const struct inode *inode)
 {
-	return inode->i_atime.tv_sec;
+	return inode->__i_atime.tv_sec;
 }
 
 static inline long inode_get_atime_nsec(const struct inode *inode)
 {
-	return inode->i_atime.tv_nsec;
+	return inode->__i_atime.tv_nsec;
 }
 
 static inline struct timespec64 inode_get_atime(const struct inode *inode)
 {
-	return inode->i_atime;
+	return inode->__i_atime;
 }
 
 static inline struct timespec64 inode_set_atime_to_ts(struct inode *inode,
 						      struct timespec64 ts)
 {
-	inode->i_atime = ts;
+	inode->__i_atime = ts;
 	return ts;
 }
 
@@ -1547,23 +1547,23 @@ static inline struct timespec64 inode_set_atime(struct inode *inode,
 
 static inline time64_t inode_get_mtime_sec(const struct inode *inode)
 {
-	return inode->i_mtime.tv_sec;
+	return inode->__i_mtime.tv_sec;
 }
 
 static inline long inode_get_mtime_nsec(const struct inode *inode)
 {
-	return inode->i_mtime.tv_nsec;
+	return inode->__i_mtime.tv_nsec;
 }
 
 static inline struct timespec64 inode_get_mtime(const struct inode *inode)
 {
-	return inode->i_mtime;
+	return inode->__i_mtime;
 }
 
 static inline struct timespec64 inode_set_mtime_to_ts(struct inode *inode,
 						      struct timespec64 ts)
 {
-	inode->i_mtime = ts;
+	inode->__i_mtime = ts;
 	return ts;
 }
 
-- 
2.41.0


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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 87/89] fs: rename inode i_atime and i_mtime fields
@ 2023-10-04 18:55 ` Jeff Layton
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2023-10-04 18:55 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Linus Torvalds, David Sterba,
	Amir Goldstein, Theodore Ts'o, Eric Biederman, Kees Cook,
	Jeremy Kerr, Arnd Bergmann, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas,
	Suren Baghdasaryan, Mattia Dongili, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Brad Warrum, Ritu Agarwal,
	Hans de Goede, Ilpo Järvinen, Mark Gross, Jiri Slaby,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, David Howells, Marc Dionne,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Chris Mason, Josef Bacik, Xiubo Li, Ilya Dryomov, Jan Harkes,
	coda, Joel Becker, Christoph Hellwig, Nicolas Pitre,
	Rafael J. Wysocki, Ard Biesheuvel, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, Namjae Jeon, Sungjong Seo, Jan Kara, Andreas Dilger,
	Jaegeuk Kim, OGAWA Hirofumi, Christoph Hellwig, Miklos Szeredi,
	Bob Peterson, Andreas Gruenbacher, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Mikulas Patocka, Mike Kravetz,
	Muchun Song, Jan Kara, David Woodhouse, Dave Kleikamp, Tejun Heo,
	Trond Myklebust, Anna Schumaker, Chuck Lever, Neil Brown,
	Olga Kornievskaia, Dai Ngo, Tom Talpey, Ryusuke Konishi,
	Anton Altaparmakov, Konstantin Komarov, Mark Fasheh, Joseph Qi,
	Bob Copeland, Mike Marshall, Martin Brandenburg,
	Luis Chamberlain, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Sergey Senozhatsky, Phillip Lougher,
	Steven Rostedt, Masami Hiramatsu, Evgeniy Dushistov,
	Chandan Babu R, Darrick J. Wong, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hugh Dickins, Andrew Morton, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John Johansen, Paul Moore,
	James Morris, Serge E. Hallyn, Stephen Smalley, Eric Paris,
	Kent Overstreet, Brian Foster
  Cc: jfs-discussion, linux-efi, platform-driver-x86, gfs2, linux-mm,
	linux-mtd, linux-hardening, linux-afs, linux-s390, linux-nilfs,
	linux-rdma, linux-unionfs, codalist, linux-bcachefs,
	linux-serial, linux-ext4, devel, linux-trace-kernel, linux-cifs,
	selinux, apparmor, autofs, linux-um, reiserfs-devel, ocfs2-devel,
	ceph-devel, linux-nfs, linux-ntfs-dev, linuxppc-dev, v9fs,
	linux-usb, samba-technical, linux-kernel, linux-f2fs-devel

Rename these two fields to discourage direct access (and to help ensure
that we mop up any leftover direct accesses).

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3ca610d42176..84fdaf399fbe 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -671,8 +671,8 @@ struct inode {
 	};
 	dev_t			i_rdev;
 	loff_t			i_size;
-	struct timespec64	i_atime;
-	struct timespec64	i_mtime;
+	struct timespec64	__i_atime;
+	struct timespec64	__i_mtime;
 	struct timespec64	__i_ctime; /* use inode_*_ctime accessors! */
 	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
 	unsigned short          i_bytes;
@@ -1517,23 +1517,23 @@ struct timespec64 inode_set_ctime_current(struct inode *inode);
 
 static inline time64_t inode_get_atime_sec(const struct inode *inode)
 {
-	return inode->i_atime.tv_sec;
+	return inode->__i_atime.tv_sec;
 }
 
 static inline long inode_get_atime_nsec(const struct inode *inode)
 {
-	return inode->i_atime.tv_nsec;
+	return inode->__i_atime.tv_nsec;
 }
 
 static inline struct timespec64 inode_get_atime(const struct inode *inode)
 {
-	return inode->i_atime;
+	return inode->__i_atime;
 }
 
 static inline struct timespec64 inode_set_atime_to_ts(struct inode *inode,
 						      struct timespec64 ts)
 {
-	inode->i_atime = ts;
+	inode->__i_atime = ts;
 	return ts;
 }
 
@@ -1547,23 +1547,23 @@ static inline struct timespec64 inode_set_atime(struct inode *inode,
 
 static inline time64_t inode_get_mtime_sec(const struct inode *inode)
 {
-	return inode->i_mtime.tv_sec;
+	return inode->__i_mtime.tv_sec;
 }
 
 static inline long inode_get_mtime_nsec(const struct inode *inode)
 {
-	return inode->i_mtime.tv_nsec;
+	return inode->__i_mtime.tv_nsec;
 }
 
 static inline struct timespec64 inode_get_mtime(const struct inode *inode)
 {
-	return inode->i_mtime;
+	return inode->__i_mtime;
 }
 
 static inline struct timespec64 inode_set_mtime_to_ts(struct inode *inode,
 						      struct timespec64 ts)
 {
-	inode->i_mtime = ts;
+	inode->__i_mtime = ts;
 	return ts;
 }
 
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 88/89] fs: switch timespec64 fields in inode to discrete integers
  2023-10-04 18:55 ` [f2fs-dev] " Jeff Layton
                     ` (2 preceding siblings ...)
  (?)
@ 2023-10-04 18:55   ` Jeff Layton
  -1 siblings, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2023-10-04 18:55 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Linus Torvalds, David Sterba,
	Amir Goldstein, Theodore Ts'o, Eric Biederman, Kees Cook,
	Jeremy Kerr, Arnd Bergmann, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas,
	Suren Baghdasaryan, Mattia Dongili, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Brad Warrum, Ritu Agarwal,
	Hans de Goede, Ilpo Järvinen, Mark Gross, Jiri Slaby,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, David Howells, Marc Dionne,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Chris Mason, Josef Bacik, Xiubo Li, Ilya Dryomov, Jan Harkes,
	coda, Joel Becker, Christoph Hellwig, Nicolas Pitre,
	Rafael J. Wysocki, Ard Biesheuvel, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, Namjae Jeon, Sungjong Seo, Jan Kara, Andreas Dilger,
	Jaegeuk Kim, OGAWA Hirofumi, Christoph Hellwig, Miklos Szeredi,
	Bob Peterson, Andreas Gruenbacher, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Mikulas Patocka, Mike Kravetz,
	Muchun Song, Jan Kara, David Woodhouse, Dave Kleikamp, Tejun Heo,
	Trond Myklebust, Anna Schumaker, Chuck Lever, Neil Brown,
	Olga Kornievskaia, Dai Ngo, Tom Talpey, Ryusuke Konishi,
	Anton Altaparmakov, Konstantin Komarov, Mark Fasheh, Joseph Qi,
	Bob Copeland, Mike Marshall, Martin Brandenburg,
	Luis Chamberlain, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Sergey Senozhatsky, Phillip Lougher,
	Steven Rostedt, Masami Hiramatsu, Evgeniy Dushistov,
	Chandan Babu R, Darrick J. Wong, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hugh Dickins, Andrew Morton, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John Johansen, Paul Moore,
	James Morris, Serge E. Hallyn, Stephen Smalley, Eric Paris,
	Kent Overstreet, Brian Foster
  Cc: linux-fsdevel, linux-kernel, linux-mm, linuxppc-dev, linux-s390,
	platform-driver-x86, linux-rdma, linux-serial, linux-usb, v9fs,
	linux-afs, autofs, linux-btrfs, ceph-devel, codalist, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, gfs2, linux-um,
	linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux, linux-bcachefs

This shaves 8 bytes off struct inode with a garden-variety Fedora
Kconfig.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 53 ++++++++++++++++++++++++++--------------------
 1 file changed, 30 insertions(+), 23 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 84fdaf399fbe..485b5e21c8e5 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;
-	struct timespec64	__i_mtime;
-	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;
@@ -1517,23 +1520,27 @@ struct timespec64 inode_set_ctime_current(struct inode *inode);
 
 static inline time64_t inode_get_atime_sec(const struct inode *inode)
 {
-	return inode->__i_atime.tv_sec;
+	return inode->i_atime_sec;
 }
 
 static inline long inode_get_atime_nsec(const struct inode *inode)
 {
-	return inode->__i_atime.tv_nsec;
+	return inode->i_atime_nsec;
 }
 
 static inline struct timespec64 inode_get_atime(const struct inode *inode)
 {
-	return inode->__i_atime;
+	struct timespec64 ts = { .tv_sec  = inode_get_atime_sec(inode),
+				 .tv_nsec = inode_get_atime_nsec(inode) };
+
+	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_nsec;
 	return ts;
 }
 
@@ -1542,28 +1549,32 @@ static inline struct timespec64 inode_set_atime(struct inode *inode,
 {
 	struct timespec64 ts = { .tv_sec  = sec,
 				 .tv_nsec = nsec };
+
 	return inode_set_atime_to_ts(inode, ts);
 }
 
 static inline time64_t inode_get_mtime_sec(const struct inode *inode)
 {
-	return inode->__i_mtime.tv_sec;
+	return inode->i_mtime_sec;
 }
 
 static inline long inode_get_mtime_nsec(const struct inode *inode)
 {
-	return inode->__i_mtime.tv_nsec;
+	return inode->i_mtime_nsec;
 }
 
 static inline struct timespec64 inode_get_mtime(const struct inode *inode)
 {
-	return inode->__i_mtime;
+	struct timespec64 ts = { .tv_sec  = inode_get_mtime_sec(inode),
+				 .tv_nsec = inode_get_mtime_nsec(inode) };
+	return ts;
 }
 
 static inline struct timespec64 inode_set_mtime_to_ts(struct inode *inode,
 						      struct timespec64 ts)
 {
-	inode->__i_mtime = ts;
+	inode->i_mtime_sec = ts.tv_sec;
+	inode->i_mtime_nsec = ts.tv_nsec;
 	return ts;
 }
 
@@ -1577,34 +1588,30 @@ static inline struct timespec64 inode_set_mtime(struct inode *inode,
 
 static inline time64_t inode_get_ctime_sec(const struct inode *inode)
 {
-	return inode->__i_ctime.tv_sec;
+	return inode->i_ctime_sec;
 }
 
 static inline long inode_get_ctime_nsec(const struct inode *inode)
 {
-	return inode->__i_ctime.tv_nsec;
+	return inode->i_ctime_nsec;
 }
 
 static inline struct timespec64 inode_get_ctime(const struct inode *inode)
 {
-	return inode->__i_ctime;
+	struct timespec64 ts = { .tv_sec  = inode_get_ctime_sec(inode),
+				 .tv_nsec = inode_get_ctime_nsec(inode) };
+
+	return ts;
 }
 
 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_nsec;
 	return ts;
 }
 
-/**
- * inode_set_ctime - set the ctime in the inode
- * @inode: inode in which to set the ctime
- * @sec: tv_sec value to set
- * @nsec: tv_nsec value to set
- *
- * Set the ctime in @inode to { @sec, @nsec }
- */
 static inline struct timespec64 inode_set_ctime(struct inode *inode,
 						time64_t sec, long nsec)
 {
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [f2fs-dev] [PATCH v2 88/89] fs: switch timespec64 fields in inode to discrete integers
@ 2023-10-04 18:55   ` Jeff Layton
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2023-10-04 18:55 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Linus Torvalds, David Sterba,
	Amir Goldstein, Theodore Ts'o, Eric Biederman, Kees Cook,
	Jeremy Kerr, Arnd Bergmann, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas,
	Suren Baghdasaryan, Mattia Dongili, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Brad Warrum, Ritu Agarwal,
	Hans de Goede, Ilpo Järvinen, Mark Gross, Jiri Slaby,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, David Howells, Marc Dionne,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Chris Mason, Josef Bacik, Xiubo Li, Ilya Dryomov, Jan Harkes,
	coda, Joel Becker, Christoph Hellwig, Nicolas Pitre,
	Rafael J. Wysocki, Ard Biesheuvel, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, Namjae Jeon, Sungjong Seo, Jan Kara, Andreas Dilger,
	Jaegeuk Kim, OGAWA Hirofumi, Christoph Hellwig, Miklos Szeredi,
	Bob Peterson, Andreas Gruenbacher, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Mikulas Patocka, Mike Kravetz,
	Muchun Song, Jan Kara, David Woodhouse, Dave Kleikamp, Tejun Heo,
	Trond Myklebust, Anna Schumaker, Chuck Lever, Neil Brown,
	Olga Kornievskaia, Dai Ngo, Tom Talpey, Ryusuke Konishi,
	Anton Altaparmakov, Konstantin Komarov, Mark Fasheh, Joseph Qi,
	Bob Copeland, Mike Marshall, Martin Brandenburg,
	Luis Chamberlain, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Sergey Senozhatsky, Phillip Lougher,
	Steven Rostedt, Masami Hiramatsu, Evgeniy Dushistov,
	Chandan Babu R, Darrick J. Wong, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hugh Dickins, Andrew Morton, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John Johansen, Paul Moore,
	James Morris, Serge E. Hallyn, Stephen Smalley, Eric Paris,
	Kent Overstreet, Brian Foster
  Cc: jfs-discussion, linux-efi, platform-driver-x86, gfs2, linux-mm,
	linux-mtd, linux-hardening, linux-afs, linux-s390, linux-nilfs,
	linux-rdma, linux-unionfs, codalist, linux-bcachefs,
	linux-serial, linux-ext4, devel, linux-trace-kernel, linux-cifs,
	selinux, apparmor, autofs, linux-um, reiserfs-devel, ocfs2-devel,
	ceph-devel, linux-nfs, linux-ntfs-dev, linuxppc-dev, v9fs,
	linux-usb, samba-technical, linux-kernel, linux-f2fs-devel,
	linux-xfs, linux-security-module, netdev, linux-fsdevel, bpf,
	ntfs3, linux-erofs, linux-karma-devel, linux-btrfs

This shaves 8 bytes off struct inode with a garden-variety Fedora
Kconfig.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 53 ++++++++++++++++++++++++++--------------------
 1 file changed, 30 insertions(+), 23 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 84fdaf399fbe..485b5e21c8e5 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;
-	struct timespec64	__i_mtime;
-	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;
@@ -1517,23 +1520,27 @@ struct timespec64 inode_set_ctime_current(struct inode *inode);
 
 static inline time64_t inode_get_atime_sec(const struct inode *inode)
 {
-	return inode->__i_atime.tv_sec;
+	return inode->i_atime_sec;
 }
 
 static inline long inode_get_atime_nsec(const struct inode *inode)
 {
-	return inode->__i_atime.tv_nsec;
+	return inode->i_atime_nsec;
 }
 
 static inline struct timespec64 inode_get_atime(const struct inode *inode)
 {
-	return inode->__i_atime;
+	struct timespec64 ts = { .tv_sec  = inode_get_atime_sec(inode),
+				 .tv_nsec = inode_get_atime_nsec(inode) };
+
+	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_nsec;
 	return ts;
 }
 
@@ -1542,28 +1549,32 @@ static inline struct timespec64 inode_set_atime(struct inode *inode,
 {
 	struct timespec64 ts = { .tv_sec  = sec,
 				 .tv_nsec = nsec };
+
 	return inode_set_atime_to_ts(inode, ts);
 }
 
 static inline time64_t inode_get_mtime_sec(const struct inode *inode)
 {
-	return inode->__i_mtime.tv_sec;
+	return inode->i_mtime_sec;
 }
 
 static inline long inode_get_mtime_nsec(const struct inode *inode)
 {
-	return inode->__i_mtime.tv_nsec;
+	return inode->i_mtime_nsec;
 }
 
 static inline struct timespec64 inode_get_mtime(const struct inode *inode)
 {
-	return inode->__i_mtime;
+	struct timespec64 ts = { .tv_sec  = inode_get_mtime_sec(inode),
+				 .tv_nsec = inode_get_mtime_nsec(inode) };
+	return ts;
 }
 
 static inline struct timespec64 inode_set_mtime_to_ts(struct inode *inode,
 						      struct timespec64 ts)
 {
-	inode->__i_mtime = ts;
+	inode->i_mtime_sec = ts.tv_sec;
+	inode->i_mtime_nsec = ts.tv_nsec;
 	return ts;
 }
 
@@ -1577,34 +1588,30 @@ static inline struct timespec64 inode_set_mtime(struct inode *inode,
 
 static inline time64_t inode_get_ctime_sec(const struct inode *inode)
 {
-	return inode->__i_ctime.tv_sec;
+	return inode->i_ctime_sec;
 }
 
 static inline long inode_get_ctime_nsec(const struct inode *inode)
 {
-	return inode->__i_ctime.tv_nsec;
+	return inode->i_ctime_nsec;
 }
 
 static inline struct timespec64 inode_get_ctime(const struct inode *inode)
 {
-	return inode->__i_ctime;
+	struct timespec64 ts = { .tv_sec  = inode_get_ctime_sec(inode),
+				 .tv_nsec = inode_get_ctime_nsec(inode) };
+
+	return ts;
 }
 
 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_nsec;
 	return ts;
 }
 
-/**
- * inode_set_ctime - set the ctime in the inode
- * @inode: inode in which to set the ctime
- * @sec: tv_sec value to set
- * @nsec: tv_nsec value to set
- *
- * Set the ctime in @inode to { @sec, @nsec }
- */
 static inline struct timespec64 inode_set_ctime(struct inode *inode,
 						time64_t sec, long nsec)
 {
-- 
2.41.0



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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 88/89] fs: switch timespec64 fields in inode to discrete integers
@ 2023-10-04 18:55   ` Jeff Layton
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2023-10-04 18:55 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Linus Torvalds, David Sterba,
	Amir Goldstein, Theodore Ts'o, Eric Biederman, Kees Cook,
	Jeremy Kerr, Arnd Bergmann, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas,
	Suren Baghdasaryan, Mattia Dongili, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Brad Warrum, Ritu Agarwal,
	Hans de Goede, Ilpo Järvinen, Mark Gross, Jiri Slaby,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, David Howells, Marc Dionne,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Chris Mason, Josef Bacik, Xiubo Li, Ilya Dryomov, Jan Harkes,
	coda, Joel Becker, Christoph Hellwig, Nicolas Pitre,
	Rafael J. Wysocki, Ard Biesheuvel, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, Namjae Jeon, Sungjong Seo, Jan Kara, Andreas Dilger,
	Jaegeuk Kim, OGAWA Hirofumi, Christoph Hellwig, Miklos Szeredi,
	Bob Peterson, Andreas Gruenbacher, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Mikulas Patocka, Mike Kravetz,
	Muchun Song, Jan Kara, David Woodhouse, Dave Kleikamp, Tejun Heo,
	Trond Myklebust, Anna Schumaker, Chuck Lever, Neil Brown,
	Olga Kornievskaia, Dai Ngo, Tom Talpey, Ryusuke Konishi,
	Anton Altaparmakov, Konstantin Komarov, Mark Fasheh, Joseph Qi,
	Bob Copeland, Mike Marshall, Martin Brandenburg,
	Luis Chamberlain, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Sergey Senozhatsky, Phillip Lougher,
	Steven Rostedt, Masami Hiramatsu, Evgeniy Dushistov,
	Chandan Babu R, Darrick J. Wong, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hugh Dickins, Andrew Morton, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John Johansen, Paul Moore,
	James Morris, Serge E. Hallyn, Stephen Smalley, Eric Paris,
	Kent Overstreet, Brian Foster
  Cc: linux-fsdevel, linux-kernel, linux-mm, linuxppc-dev, linux-s390,
	platform-driver-x86, linux-rdma, linux-serial, linux-usb, v9fs,
	linux-afs, autofs, linux-btrfs, ceph-devel, codalist, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, gfs2, linux-um,
	linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux, linux-bcachefs

This shaves 8 bytes off struct inode with a garden-variety Fedora
Kconfig.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 53 ++++++++++++++++++++++++++--------------------
 1 file changed, 30 insertions(+), 23 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 84fdaf399fbe..485b5e21c8e5 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;
-	struct timespec64	__i_mtime;
-	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;
@@ -1517,23 +1520,27 @@ struct timespec64 inode_set_ctime_current(struct inode *inode);
 
 static inline time64_t inode_get_atime_sec(const struct inode *inode)
 {
-	return inode->__i_atime.tv_sec;
+	return inode->i_atime_sec;
 }
 
 static inline long inode_get_atime_nsec(const struct inode *inode)
 {
-	return inode->__i_atime.tv_nsec;
+	return inode->i_atime_nsec;
 }
 
 static inline struct timespec64 inode_get_atime(const struct inode *inode)
 {
-	return inode->__i_atime;
+	struct timespec64 ts = { .tv_sec  = inode_get_atime_sec(inode),
+				 .tv_nsec = inode_get_atime_nsec(inode) };
+
+	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_nsec;
 	return ts;
 }
 
@@ -1542,28 +1549,32 @@ static inline struct timespec64 inode_set_atime(struct inode *inode,
 {
 	struct timespec64 ts = { .tv_sec  = sec,
 				 .tv_nsec = nsec };
+
 	return inode_set_atime_to_ts(inode, ts);
 }
 
 static inline time64_t inode_get_mtime_sec(const struct inode *inode)
 {
-	return inode->__i_mtime.tv_sec;
+	return inode->i_mtime_sec;
 }
 
 static inline long inode_get_mtime_nsec(const struct inode *inode)
 {
-	return inode->__i_mtime.tv_nsec;
+	return inode->i_mtime_nsec;
 }
 
 static inline struct timespec64 inode_get_mtime(const struct inode *inode)
 {
-	return inode->__i_mtime;
+	struct timespec64 ts = { .tv_sec  = inode_get_mtime_sec(inode),
+				 .tv_nsec = inode_get_mtime_nsec(inode) };
+	return ts;
 }
 
 static inline struct timespec64 inode_set_mtime_to_ts(struct inode *inode,
 						      struct timespec64 ts)
 {
-	inode->__i_mtime = ts;
+	inode->i_mtime_sec = ts.tv_sec;
+	inode->i_mtime_nsec = ts.tv_nsec;
 	return ts;
 }
 
@@ -1577,34 +1588,30 @@ static inline struct timespec64 inode_set_mtime(struct inode *inode,
 
 static inline time64_t inode_get_ctime_sec(const struct inode *inode)
 {
-	return inode->__i_ctime.tv_sec;
+	return inode->i_ctime_sec;
 }
 
 static inline long inode_get_ctime_nsec(const struct inode *inode)
 {
-	return inode->__i_ctime.tv_nsec;
+	return inode->i_ctime_nsec;
 }
 
 static inline struct timespec64 inode_get_ctime(const struct inode *inode)
 {
-	return inode->__i_ctime;
+	struct timespec64 ts = { .tv_sec  = inode_get_ctime_sec(inode),
+				 .tv_nsec = inode_get_ctime_nsec(inode) };
+
+	return ts;
 }
 
 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_nsec;
 	return ts;
 }
 
-/**
- * inode_set_ctime - set the ctime in the inode
- * @inode: inode in which to set the ctime
- * @sec: tv_sec value to set
- * @nsec: tv_nsec value to set
- *
- * Set the ctime in @inode to { @sec, @nsec }
- */
 static inline struct timespec64 inode_set_ctime(struct inode *inode,
 						time64_t sec, long nsec)
 {
-- 
2.41.0


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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 88/89] fs: switch timespec64 fields in inode to discrete integers
@ 2023-10-04 18:55   ` Jeff Layton
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2023-10-04 18:55 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Linus Torvalds, David Sterba,
	Amir Goldstein, Theodore Ts'o, Eric Biederman, Kees Cook,
	Jeremy Kerr, Arnd Bergmann, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas,
	Suren Baghdasaryan, Mattia Dongili, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Brad Warrum, Ritu Agarwal,
	Hans de Goede, Ilpo Järvinen, Mark Gross, Jiri Slaby,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, David Howells, Marc Dionne,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Chris Mason, Josef Bacik, Xiubo Li, Ilya Dryomov, Jan Harkes,
	coda, Joel Becker, Christoph Hellwig, Nicolas Pitre,
	Rafael J. Wysocki, Ard Biesheuvel, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, Namjae Jeon, Sungjong Seo, Jan Kara, Andreas Dilger,
	Jaegeuk Kim, OGAWA Hirofumi, Christoph Hellwig, Miklos Szeredi,
	Bob Peterson, Andreas Gruenbacher, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Mikulas Patocka, Mike Kravetz,
	Muchun Song, Jan Kara, David Woodhouse, Dave Kleikamp, Tejun Heo,
	Trond Myklebust, Anna Schumaker, Chuck Lever, Neil Brown,
	Olga Kornievskaia, Dai Ngo, Tom Talpey, Ryusuke Konishi,
	Anton Altaparmakov, Konstantin Komarov, Mark Fasheh, Joseph Qi,
	Bob Copeland, Mike Marshall, Martin Brandenburg,
	Luis Chamberlain, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Sergey Senozhatsky, Phillip Lougher,
	Steven Rostedt, Masami Hiramatsu, Evgeniy Dushistov,
	Chandan Babu R, Darrick J. Wong, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hugh Dickins, Andrew Morton, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John Johansen, Paul Moore,
	James Morris, Serge E. Hallyn, Stephen Smalley, Eric Paris,
	Kent Overstreet, Brian Foster
  Cc: linux-fsdevel, linux-kernel, linux-mm, linuxppc-dev, linux-s390,
	platform-driver-x86, linux-rdma, linux-serial, linux-usb, v9fs,
	linux-afs, autofs, linux-btrfs, ceph-devel, codalist, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, gfs2, linux-um,
	linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux, linux-bcachefs

This shaves 8 bytes off struct inode with a garden-variety Fedora
Kconfig.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 53 ++++++++++++++++++++++++++--------------------
 1 file changed, 30 insertions(+), 23 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 84fdaf399fbe..485b5e21c8e5 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;
-	struct timespec64	__i_mtime;
-	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;
@@ -1517,23 +1520,27 @@ struct timespec64 inode_set_ctime_current(struct inode *inode);
 
 static inline time64_t inode_get_atime_sec(const struct inode *inode)
 {
-	return inode->__i_atime.tv_sec;
+	return inode->i_atime_sec;
 }
 
 static inline long inode_get_atime_nsec(const struct inode *inode)
 {
-	return inode->__i_atime.tv_nsec;
+	return inode->i_atime_nsec;
 }
 
 static inline struct timespec64 inode_get_atime(const struct inode *inode)
 {
-	return inode->__i_atime;
+	struct timespec64 ts = { .tv_sec  = inode_get_atime_sec(inode),
+				 .tv_nsec = inode_get_atime_nsec(inode) };
+
+	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_nsec;
 	return ts;
 }
 
@@ -1542,28 +1549,32 @@ static inline struct timespec64 inode_set_atime(struct inode *inode,
 {
 	struct timespec64 ts = { .tv_sec  = sec,
 				 .tv_nsec = nsec };
+
 	return inode_set_atime_to_ts(inode, ts);
 }
 
 static inline time64_t inode_get_mtime_sec(const struct inode *inode)
 {
-	return inode->__i_mtime.tv_sec;
+	return inode->i_mtime_sec;
 }
 
 static inline long inode_get_mtime_nsec(const struct inode *inode)
 {
-	return inode->__i_mtime.tv_nsec;
+	return inode->i_mtime_nsec;
 }
 
 static inline struct timespec64 inode_get_mtime(const struct inode *inode)
 {
-	return inode->__i_mtime;
+	struct timespec64 ts = { .tv_sec  = inode_get_mtime_sec(inode),
+				 .tv_nsec = inode_get_mtime_nsec(inode) };
+	return ts;
 }
 
 static inline struct timespec64 inode_set_mtime_to_ts(struct inode *inode,
 						      struct timespec64 ts)
 {
-	inode->__i_mtime = ts;
+	inode->i_mtime_sec = ts.tv_sec;
+	inode->i_mtime_nsec = ts.tv_nsec;
 	return ts;
 }
 
@@ -1577,34 +1588,30 @@ static inline struct timespec64 inode_set_mtime(struct inode *inode,
 
 static inline time64_t inode_get_ctime_sec(const struct inode *inode)
 {
-	return inode->__i_ctime.tv_sec;
+	return inode->i_ctime_sec;
 }
 
 static inline long inode_get_ctime_nsec(const struct inode *inode)
 {
-	return inode->__i_ctime.tv_nsec;
+	return inode->i_ctime_nsec;
 }
 
 static inline struct timespec64 inode_get_ctime(const struct inode *inode)
 {
-	return inode->__i_ctime;
+	struct timespec64 ts = { .tv_sec  = inode_get_ctime_sec(inode),
+				 .tv_nsec = inode_get_ctime_nsec(inode) };
+
+	return ts;
 }
 
 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_nsec;
 	return ts;
 }
 
-/**
- * inode_set_ctime - set the ctime in the inode
- * @inode: inode in which to set the ctime
- * @sec: tv_sec value to set
- * @nsec: tv_nsec value to set
- *
- * Set the ctime in @inode to { @sec, @nsec }
- */
 static inline struct timespec64 inode_set_ctime(struct inode *inode,
 						time64_t sec, long nsec)
 {
-- 
2.41.0


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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 88/89] fs: switch timespec64 fields in inode to discrete integers
@ 2023-10-04 18:55   ` Jeff Layton
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2023-10-04 18:55 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Linus Torvalds, David Sterba,
	Amir Goldstein, Theodore Ts'o, Eric Biederman, Kees Cook,
	Jeremy Kerr, Arnd Bergmann, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas,
	Suren Baghdasaryan, Mattia Dongili, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Brad Warrum, Ritu Agarwal,
	Hans de Goede, Ilpo Järvinen, Mark Gross, Jiri Slaby,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, David Howells, Marc Dionne,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Chris Mason, Josef Bacik, Xiubo Li, Ilya Dryomov, Jan Harkes,
	coda, Joel Becker, Christoph Hellwig, Nicolas Pitre,
	Rafael J. Wysocki, Ard Biesheuvel, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, Namjae Jeon, Sungjong Seo, Jan Kara, Andreas Dilger,
	Jaegeuk Kim, OGAWA Hirofumi, Christoph Hellwig, Miklos Szeredi,
	Bob Peterson, Andreas Gruenbacher, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Mikulas Patocka, Mike Kravetz,
	Muchun Song, Jan Kara, David Woodhouse, Dave Kleikamp, Tejun Heo,
	Trond Myklebust, Anna Schumaker, Chuck Lever, Neil Brown,
	Olga Kornievskaia, Dai Ngo, Tom Talpey, Ryusuke Konishi,
	Anton Altaparmakov, Konstantin Komarov, Mark Fasheh, Joseph Qi,
	Bob Copeland, Mike Marshall, Martin Brandenburg,
	Luis Chamberlain, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Sergey Senozhatsky, Phillip Lougher,
	Steven Rostedt, Masami Hiramatsu, Evgeniy Dushistov,
	Chandan Babu R, Darrick J. Wong, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hugh Dickins, Andrew Morton, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John Johansen, Paul Moore,
	James Morris, Serge E. Hallyn, Stephen Smalley, Eric Paris,
	Kent Overstreet, Brian Foster
  Cc: jfs-discussion, linux-efi, platform-driver-x86, gfs2, linux-mm,
	linux-mtd, linux-hardening, linux-afs, linux-s390, linux-nilfs,
	linux-rdma, linux-unionfs, codalist, linux-bcachefs,
	linux-serial, linux-ext4, devel, linux-trace-kernel, linux-cifs,
	selinux, apparmor, autofs, linux-um, reiserfs-devel, ocfs2-devel,
	ceph-devel, linux-nfs, linux-ntfs-dev, linuxppc-dev, v9fs,
	linux-usb, samba-technical, linux-kernel, linux-f2fs-devel

This shaves 8 bytes off struct inode with a garden-variety Fedora
Kconfig.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 53 ++++++++++++++++++++++++++--------------------
 1 file changed, 30 insertions(+), 23 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 84fdaf399fbe..485b5e21c8e5 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;
-	struct timespec64	__i_mtime;
-	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;
@@ -1517,23 +1520,27 @@ struct timespec64 inode_set_ctime_current(struct inode *inode);
 
 static inline time64_t inode_get_atime_sec(const struct inode *inode)
 {
-	return inode->__i_atime.tv_sec;
+	return inode->i_atime_sec;
 }
 
 static inline long inode_get_atime_nsec(const struct inode *inode)
 {
-	return inode->__i_atime.tv_nsec;
+	return inode->i_atime_nsec;
 }
 
 static inline struct timespec64 inode_get_atime(const struct inode *inode)
 {
-	return inode->__i_atime;
+	struct timespec64 ts = { .tv_sec  = inode_get_atime_sec(inode),
+				 .tv_nsec = inode_get_atime_nsec(inode) };
+
+	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_nsec;
 	return ts;
 }
 
@@ -1542,28 +1549,32 @@ static inline struct timespec64 inode_set_atime(struct inode *inode,
 {
 	struct timespec64 ts = { .tv_sec  = sec,
 				 .tv_nsec = nsec };
+
 	return inode_set_atime_to_ts(inode, ts);
 }
 
 static inline time64_t inode_get_mtime_sec(const struct inode *inode)
 {
-	return inode->__i_mtime.tv_sec;
+	return inode->i_mtime_sec;
 }
 
 static inline long inode_get_mtime_nsec(const struct inode *inode)
 {
-	return inode->__i_mtime.tv_nsec;
+	return inode->i_mtime_nsec;
 }
 
 static inline struct timespec64 inode_get_mtime(const struct inode *inode)
 {
-	return inode->__i_mtime;
+	struct timespec64 ts = { .tv_sec  = inode_get_mtime_sec(inode),
+				 .tv_nsec = inode_get_mtime_nsec(inode) };
+	return ts;
 }
 
 static inline struct timespec64 inode_set_mtime_to_ts(struct inode *inode,
 						      struct timespec64 ts)
 {
-	inode->__i_mtime = ts;
+	inode->i_mtime_sec = ts.tv_sec;
+	inode->i_mtime_nsec = ts.tv_nsec;
 	return ts;
 }
 
@@ -1577,34 +1588,30 @@ static inline struct timespec64 inode_set_mtime(struct inode *inode,
 
 static inline time64_t inode_get_ctime_sec(const struct inode *inode)
 {
-	return inode->__i_ctime.tv_sec;
+	return inode->i_ctime_sec;
 }
 
 static inline long inode_get_ctime_nsec(const struct inode *inode)
 {
-	return inode->__i_ctime.tv_nsec;
+	return inode->i_ctime_nsec;
 }
 
 static inline struct timespec64 inode_get_ctime(const struct inode *inode)
 {
-	return inode->__i_ctime;
+	struct timespec64 ts = { .tv_sec  = inode_get_ctime_sec(inode),
+				 .tv_nsec = inode_get_ctime_nsec(inode) };
+
+	return ts;
 }
 
 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_nsec;
 	return ts;
 }
 
-/**
- * inode_set_ctime - set the ctime in the inode
- * @inode: inode in which to set the ctime
- * @sec: tv_sec value to set
- * @nsec: tv_nsec value to set
- *
- * Set the ctime in @inode to { @sec, @nsec }
- */
 static inline struct timespec64 inode_set_ctime(struct inode *inode,
 						time64_t sec, long nsec)
 {
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 89/89] fs: move i_generation into new hole created after timestamp conversion
  2023-10-04 18:55 ` [f2fs-dev] " Jeff Layton
                     ` (2 preceding siblings ...)
  (?)
@ 2023-10-04 18:55   ` Jeff Layton
  -1 siblings, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2023-10-04 18:55 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Linus Torvalds, David Sterba,
	Amir Goldstein, Theodore Ts'o, Eric Biederman, Kees Cook,
	Jeremy Kerr, Arnd Bergmann, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas,
	Suren Baghdasaryan, Mattia Dongili, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Brad Warrum, Ritu Agarwal,
	Hans de Goede, Ilpo Järvinen, Mark Gross, Jiri Slaby,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, David Howells, Marc Dionne,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Chris Mason, Josef Bacik, Xiubo Li, Ilya Dryomov, Jan Harkes,
	coda, Joel Becker, Christoph Hellwig, Nicolas Pitre,
	Rafael J. Wysocki, Ard Biesheuvel, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, Namjae Jeon, Sungjong Seo, Jan Kara, Andreas Dilger,
	Jaegeuk Kim, OGAWA Hirofumi, Christoph Hellwig, Miklos Szeredi,
	Bob Peterson, Andreas Gruenbacher, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Mikulas Patocka, Mike Kravetz,
	Muchun Song, Jan Kara, David Woodhouse, Dave Kleikamp, Tejun Heo,
	Trond Myklebust, Anna Schumaker, Chuck Lever, Neil Brown,
	Olga Kornievskaia, Dai Ngo, Tom Talpey, Ryusuke Konishi,
	Anton Altaparmakov, Konstantin Komarov, Mark Fasheh, Joseph Qi,
	Bob Copeland, Mike Marshall, Martin Brandenburg,
	Luis Chamberlain, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Sergey Senozhatsky, Phillip Lougher,
	Steven Rostedt, Masami Hiramatsu, Evgeniy Dushistov,
	Chandan Babu R, Darrick J. Wong, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hugh Dickins, Andrew Morton, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John Johansen, Paul Moore,
	James Morris, Serge E. Hallyn, Stephen Smalley, Eric Paris,
	Kent Overstreet, Brian Foster
  Cc: linux-fsdevel, linux-kernel, linux-mm, linuxppc-dev, linux-s390,
	platform-driver-x86, linux-rdma, linux-serial, linux-usb, v9fs,
	linux-afs, autofs, linux-btrfs, ceph-devel, codalist, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, gfs2, linux-um,
	linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux, linux-bcachefs

The recent change to use discrete integers instead of struct timespec64
shaved 8 bytes off of struct inode, but it also moves the i_lock
into the previous cacheline, away from the fields that it protects.

Move i_generation above the i_lock, which moves the new 4 byte hole to
just after the i_fsnotify_mask in my setup.

Suggested-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 485b5e21c8e5..686c9f33e725 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -677,6 +677,7 @@ struct inode {
 	u32			i_atime_nsec;
 	u32			i_mtime_nsec;
 	u32			i_ctime_nsec;
+	u32			i_generation;
 	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
 	unsigned short          i_bytes;
 	u8			i_blkbits;
@@ -733,7 +734,6 @@ struct inode {
 		unsigned		i_dir_seq;
 	};
 
-	__u32			i_generation;
 
 #ifdef CONFIG_FSNOTIFY
 	__u32			i_fsnotify_mask; /* all events this inode cares about */
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [f2fs-dev] [PATCH v2 89/89] fs: move i_generation into new hole created after timestamp conversion
@ 2023-10-04 18:55   ` Jeff Layton
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2023-10-04 18:55 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Linus Torvalds, David Sterba,
	Amir Goldstein, Theodore Ts'o, Eric Biederman, Kees Cook,
	Jeremy Kerr, Arnd Bergmann, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas,
	Suren Baghdasaryan, Mattia Dongili, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Brad Warrum, Ritu Agarwal,
	Hans de Goede, Ilpo Järvinen, Mark Gross, Jiri Slaby,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, David Howells, Marc Dionne,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Chris Mason, Josef Bacik, Xiubo Li, Ilya Dryomov, Jan Harkes,
	coda, Joel Becker, Christoph Hellwig, Nicolas Pitre,
	Rafael J. Wysocki, Ard Biesheuvel, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, Namjae Jeon, Sungjong Seo, Jan Kara, Andreas Dilger,
	Jaegeuk Kim, OGAWA Hirofumi, Christoph Hellwig, Miklos Szeredi,
	Bob Peterson, Andreas Gruenbacher, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Mikulas Patocka, Mike Kravetz,
	Muchun Song, Jan Kara, David Woodhouse, Dave Kleikamp, Tejun Heo,
	Trond Myklebust, Anna Schumaker, Chuck Lever, Neil Brown,
	Olga Kornievskaia, Dai Ngo, Tom Talpey, Ryusuke Konishi,
	Anton Altaparmakov, Konstantin Komarov, Mark Fasheh, Joseph Qi,
	Bob Copeland, Mike Marshall, Martin Brandenburg,
	Luis Chamberlain, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Sergey Senozhatsky, Phillip Lougher,
	Steven Rostedt, Masami Hiramatsu, Evgeniy Dushistov,
	Chandan Babu R, Darrick J. Wong, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hugh Dickins, Andrew Morton, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John Johansen, Paul Moore,
	James Morris, Serge E. Hallyn, Stephen Smalley, Eric Paris,
	Kent Overstreet, Brian Foster
  Cc: jfs-discussion, linux-efi, platform-driver-x86, gfs2, linux-mm,
	linux-mtd, linux-hardening, linux-afs, linux-s390, linux-nilfs,
	linux-rdma, linux-unionfs, codalist, linux-bcachefs,
	linux-serial, linux-ext4, devel, linux-trace-kernel, linux-cifs,
	selinux, apparmor, autofs, linux-um, reiserfs-devel, ocfs2-devel,
	ceph-devel, linux-nfs, linux-ntfs-dev, linuxppc-dev, v9fs,
	linux-usb, samba-technical, linux-kernel, linux-f2fs-devel,
	linux-xfs, linux-security-module, netdev, linux-fsdevel, bpf,
	ntfs3, linux-erofs, linux-karma-devel, linux-btrfs

The recent change to use discrete integers instead of struct timespec64
shaved 8 bytes off of struct inode, but it also moves the i_lock
into the previous cacheline, away from the fields that it protects.

Move i_generation above the i_lock, which moves the new 4 byte hole to
just after the i_fsnotify_mask in my setup.

Suggested-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 485b5e21c8e5..686c9f33e725 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -677,6 +677,7 @@ struct inode {
 	u32			i_atime_nsec;
 	u32			i_mtime_nsec;
 	u32			i_ctime_nsec;
+	u32			i_generation;
 	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
 	unsigned short          i_bytes;
 	u8			i_blkbits;
@@ -733,7 +734,6 @@ struct inode {
 		unsigned		i_dir_seq;
 	};
 
-	__u32			i_generation;
 
 #ifdef CONFIG_FSNOTIFY
 	__u32			i_fsnotify_mask; /* all events this inode cares about */
-- 
2.41.0



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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 89/89] fs: move i_generation into new hole created after timestamp conversion
@ 2023-10-04 18:55   ` Jeff Layton
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2023-10-04 18:55 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Linus Torvalds, David Sterba,
	Amir Goldstein, Theodore Ts'o, Eric Biederman, Kees Cook,
	Jeremy Kerr, Arnd Bergmann, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas,
	Suren Baghdasaryan, Mattia Dongili, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Brad Warrum, Ritu Agarwal,
	Hans de Goede, Ilpo Järvinen, Mark Gross, Jiri Slaby,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, David Howells, Marc Dionne,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Chris Mason, Josef Bacik, Xiubo Li, Ilya Dryomov, Jan Harkes,
	coda, Joel Becker, Christoph Hellwig, Nicolas Pitre,
	Rafael J. Wysocki, Ard Biesheuvel, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, Namjae Jeon, Sungjong Seo, Jan Kara, Andreas Dilger,
	Jaegeuk Kim, OGAWA Hirofumi, Christoph Hellwig, Miklos Szeredi,
	Bob Peterson, Andreas Gruenbacher, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Mikulas Patocka, Mike Kravetz,
	Muchun Song, Jan Kara, David Woodhouse, Dave Kleikamp, Tejun Heo,
	Trond Myklebust, Anna Schumaker, Chuck Lever, Neil Brown,
	Olga Kornievskaia, Dai Ngo, Tom Talpey, Ryusuke Konishi,
	Anton Altaparmakov, Konstantin Komarov, Mark Fasheh, Joseph Qi,
	Bob Copeland, Mike Marshall, Martin Brandenburg,
	Luis Chamberlain, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Sergey Senozhatsky, Phillip Lougher,
	Steven Rostedt, Masami Hiramatsu, Evgeniy Dushistov,
	Chandan Babu R, Darrick J. Wong, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hugh Dickins, Andrew Morton, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John Johansen, Paul Moore,
	James Morris, Serge E. Hallyn, Stephen Smalley, Eric Paris,
	Kent Overstreet, Brian Foster
  Cc: linux-fsdevel, linux-kernel, linux-mm, linuxppc-dev, linux-s390,
	platform-driver-x86, linux-rdma, linux-serial, linux-usb, v9fs,
	linux-afs, autofs, linux-btrfs, ceph-devel, codalist, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, gfs2, linux-um,
	linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux, linux-bcachefs

The recent change to use discrete integers instead of struct timespec64
shaved 8 bytes off of struct inode, but it also moves the i_lock
into the previous cacheline, away from the fields that it protects.

Move i_generation above the i_lock, which moves the new 4 byte hole to
just after the i_fsnotify_mask in my setup.

Suggested-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 485b5e21c8e5..686c9f33e725 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -677,6 +677,7 @@ struct inode {
 	u32			i_atime_nsec;
 	u32			i_mtime_nsec;
 	u32			i_ctime_nsec;
+	u32			i_generation;
 	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
 	unsigned short          i_bytes;
 	u8			i_blkbits;
@@ -733,7 +734,6 @@ struct inode {
 		unsigned		i_dir_seq;
 	};
 
-	__u32			i_generation;
 
 #ifdef CONFIG_FSNOTIFY
 	__u32			i_fsnotify_mask; /* all events this inode cares about */
-- 
2.41.0


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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 89/89] fs: move i_generation into new hole created after timestamp conversion
@ 2023-10-04 18:55   ` Jeff Layton
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2023-10-04 18:55 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Linus Torvalds, David Sterba,
	Amir Goldstein, Theodore Ts'o, Eric Biederman, Kees Cook,
	Jeremy Kerr, Arnd Bergmann, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas,
	Suren Baghdasaryan, Mattia Dongili, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Brad Warrum, Ritu Agarwal,
	Hans de Goede, Ilpo Järvinen, Mark Gross, Jiri Slaby,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, David Howells, Marc Dionne,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Chris Mason, Josef Bacik, Xiubo Li, Ilya Dryomov, Jan Harkes,
	coda, Joel Becker, Christoph Hellwig, Nicolas Pitre,
	Rafael J. Wysocki, Ard Biesheuvel, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, Namjae Jeon, Sungjong Seo, Jan Kara, Andreas Dilger,
	Jaegeuk Kim, OGAWA Hirofumi, Christoph Hellwig, Miklos Szeredi,
	Bob Peterson, Andreas Gruenbacher, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Mikulas Patocka, Mike Kravetz,
	Muchun Song, Jan Kara, David Woodhouse, Dave Kleikamp, Tejun Heo,
	Trond Myklebust, Anna Schumaker, Chuck Lever, Neil Brown,
	Olga Kornievskaia, Dai Ngo, Tom Talpey, Ryusuke Konishi,
	Anton Altaparmakov, Konstantin Komarov, Mark Fasheh, Joseph Qi,
	Bob Copeland, Mike Marshall, Martin Brandenburg,
	Luis Chamberlain, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Sergey Senozhatsky, Phillip Lougher,
	Steven Rostedt, Masami Hiramatsu, Evgeniy Dushistov,
	Chandan Babu R, Darrick J. Wong, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hugh Dickins, Andrew Morton, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John Johansen, Paul Moore,
	James Morris, Serge E. Hallyn, Stephen Smalley, Eric Paris,
	Kent Overstreet, Brian Foster
  Cc: linux-fsdevel, linux-kernel, linux-mm, linuxppc-dev, linux-s390,
	platform-driver-x86, linux-rdma, linux-serial, linux-usb, v9fs,
	linux-afs, autofs, linux-btrfs, ceph-devel, codalist, linux-efi,
	linux-erofs, linux-ext4, linux-f2fs-devel, gfs2, linux-um,
	linux-mtd, jfs-discussion, linux-nfs, linux-nilfs,
	linux-ntfs-dev, ntfs3, ocfs2-devel, linux-karma-devel, devel,
	linux-unionfs, linux-hardening, reiserfs-devel, linux-cifs,
	samba-technical, linux-trace-kernel, linux-xfs, bpf, netdev,
	apparmor, linux-security-module, selinux, linux-bcachefs

The recent change to use discrete integers instead of struct timespec64
shaved 8 bytes off of struct inode, but it also moves the i_lock
into the previous cacheline, away from the fields that it protects.

Move i_generation above the i_lock, which moves the new 4 byte hole to
just after the i_fsnotify_mask in my setup.

Suggested-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 485b5e21c8e5..686c9f33e725 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -677,6 +677,7 @@ struct inode {
 	u32			i_atime_nsec;
 	u32			i_mtime_nsec;
 	u32			i_ctime_nsec;
+	u32			i_generation;
 	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
 	unsigned short          i_bytes;
 	u8			i_blkbits;
@@ -733,7 +734,6 @@ struct inode {
 		unsigned		i_dir_seq;
 	};
 
-	__u32			i_generation;
 
 #ifdef CONFIG_FSNOTIFY
 	__u32			i_fsnotify_mask; /* all events this inode cares about */
-- 
2.41.0


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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 89/89] fs: move i_generation into new hole created after timestamp conversion
@ 2023-10-04 18:55   ` Jeff Layton
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2023-10-04 18:55 UTC (permalink / raw)
  To: Alexander Viro, Christian Brauner, Linus Torvalds, David Sterba,
	Amir Goldstein, Theodore Ts'o, Eric Biederman, Kees Cook,
	Jeremy Kerr, Arnd Bergmann, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
	Martijn Coenen, Joel Fernandes, Carlos Llamas,
	Suren Baghdasaryan, Mattia Dongili, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Brad Warrum, Ritu Agarwal,
	Hans de Goede, Ilpo Järvinen, Mark Gross, Jiri Slaby,
	Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck, David Sterba, David Howells, Marc Dionne,
	Ian Kent, Luis de Bethencourt, Salah Triki, Tigran A. Aivazian,
	Chris Mason, Josef Bacik, Xiubo Li, Ilya Dryomov, Jan Harkes,
	coda, Joel Becker, Christoph Hellwig, Nicolas Pitre,
	Rafael J. Wysocki, Ard Biesheuvel, Gao Xiang, Chao Yu, Yue Hu,
	Jeffle Xu, Namjae Jeon, Sungjong Seo, Jan Kara, Andreas Dilger,
	Jaegeuk Kim, OGAWA Hirofumi, Christoph Hellwig, Miklos Szeredi,
	Bob Peterson, Andreas Gruenbacher, Richard Weinberger,
	Anton Ivanov, Johannes Berg, Mikulas Patocka, Mike Kravetz,
	Muchun Song, Jan Kara, David Woodhouse, Dave Kleikamp, Tejun Heo,
	Trond Myklebust, Anna Schumaker, Chuck Lever, Neil Brown,
	Olga Kornievskaia, Dai Ngo, Tom Talpey, Ryusuke Konishi,
	Anton Altaparmakov, Konstantin Komarov, Mark Fasheh, Joseph Qi,
	Bob Copeland, Mike Marshall, Martin Brandenburg,
	Luis Chamberlain, Iurii Zaikin, Tony Luck, Guilherme G. Piccoli,
	Anders Larsen, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Sergey Senozhatsky, Phillip Lougher,
	Steven Rostedt, Masami Hiramatsu, Evgeniy Dushistov,
	Chandan Babu R, Darrick J. Wong, Damien Le Moal, Naohiro Aota,
	Johannes Thumshirn, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Hugh Dickins, Andrew Morton, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John Johansen, Paul Moore,
	James Morris, Serge E. Hallyn, Stephen Smalley, Eric Paris,
	Kent Overstreet, Brian Foster
  Cc: jfs-discussion, linux-efi, platform-driver-x86, gfs2, linux-mm,
	linux-mtd, linux-hardening, linux-afs, linux-s390, linux-nilfs,
	linux-rdma, linux-unionfs, codalist, linux-bcachefs,
	linux-serial, linux-ext4, devel, linux-trace-kernel, linux-cifs,
	selinux, apparmor, autofs, linux-um, reiserfs-devel, ocfs2-devel,
	ceph-devel, linux-nfs, linux-ntfs-dev, linuxppc-dev, v9fs,
	linux-usb, samba-technical, linux-kernel, linux-f2fs-devel

The recent change to use discrete integers instead of struct timespec64
shaved 8 bytes off of struct inode, but it also moves the i_lock
into the previous cacheline, away from the fields that it protects.

Move i_generation above the i_lock, which moves the new 4 byte hole to
just after the i_fsnotify_mask in my setup.

Suggested-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 include/linux/fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 485b5e21c8e5..686c9f33e725 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -677,6 +677,7 @@ struct inode {
 	u32			i_atime_nsec;
 	u32			i_mtime_nsec;
 	u32			i_ctime_nsec;
+	u32			i_generation;
 	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
 	unsigned short          i_bytes;
 	u8			i_blkbits;
@@ -733,7 +734,6 @@ struct inode {
 		unsigned		i_dir_seq;
 	};
 
-	__u32			i_generation;
 
 #ifdef CONFIG_FSNOTIFY
 	__u32			i_fsnotify_mask; /* all events this inode cares about */
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 89/89] fs: move i_generation into new hole created after timestamp conversion
  2023-10-04 18:55   ` [f2fs-dev] " Jeff Layton
                     ` (3 preceding siblings ...)
  (?)
@ 2023-10-05  5:08   ` Amir Goldstein
  2023-10-05 12:45     ` Jeff Layton
  -1 siblings, 1 reply; 18+ messages in thread
From: Amir Goldstein @ 2023-10-05  5:08 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Christian Brauner, Al Viro, Jan Kara, linux-kernel, linux-fsdevel

On Wed, Oct 4, 2023 at 9:56 PM Jeff Layton <jlayton@kernel.org> wrote:
>
> The recent change to use discrete integers instead of struct timespec64
> shaved 8 bytes off of struct inode, but it also moves the i_lock
> into the previous cacheline, away from the fields that it protects.
>
> Move i_generation above the i_lock, which moves the new 4 byte hole to
> just after the i_fsnotify_mask in my setup.

Might be good to mention that this hole has a purpose...

>
> Suggested-by: Amir Goldstein <amir73il@gmail.com>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>  include/linux/fs.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 485b5e21c8e5..686c9f33e725 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -677,6 +677,7 @@ struct inode {
>         u32                     i_atime_nsec;
>         u32                     i_mtime_nsec;
>         u32                     i_ctime_nsec;
> +       u32                     i_generation;
>         spinlock_t              i_lock; /* i_blocks, i_bytes, maybe i_size */
>         unsigned short          i_bytes;
>         u8                      i_blkbits;
> @@ -733,7 +734,6 @@ struct inode {
>                 unsigned                i_dir_seq;
>         };
>
> -       __u32                   i_generation;
>
>  #ifdef CONFIG_FSNOTIFY
>         __u32                   i_fsnotify_mask; /* all events this inode cares about */

If you post another version, please leave a comment here

+         /* 32bit hole reserved for expanding i_fsnotify_mask to 64bit */

Thanks,
Amir.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 89/89] fs: move i_generation into new hole created after timestamp conversion
  2023-10-05  5:08   ` Amir Goldstein
@ 2023-10-05 12:45     ` Jeff Layton
  2023-10-05 13:07       ` Amir Goldstein
  0 siblings, 1 reply; 18+ messages in thread
From: Jeff Layton @ 2023-10-05 12:45 UTC (permalink / raw)
  To: Amir Goldstein
  Cc: Christian Brauner, Al Viro, Jan Kara, linux-kernel, linux-fsdevel

On Thu, 2023-10-05 at 08:08 +0300, Amir Goldstein wrote:
> On Wed, Oct 4, 2023 at 9:56 PM Jeff Layton <jlayton@kernel.org> wrote:
> > 
> > The recent change to use discrete integers instead of struct timespec64
> > shaved 8 bytes off of struct inode, but it also moves the i_lock
> > into the previous cacheline, away from the fields that it protects.
> > 
> > Move i_generation above the i_lock, which moves the new 4 byte hole to
> > just after the i_fsnotify_mask in my setup.
> 
> Might be good to mention that this hole has a purpose...
> 
> > 
> > Suggested-by: Amir Goldstein <amir73il@gmail.com>
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> >  include/linux/fs.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/include/linux/fs.h b/include/linux/fs.h
> > index 485b5e21c8e5..686c9f33e725 100644
> > --- a/include/linux/fs.h
> > +++ b/include/linux/fs.h
> > @@ -677,6 +677,7 @@ struct inode {
> >         u32                     i_atime_nsec;
> >         u32                     i_mtime_nsec;
> >         u32                     i_ctime_nsec;
> > +       u32                     i_generation;
> >         spinlock_t              i_lock; /* i_blocks, i_bytes, maybe i_size */
> >         unsigned short          i_bytes;
> >         u8                      i_blkbits;
> > @@ -733,7 +734,6 @@ struct inode {
> >                 unsigned                i_dir_seq;
> >         };
> > 
> > -       __u32                   i_generation;
> > 
> >  #ifdef CONFIG_FSNOTIFY
> >         __u32                   i_fsnotify_mask; /* all events this inode cares about */
> 
> If you post another version, please leave a comment here
> 
> +         /* 32bit hole reserved for expanding i_fsnotify_mask to 64bit */
> 

Sure.

I suppose we could create a union there too if you really want to
reserve it:

	union {
		__u32		i_fsnotify_mask;
		__u64		__i_fsnotify_mask_ext;
	};

-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 89/89] fs: move i_generation into new hole created after timestamp conversion
  2023-10-05 12:45     ` Jeff Layton
@ 2023-10-05 13:07       ` Amir Goldstein
  0 siblings, 0 replies; 18+ messages in thread
From: Amir Goldstein @ 2023-10-05 13:07 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Christian Brauner, Al Viro, Jan Kara, linux-kernel, linux-fsdevel

On Thu, Oct 5, 2023 at 3:45 PM Jeff Layton <jlayton@kernel.org> wrote:
>
> On Thu, 2023-10-05 at 08:08 +0300, Amir Goldstein wrote:
> > On Wed, Oct 4, 2023 at 9:56 PM Jeff Layton <jlayton@kernel.org> wrote:
> > >
> > > The recent change to use discrete integers instead of struct timespec64
> > > shaved 8 bytes off of struct inode, but it also moves the i_lock
> > > into the previous cacheline, away from the fields that it protects.
> > >
> > > Move i_generation above the i_lock, which moves the new 4 byte hole to
> > > just after the i_fsnotify_mask in my setup.
> >
> > Might be good to mention that this hole has a purpose...
> >
> > >
> > > Suggested-by: Amir Goldstein <amir73il@gmail.com>
> > > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > > ---
> > >  include/linux/fs.h | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/include/linux/fs.h b/include/linux/fs.h
> > > index 485b5e21c8e5..686c9f33e725 100644
> > > --- a/include/linux/fs.h
> > > +++ b/include/linux/fs.h
> > > @@ -677,6 +677,7 @@ struct inode {
> > >         u32                     i_atime_nsec;
> > >         u32                     i_mtime_nsec;
> > >         u32                     i_ctime_nsec;
> > > +       u32                     i_generation;
> > >         spinlock_t              i_lock; /* i_blocks, i_bytes, maybe i_size */
> > >         unsigned short          i_bytes;
> > >         u8                      i_blkbits;
> > > @@ -733,7 +734,6 @@ struct inode {
> > >                 unsigned                i_dir_seq;
> > >         };
> > >
> > > -       __u32                   i_generation;
> > >
> > >  #ifdef CONFIG_FSNOTIFY
> > >         __u32                   i_fsnotify_mask; /* all events this inode cares about */
> >
> > If you post another version, please leave a comment here
> >
> > +         /* 32bit hole reserved for expanding i_fsnotify_mask to 64bit */
> >
>
> Sure.
>
> I suppose we could create a union there too if you really want to
> reserve it:
>
>         union {
>                 __u32           i_fsnotify_mask;
>                 __u64           __i_fsnotify_mask_ext;
>         };
>

No need.
I was thinking it is going to be
      unsigned long i_fsnotify_mask;

on 32bit arch, we either not support the high bitmask events
or we fold them with the lower 32bit in the inode mask,
because i_fsnotify_mask is an optimization to avoid going
into inode marks iteration.

Thanks,
Amir.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2023-10-05 16:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-04 18:55 [PATCH v2 87/89] fs: rename inode i_atime and i_mtime fields Jeff Layton
2023-10-04 18:55 ` Jeff Layton
2023-10-04 18:55 ` Jeff Layton
2023-10-04 18:55 ` Jeff Layton
2023-10-04 18:55 ` [f2fs-dev] " Jeff Layton
2023-10-04 18:55 ` [PATCH v2 88/89] fs: switch timespec64 fields in inode to discrete integers Jeff Layton
2023-10-04 18:55   ` Jeff Layton
2023-10-04 18:55   ` Jeff Layton
2023-10-04 18:55   ` Jeff Layton
2023-10-04 18:55   ` [f2fs-dev] " Jeff Layton
2023-10-04 18:55 ` [PATCH v2 89/89] fs: move i_generation into new hole created after timestamp conversion Jeff Layton
2023-10-04 18:55   ` Jeff Layton
2023-10-04 18:55   ` Jeff Layton
2023-10-04 18:55   ` Jeff Layton
2023-10-04 18:55   ` [f2fs-dev] " Jeff Layton
2023-10-05  5:08   ` Amir Goldstein
2023-10-05 12:45     ` Jeff Layton
2023-10-05 13:07       ` Amir Goldstein

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.