linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: define inode flags using bit numbers
@ 2020-07-13  3:09 Eric Biggers
  2020-07-13 11:59 ` Matthew Wilcox
  2020-07-27 16:48 ` Eric Biggers
  0 siblings, 2 replies; 6+ messages in thread
From: Eric Biggers @ 2020-07-13  3:09 UTC (permalink / raw)
  To: linux-fsdevel, Alexander Viro

From: Eric Biggers <ebiggers@google.com>

Define the VFS inode flags using bit numbers instead of hardcoding
powers of 2, which has become unwieldy now that we're up to 65536.

No change in the actual values.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 include/linux/fs.h | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index f5abba86107d..973a3f9a3df5 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1982,27 +1982,27 @@ struct super_operations {
 /*
  * Inode flags - they have no relation to superblock flags now
  */
-#define S_SYNC		1	/* Writes are synced at once */
-#define S_NOATIME	2	/* Do not update access times */
-#define S_APPEND	4	/* Append-only file */
-#define S_IMMUTABLE	8	/* Immutable file */
-#define S_DEAD		16	/* removed, but still open directory */
-#define S_NOQUOTA	32	/* Inode is not counted to quota */
-#define S_DIRSYNC	64	/* Directory modifications are synchronous */
-#define S_NOCMTIME	128	/* Do not update file c/mtime */
-#define S_SWAPFILE	256	/* Do not truncate: swapon got its bmaps */
-#define S_PRIVATE	512	/* Inode is fs-internal */
-#define S_IMA		1024	/* Inode has an associated IMA struct */
-#define S_AUTOMOUNT	2048	/* Automount/referral quasi-directory */
-#define S_NOSEC		4096	/* no suid or xattr security attributes */
+#define S_SYNC		(1 << 0)  /* Writes are synced at once */
+#define S_NOATIME	(1 << 1)  /* Do not update access times */
+#define S_APPEND	(1 << 2)  /* Append-only file */
+#define S_IMMUTABLE	(1 << 3)  /* Immutable file */
+#define S_DEAD		(1 << 4)  /* removed, but still open directory */
+#define S_NOQUOTA	(1 << 5)  /* Inode is not counted to quota */
+#define S_DIRSYNC	(1 << 6)  /* Directory modifications are synchronous */
+#define S_NOCMTIME	(1 << 7)  /* Do not update file c/mtime */
+#define S_SWAPFILE	(1 << 8)  /* Do not truncate: swapon got its bmaps */
+#define S_PRIVATE	(1 << 9)  /* Inode is fs-internal */
+#define S_IMA		(1 << 10) /* Inode has an associated IMA struct */
+#define S_AUTOMOUNT	(1 << 11) /* Automount/referral quasi-directory */
+#define S_NOSEC		(1 << 12) /* no suid or xattr security attributes */
 #ifdef CONFIG_FS_DAX
-#define S_DAX		8192	/* Direct Access, avoiding the page cache */
+#define S_DAX		(1 << 13) /* Direct Access, avoiding the page cache */
 #else
-#define S_DAX		0	/* Make all the DAX code disappear */
+#define S_DAX		0	  /* Make all the DAX code disappear */
 #endif
-#define S_ENCRYPTED	16384	/* Encrypted file (using fs/crypto/) */
-#define S_CASEFOLD	32768	/* Casefolded file */
-#define S_VERITY	65536	/* Verity file (using fs/verity/) */
+#define S_ENCRYPTED	(1 << 14) /* Encrypted file (using fs/crypto/) */
+#define S_CASEFOLD	(1 << 15) /* Casefolded file */
+#define S_VERITY	(1 << 16) /* Verity file (using fs/verity/) */
 
 /*
  * Note that nosuid etc flags are inode-specific: setting some file-system
-- 
2.27.0


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

* Re: [PATCH] fs: define inode flags using bit numbers
  2020-07-13  3:09 [PATCH] fs: define inode flags using bit numbers Eric Biggers
@ 2020-07-13 11:59 ` Matthew Wilcox
  2020-07-13 16:02   ` Eric Biggers
  2020-07-27 16:48 ` Eric Biggers
  1 sibling, 1 reply; 6+ messages in thread
From: Matthew Wilcox @ 2020-07-13 11:59 UTC (permalink / raw)
  To: Eric Biggers; +Cc: linux-fsdevel, Alexander Viro

On Sun, Jul 12, 2020 at 08:09:52PM -0700, Eric Biggers wrote:
> Define the VFS inode flags using bit numbers instead of hardcoding
> powers of 2, which has become unwieldy now that we're up to 65536.

If you're going to change these, why not use the BIT() macro?


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

* Re: [PATCH] fs: define inode flags using bit numbers
  2020-07-13 11:59 ` Matthew Wilcox
@ 2020-07-13 16:02   ` Eric Biggers
  2020-07-14  1:18     ` Dave Chinner
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Biggers @ 2020-07-13 16:02 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: linux-fsdevel, Alexander Viro

On Mon, Jul 13, 2020 at 12:59:47PM +0100, Matthew Wilcox wrote:
> On Sun, Jul 12, 2020 at 08:09:52PM -0700, Eric Biggers wrote:
> > Define the VFS inode flags using bit numbers instead of hardcoding
> > powers of 2, which has become unwieldy now that we're up to 65536.
> 
> If you're going to change these, why not use the BIT() macro?
> 

Either way would be fine with me, but I've seen people complain about BIT()
before and say they prefer just (1 << n).

- Eric

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

* Re: [PATCH] fs: define inode flags using bit numbers
  2020-07-13 16:02   ` Eric Biggers
@ 2020-07-14  1:18     ` Dave Chinner
  0 siblings, 0 replies; 6+ messages in thread
From: Dave Chinner @ 2020-07-14  1:18 UTC (permalink / raw)
  To: Eric Biggers; +Cc: Matthew Wilcox, linux-fsdevel, Alexander Viro

On Mon, Jul 13, 2020 at 09:02:59AM -0700, Eric Biggers wrote:
> On Mon, Jul 13, 2020 at 12:59:47PM +0100, Matthew Wilcox wrote:
> > On Sun, Jul 12, 2020 at 08:09:52PM -0700, Eric Biggers wrote:
> > > Define the VFS inode flags using bit numbers instead of hardcoding
> > > powers of 2, which has become unwieldy now that we're up to 65536.
> > 
> > If you're going to change these, why not use the BIT() macro?
> > 
> 
> Either way would be fine with me, but I've seen people complain about BIT()
> before and say they prefer just (1 << n).

Yup, BIT() is just another layer of largely useless macro
obfuscation that forces readers to do yet another lookup to find out
what it means.  Please don't use it.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

* Re: [PATCH] fs: define inode flags using bit numbers
  2020-07-13  3:09 [PATCH] fs: define inode flags using bit numbers Eric Biggers
  2020-07-13 11:59 ` Matthew Wilcox
@ 2020-07-27 16:48 ` Eric Biggers
  2020-07-27 18:38   ` Al Viro
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Biggers @ 2020-07-27 16:48 UTC (permalink / raw)
  To: linux-fsdevel, Alexander Viro

On Sun, Jul 12, 2020 at 08:09:52PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> Define the VFS inode flags using bit numbers instead of hardcoding
> powers of 2, which has become unwieldy now that we're up to 65536.
> 
> No change in the actual values.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Al, any interest in taking this patch?

- Eric

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

* Re: [PATCH] fs: define inode flags using bit numbers
  2020-07-27 16:48 ` Eric Biggers
@ 2020-07-27 18:38   ` Al Viro
  0 siblings, 0 replies; 6+ messages in thread
From: Al Viro @ 2020-07-27 18:38 UTC (permalink / raw)
  To: Eric Biggers; +Cc: linux-fsdevel

On Mon, Jul 27, 2020 at 09:48:09AM -0700, Eric Biggers wrote:
> On Sun, Jul 12, 2020 at 08:09:52PM -0700, Eric Biggers wrote:
> > From: Eric Biggers <ebiggers@google.com>
> > 
> > Define the VFS inode flags using bit numbers instead of hardcoding
> > powers of 2, which has become unwieldy now that we're up to 65536.
> > 
> > No change in the actual values.
> > 
> > Signed-off-by: Eric Biggers <ebiggers@google.com>
> 
> Al, any interest in taking this patch?

*shrug*

I don't see much point in that, but... might as well.  Applied.

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

end of thread, other threads:[~2020-07-27 18:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-13  3:09 [PATCH] fs: define inode flags using bit numbers Eric Biggers
2020-07-13 11:59 ` Matthew Wilcox
2020-07-13 16:02   ` Eric Biggers
2020-07-14  1:18     ` Dave Chinner
2020-07-27 16:48 ` Eric Biggers
2020-07-27 18:38   ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).