From d59fc8132e11279498703c2aa8611ad59d1cfdae Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 30 Mar 2018 01:01:35 -0400 Subject: [PATCH] add patch dont-show-jbd-data-option-if-defaulted --- dont-show-jbd-data-option-if-defaulted | 81 ++++++++++++++++++++++++++++++++++ series | 1 + timestamps | 7 +-- 3 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 dont-show-jbd-data-option-if-defaulted diff --git a/dont-show-jbd-data-option-if-defaulted b/dont-show-jbd-data-option-if-defaulted new file mode 100644 index 00000000..cf60f6dd --- /dev/null +++ b/dont-show-jbd-data-option-if-defaulted @@ -0,0 +1,81 @@ +ext4: don't show data= option if defaulted + +From: Tyson Nottingham + +Previously, mount -l would show data= even if the ext4 default +journaling mode was being used. Change this to be consistent with the +rest of the options. + +Ext4 already did the right thing when the journaling mode being used +matched the one specified in the superblock's default mount options. The +reason it failed to do the right thing for the ext4 defaults is that, +when set, they were never included in sbi->s_def_mount_opt (unlike the +superblock's defaults, which were). + +Signed-off-by: Tyson Nottingham +Signed-off-by: Theodore Ts'o +--- + +Before: + +(Without any default journaling mode configured in superblock or mount +option, ext4 will use its own default, which is ordered in this case.) + +$ sudo mount -o loop=$(losetup -f) image.ext4 mnt +$ grep data /proc/fs/ext4/loop0/options +data=ordered +$ mount -l | grep image +/home/tgnottingham/image.ext4 on /home/tgnottingham/mnt type ext4 (rw,relatime,data=ordered) + +data=ordered is still displayed, even though the ext4 default was used. + + +After: + +$ sudo mount -o loop=$(losetup -f) image.ext4 mnt +$ grep data /proc/fs/ext4/loop0/options +data=ordered +$ mount -l | grep image +/home/tgnottingham/image.ext4 on /home/tgnottingham/mnt type ext4 (rw,relatime) + +data=ordered is not displayed, since it was the default. + +tgnottingham@kernel-dev:~$ sudo mount -o loop=$(losetup -f),data=journal image.ext4 mnt +$ grep data /proc/fs/ext4/loop0/options +data=journal +$ mount -l | grep image +/home/tgnottingham/image.ext4 on /home/tgnottingham/mnt type ext4 (rw,relatime,nodelalloc,data=journal) + +data=journal is displayed, since it was not the default. + + +Default mount options stored in superblock were tested but not shown. + +--- + fs/ext4/super.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index 7437ed0..7fbe7f4 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -4091,10 +4091,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) + * cope, else JOURNAL_DATA + */ + if (jbd2_journal_check_available_features +- (sbi->s_journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE)) ++ (sbi->s_journal, 0, 0, JBD2_FEATURE_INCOMPAT_REVOKE)) { + set_opt(sb, ORDERED_DATA); +- else ++ sbi->s_def_mount_opt |= EXT4_MOUNT_ORDERED_DATA; ++ } else { + set_opt(sb, JOURNAL_DATA); ++ sbi->s_def_mount_opt |= EXT4_MOUNT_JOURNAL_DATA; ++ } + break; + + case EXT4_MOUNT_ORDERED_DATA: +-- +2.7.4 + + diff --git a/series b/series index 22f6b19e..14842934 100644 --- a/series +++ b/series @@ -28,6 +28,7 @@ remove-unsued-parameters-in-sysfs-code simplify-object-usage show-more-binary-mount-options omit-init_itable-in-procfs-when-disabled +dont-show-jbd-data-option-if-defaulted #################################################### # unstable patches diff --git a/timestamps b/timestamps index 14d037fe..9244d9c0 100755 --- a/timestamps +++ b/timestamps @@ -57,7 +57,8 @@ touch -d @1522382618 null-out-kobject-during-sysfs-cleanup touch -d @1522383190 remove-unsued-parameters-in-sysfs-code touch -d @1522384894 simplify-object-usage touch -d @1522385470 show-more-binary-mount-options -touch -d @1522385535 status touch -d @1522385613 omit-init_itable-in-procfs-when-disabled -touch -d @1522385633 series -touch -d @1522385801 timestamps +touch -d @1522385770 dont-show-jbd-data-option-if-defaulted +touch -d @1522385873 series +touch -d @1522385951 status +touch -d @1522386087 timestamps -- 2.11.4.GIT