diff options
Diffstat (limited to 'fs/ext2/super.c')
| -rw-r--r-- | fs/ext2/super.c | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index ae55fddc26a9..d0e746e96511 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
| @@ -35,7 +35,6 @@ | |||
| 35 | #include "ext2.h" | 35 | #include "ext2.h" |
| 36 | #include "xattr.h" | 36 | #include "xattr.h" |
| 37 | #include "acl.h" | 37 | #include "acl.h" |
| 38 | #include "xip.h" | ||
| 39 | 38 | ||
| 40 | static void ext2_sync_super(struct super_block *sb, | 39 | static void ext2_sync_super(struct super_block *sb, |
| 41 | struct ext2_super_block *es, int wait); | 40 | struct ext2_super_block *es, int wait); |
| @@ -292,9 +291,11 @@ static int ext2_show_options(struct seq_file *seq, struct dentry *root) | |||
| 292 | seq_puts(seq, ",grpquota"); | 291 | seq_puts(seq, ",grpquota"); |
| 293 | #endif | 292 | #endif |
| 294 | 293 | ||
| 295 | #if defined(CONFIG_EXT2_FS_XIP) | 294 | #ifdef CONFIG_FS_DAX |
| 296 | if (sbi->s_mount_opt & EXT2_MOUNT_XIP) | 295 | if (sbi->s_mount_opt & EXT2_MOUNT_XIP) |
| 297 | seq_puts(seq, ",xip"); | 296 | seq_puts(seq, ",xip"); |
| 297 | if (sbi->s_mount_opt & EXT2_MOUNT_DAX) | ||
| 298 | seq_puts(seq, ",dax"); | ||
| 298 | #endif | 299 | #endif |
| 299 | 300 | ||
| 300 | if (!test_opt(sb, RESERVATION)) | 301 | if (!test_opt(sb, RESERVATION)) |
| @@ -403,7 +404,7 @@ enum { | |||
| 403 | Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, | 404 | Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, |
| 404 | Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug, | 405 | Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug, |
| 405 | Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr, | 406 | Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr, |
| 406 | Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota, | 407 | Opt_acl, Opt_noacl, Opt_xip, Opt_dax, Opt_ignore, Opt_err, Opt_quota, |
| 407 | Opt_usrquota, Opt_grpquota, Opt_reservation, Opt_noreservation | 408 | Opt_usrquota, Opt_grpquota, Opt_reservation, Opt_noreservation |
| 408 | }; | 409 | }; |
| 409 | 410 | ||
| @@ -432,6 +433,7 @@ static const match_table_t tokens = { | |||
| 432 | {Opt_acl, "acl"}, | 433 | {Opt_acl, "acl"}, |
| 433 | {Opt_noacl, "noacl"}, | 434 | {Opt_noacl, "noacl"}, |
| 434 | {Opt_xip, "xip"}, | 435 | {Opt_xip, "xip"}, |
| 436 | {Opt_dax, "dax"}, | ||
| 435 | {Opt_grpquota, "grpquota"}, | 437 | {Opt_grpquota, "grpquota"}, |
| 436 | {Opt_ignore, "noquota"}, | 438 | {Opt_ignore, "noquota"}, |
| 437 | {Opt_quota, "quota"}, | 439 | {Opt_quota, "quota"}, |
| @@ -559,10 +561,14 @@ static int parse_options(char *options, struct super_block *sb) | |||
| 559 | break; | 561 | break; |
| 560 | #endif | 562 | #endif |
| 561 | case Opt_xip: | 563 | case Opt_xip: |
| 562 | #ifdef CONFIG_EXT2_FS_XIP | 564 | ext2_msg(sb, KERN_INFO, "use dax instead of xip"); |
| 563 | set_opt (sbi->s_mount_opt, XIP); | 565 | set_opt(sbi->s_mount_opt, XIP); |
| 566 | /* Fall through */ | ||
| 567 | case Opt_dax: | ||
| 568 | #ifdef CONFIG_FS_DAX | ||
| 569 | set_opt(sbi->s_mount_opt, DAX); | ||
| 564 | #else | 570 | #else |
| 565 | ext2_msg(sb, KERN_INFO, "xip option not supported"); | 571 | ext2_msg(sb, KERN_INFO, "dax option not supported"); |
| 566 | #endif | 572 | #endif |
| 567 | break; | 573 | break; |
| 568 | 574 | ||
| @@ -877,9 +883,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) ? | 883 | ((EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? |
| 878 | MS_POSIXACL : 0); | 884 | MS_POSIXACL : 0); |
| 879 | 885 | ||
| 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 && | 886 | if (le32_to_cpu(es->s_rev_level) == EXT2_GOOD_OLD_REV && |
| 884 | (EXT2_HAS_COMPAT_FEATURE(sb, ~0U) || | 887 | (EXT2_HAS_COMPAT_FEATURE(sb, ~0U) || |
| 885 | EXT2_HAS_RO_COMPAT_FEATURE(sb, ~0U) || | 888 | EXT2_HAS_RO_COMPAT_FEATURE(sb, ~0U) || |
| @@ -909,11 +912,17 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
| 909 | 912 | ||
| 910 | blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); | 913 | blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); |
| 911 | 914 | ||
| 912 | if (ext2_use_xip(sb) && blocksize != PAGE_SIZE) { | 915 | if (sbi->s_mount_opt & EXT2_MOUNT_DAX) { |
| 913 | if (!silent) | 916 | if (blocksize != PAGE_SIZE) { |
| 914 | ext2_msg(sb, KERN_ERR, | 917 | ext2_msg(sb, KERN_ERR, |
| 915 | "error: unsupported blocksize for xip"); | 918 | "error: unsupported blocksize for dax"); |
| 916 | goto failed_mount; | 919 | goto failed_mount; |
| 920 | } | ||
| 921 | if (!sb->s_bdev->bd_disk->fops->direct_access) { | ||
| 922 | ext2_msg(sb, KERN_ERR, | ||
| 923 | "error: device does not support dax"); | ||
| 924 | goto failed_mount; | ||
| 925 | } | ||
| 917 | } | 926 | } |
| 918 | 927 | ||
| 919 | /* If the blocksize doesn't match, re-read the thing.. */ | 928 | /* If the blocksize doesn't match, re-read the thing.. */ |
| @@ -1259,7 +1268,6 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) | |||
| 1259 | { | 1268 | { |
| 1260 | struct ext2_sb_info * sbi = EXT2_SB(sb); | 1269 | struct ext2_sb_info * sbi = EXT2_SB(sb); |
| 1261 | struct ext2_super_block * es; | 1270 | struct ext2_super_block * es; |
| 1262 | unsigned long old_mount_opt = sbi->s_mount_opt; | ||
| 1263 | struct ext2_mount_options old_opts; | 1271 | struct ext2_mount_options old_opts; |
| 1264 | unsigned long old_sb_flags; | 1272 | unsigned long old_sb_flags; |
| 1265 | int err; | 1273 | int err; |
| @@ -1284,22 +1292,11 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data) | |||
| 1284 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | | 1292 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | |
| 1285 | ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); | 1293 | ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); |
| 1286 | 1294 | ||
| 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; | 1295 | es = sbi->s_es; |
| 1298 | if ((sbi->s_mount_opt ^ old_mount_opt) & EXT2_MOUNT_XIP) { | 1296 | if ((sbi->s_mount_opt ^ old_opts.s_mount_opt) & EXT2_MOUNT_DAX) { |
| 1299 | ext2_msg(sb, KERN_WARNING, "warning: refusing change of " | 1297 | ext2_msg(sb, KERN_WARNING, "warning: refusing change of " |
| 1300 | "xip flag with busy inodes while remounting"); | 1298 | "dax flag with busy inodes while remounting"); |
| 1301 | sbi->s_mount_opt &= ~EXT2_MOUNT_XIP; | 1299 | sbi->s_mount_opt ^= EXT2_MOUNT_DAX; |
| 1302 | sbi->s_mount_opt |= old_mount_opt & EXT2_MOUNT_XIP; | ||
| 1303 | } | 1300 | } |
| 1304 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { | 1301 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { |
| 1305 | spin_unlock(&sbi->s_lock); | 1302 | spin_unlock(&sbi->s_lock); |
