[2/3] ext4: omit init_itable=n in procfs when disabled

Message ID 1cd4af3c4ebf5c6253f52834041697f5a7657153.1520480776.git.tgnottingham@gmail.com
State Accepted
Headers show
Series
  • ext4: improve display of mount options
Related show

Commit Message

Tyson Nottingham March 8, 2018, 5:53 a.m.
Don't show init_itable=n in /proc/fs/ext4/<dev>/options when filesystem
is mounted with noinit_itable.

Signed-off-by: Tyson Nottingham <tgnottingham@gmail.com>
---

Before:

$ sudo mount -o loop=$(losetup -f) image.ext4 mnt
$ mount | grep image
/home/tgnottingham/image.ext4 on /home/tgnottingham/mnt type ext4 (rw,relatime,data=ordered)
$ grep init /proc/fs/ext4/loop0/options
init_itable=10

$ sudo mount -o loop=$(losetup -f),noinit_itable image.ext4 mnt
$ mount | grep image
/home/tgnottingham/image.ext4 on /home/tgnottingham/mnt type ext4 (rw,relatime,noinit_itable,data=ordered)
$ grep init /proc/fs/ext4/loop0/options
noinit_itable
init_itable=10

^ Superfluous init_itable=10.


After:

$ sudo mount -o loop=$(losetup -f) image.ext4 mnt
$ mount -l | grep image
/home/tgnottingham/image.ext4 on /home/tgnottingham/mnt type ext4 (rw,relatime,data=ordered)
$ grep init /proc/fs/ext4/loop0/options
init_itable=10

$ sudo mount -o loop=$(losetup -f),noinit_itable image.ext4 mnt
$ mount -l | grep image
/home/tgnottingham/image.ext4 on /home/tgnottingham/mnt type ext4 (rw,relatime,noinit_itable,data=ordered)
$ grep init /proc/fs/ext4/loop0/options
noinit_itable

---
 fs/ext4/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Theodore Y. Ts'o March 30, 2018, 4:57 a.m. | #1
On Wed, Mar 07, 2018 at 09:53:37PM -0800, Tyson Nottingham wrote:
> Don't show init_itable=n in /proc/fs/ext4/<dev>/options when filesystem
> is mounted with noinit_itable.
> 
> Signed-off-by: Tyson Nottingham <tgnottingham@gmail.com>

Applied, thanks.

					- Ted

Patch

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 6b07fa2..7437ed0 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2081,7 +2081,7 @@  static int _ext4_show_options(struct seq_file *seq, struct super_block *sb,
 		SEQ_OPTS_PRINT("inode_readahead_blks=%u",
 			       sbi->s_inode_readahead_blks);
 
-	if (nodefs || (test_opt(sb, INIT_INODE_TABLE) &&
+	if (test_opt(sb, INIT_INODE_TABLE) && (nodefs ||
 		       (sbi->s_li_wait_mult != EXT4_DEF_LI_WAIT_MULT)))
 		SEQ_OPTS_PRINT("init_itable=%u", sbi->s_li_wait_mult);
 	if (nodefs || sbi->s_max_dir_size_kb)