diff options
author | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2015-02-16 18:59:15 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-16 20:56:03 -0500 |
commit | 0de4830fd49f60d04ba37e8b32f95100f3953c39 (patch) | |
tree | a37fba1094d21dd0474cd8ab4edffa7c687b4f69 /fs/ext2 | |
parent | e748dcd095ddee50e7a7deda2e26247715318a2e (diff) |
ext2: remove ext2_xip_verify_sb()
Jan Kara pointed out that calling ext2_xip_verify_sb() in ext2_remount()
doesn't make sense, since changing the XIP option on remount isn't
allowed. It also doesn't make sense to re-check whether blocksize is
supported since it can't change between mounts.
Replace the call to ext2_xip_verify_sb() in ext2_fill_super() with the
equivalent check and delete the definition.
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: Boaz Harrosh <boaz@plexistor.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ext2')
-rw-r--r-- | fs/ext2/super.c | 33 | ||||
-rw-r--r-- | fs/ext2/xip.c | 12 | ||||
-rw-r--r-- | fs/ext2/xip.h | 2 |
3 files changed, 12 insertions, 35 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index ae55fddc26a9..83c5d51b8ede 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -877,9 +877,6 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
877 | ((EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? | 877 | ((EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? |
878 | MS_POSIXACL : 0); | 878 | MS_POSIXACL : 0); |
879 | 879 | ||
880 | ext2_xip_verify_sb(sb); /* see if bdev supports xip, unset | ||
881 | EXT2_MOUNT_XIP if not */ | ||
882 | |||
883 | if (le32_to_cpu(es->s_rev_level) == EXT2_GOOD_OLD_REV && | 880 | if (le32_to_cpu(es->s_rev_level) == EXT2_GOOD_OLD_REV && |
884 | (EXT2_HAS_COMPAT_FEATURE(sb, ~0U) || | 881 | (EXT2_HAS_COMPAT_FEATURE(sb, ~0U) || |
885 | EXT2_HAS_RO_COMPAT_FEATURE(sb, ~0U) || | 882 | EXT2_HAS_RO_COMPAT_FEATURE(sb, ~0U) || |
@@ -909,11 +906,17 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
909 | 906 | ||
910 | blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); | 907 | blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); |
911 | 908 | ||
912 | if (ext2_use_xip(sb) && blocksize != PAGE_SIZE) { | 909 | if (sbi->s_mount_opt & EXT2_MOUNT_XIP) { |
913 | if (!silent) | 910 | if (blocksize != PAGE_SIZE) { |
914 | ext2_msg(sb, KERN_ERR, | 911 | ext2_msg(sb, KERN_ERR, |
915 | "error: unsupported blocksize for xip"); | 912 | "error: unsupported blocksize for xip"); |
916 | goto failed_mount; | 913 | goto failed_mount; |
914 | } | ||
915 | if (!sb->s_bdev->bd_disk->fops->direct_access) { | ||
916 | ext2_msg(sb, KERN_ERR, | ||
917 | "error: device does not support xip"); | ||
918 | goto failed_mount; | ||
919 | } | ||
917 | } | 920 | } |
918 | 921 | ||
919 | /* If the blocksize doesn't match, re-read the thing.. */ | 922 | /* If the blocksize doesn't match, re-read the thing.. */ |
@@ -1259,7 +1262,6 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) | |||
1259 | { | 1262 | { |
1260 | struct ext2_sb_info * sbi = EXT2_SB(sb); | 1263 | struct ext2_sb_info * sbi = EXT2_SB(sb); |
1261 | struct ext2_super_block * es; | 1264 | struct ext2_super_block * es; |
1262 | unsigned long old_mount_opt = sbi->s_mount_opt; | ||
1263 | struct ext2_mount_options old_opts; | 1265 | struct ext2_mount_options old_opts; |
1264 | unsigned long old_sb_flags; | 1266 | unsigned long old_sb_flags; |
1265 | int err; | 1267 | int err; |
@@ -1284,22 +1286,11 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) | |||
1284 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | | 1286 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | |
1285 | ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); | 1287 | ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); |
1286 | 1288 | ||
1287 | ext2_xip_verify_sb(sb); /* see if bdev supports xip, unset | ||
1288 | EXT2_MOUNT_XIP if not */ | ||
1289 | |||
1290 | if ((ext2_use_xip(sb)) && (sb->s_blocksize != PAGE_SIZE)) { | ||
1291 | ext2_msg(sb, KERN_WARNING, | ||
1292 | "warning: unsupported blocksize for xip"); | ||
1293 | err = -EINVAL; | ||
1294 | goto restore_opts; | ||
1295 | } | ||
1296 | |||
1297 | es = sbi->s_es; | 1289 | es = sbi->s_es; |
1298 | if ((sbi->s_mount_opt ^ old_mount_opt) & EXT2_MOUNT_XIP) { | 1290 | if ((sbi->s_mount_opt ^ old_opts.s_mount_opt) & EXT2_MOUNT_XIP) { |
1299 | ext2_msg(sb, KERN_WARNING, "warning: refusing change of " | 1291 | ext2_msg(sb, KERN_WARNING, "warning: refusing change of " |
1300 | "xip flag with busy inodes while remounting"); | 1292 | "xip flag with busy inodes while remounting"); |
1301 | sbi->s_mount_opt &= ~EXT2_MOUNT_XIP; | 1293 | sbi->s_mount_opt ^= EXT2_MOUNT_XIP; |
1302 | sbi->s_mount_opt |= old_mount_opt & EXT2_MOUNT_XIP; | ||
1303 | } | 1294 | } |
1304 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { | 1295 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { |
1305 | spin_unlock(&sbi->s_lock); | 1296 | spin_unlock(&sbi->s_lock); |
diff --git a/fs/ext2/xip.c b/fs/ext2/xip.c index 132d4daf98c4..66ca1133827e 100644 --- a/fs/ext2/xip.c +++ b/fs/ext2/xip.c | |||
@@ -13,15 +13,3 @@ | |||
13 | #include "ext2.h" | 13 | #include "ext2.h" |
14 | #include "xip.h" | 14 | #include "xip.h" |
15 | 15 | ||
16 | void ext2_xip_verify_sb(struct super_block *sb) | ||
17 | { | ||
18 | struct ext2_sb_info *sbi = EXT2_SB(sb); | ||
19 | |||
20 | if ((sbi->s_mount_opt & EXT2_MOUNT_XIP) && | ||
21 | !sb->s_bdev->bd_disk->fops->direct_access) { | ||
22 | sbi->s_mount_opt &= (~EXT2_MOUNT_XIP); | ||
23 | ext2_msg(sb, KERN_WARNING, | ||
24 | "warning: ignoring xip option - " | ||
25 | "not supported by bdev"); | ||
26 | } | ||
27 | } | ||
diff --git a/fs/ext2/xip.h b/fs/ext2/xip.h index e7b9f0a2cc54..87eeb0460e8c 100644 --- a/fs/ext2/xip.h +++ b/fs/ext2/xip.h | |||
@@ -6,13 +6,11 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #ifdef CONFIG_EXT2_FS_XIP | 8 | #ifdef CONFIG_EXT2_FS_XIP |
9 | extern void ext2_xip_verify_sb (struct super_block *); | ||
10 | static inline int ext2_use_xip (struct super_block *sb) | 9 | static inline int ext2_use_xip (struct super_block *sb) |
11 | { | 10 | { |
12 | struct ext2_sb_info *sbi = EXT2_SB(sb); | 11 | struct ext2_sb_info *sbi = EXT2_SB(sb); |
13 | return (sbi->s_mount_opt & EXT2_MOUNT_XIP); | 12 | return (sbi->s_mount_opt & EXT2_MOUNT_XIP); |
14 | } | 13 | } |
15 | #else | 14 | #else |
16 | #define ext2_xip_verify_sb(sb) do { } while (0) | ||
17 | #define ext2_use_xip(sb) 0 | 15 | #define ext2_use_xip(sb) 0 |
18 | #endif | 16 | #endif |