Skip to content

Commit 9c3ce9e

Browse files
Matthew Wilcoxtorvalds
authored andcommitted
ext2: get rid of most mentions of XIP in ext2
To help people transition, accept the 'xip' mount option (and report it in /proc/mounts), but print a message encouraging people to switch over to the 'dax' option. Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.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: 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>
1 parent 97443aa commit 9c3ce9e

6 files changed

Lines changed: 34 additions & 25 deletions

File tree

‎Documentation/filesystems/ext2.txt‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ minixdf Makes `df' act like Minix.
2020
check=none, nocheck (*) Don't do extra checking of bitmaps on mount
2121
(check=normal and check=strict options removed)
2222

23+
dax Use direct access (no page cache). See
24+
Documentation/filesystems/dax.txt.
25+
2326
debug Extra debugging information is sent to the
2427
kernel syslog. Useful for developers.
2528

@@ -56,8 +59,6 @@ noacl Don't support POSIX ACLs.
5659

5760
nobh Do not attach buffer_heads to file pagecache.
5861

59-
xip Use execute in place (no caching) if possible
60-
6162
grpquota,noquota,quota,usrquota Quota options are silently ignored by ext2.
6263

6364

‎fs/ext2/ext2.h‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -380,14 +380,15 @@ struct ext2_inode {
380380
#define EXT2_MOUNT_NO_UID32 0x000200 /* Disable 32-bit UIDs */
381381
#define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */
382382
#define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */
383-
#ifdef CONFIG_FS_DAX
384-
#define EXT2_MOUNT_XIP 0x010000 /* Execute in place */
385-
#else
386-
#define EXT2_MOUNT_XIP 0
387-
#endif
383+
#define EXT2_MOUNT_XIP 0x010000 /* Obsolete, use DAX */
388384
#define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */
389385
#define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */
390386
#define EXT2_MOUNT_RESERVATION 0x080000 /* Preallocation */
387+
#ifdef CONFIG_FS_DAX
388+
#define EXT2_MOUNT_DAX 0x100000 /* Direct Access */
389+
#else
390+
#define EXT2_MOUNT_DAX 0
391+
#endif
391392

392393

393394
#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
@@ -792,7 +793,7 @@ extern int ext2_fsync(struct file *file, loff_t start, loff_t end,
792793
int datasync);
793794
extern const struct inode_operations ext2_file_inode_operations;
794795
extern const struct file_operations ext2_file_operations;
795-
extern const struct file_operations ext2_xip_file_operations;
796+
extern const struct file_operations ext2_dax_file_operations;
796797

797798
/* inode.c */
798799
extern const struct address_space_operations ext2_aops;

‎fs/ext2/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const struct file_operations ext2_file_operations = {
109109
};
110110

111111
#ifdef CONFIG_FS_DAX
112-
const struct file_operations ext2_xip_file_operations = {
112+
const struct file_operations ext2_dax_file_operations = {
113113
.llseek = generic_file_llseek,
114114
.read = new_sync_read,
115115
.write = new_sync_write,

‎fs/ext2/inode.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,7 @@ void ext2_set_inode_flags(struct inode *inode)
12861286
inode->i_flags |= S_NOATIME;
12871287
if (flags & EXT2_DIRSYNC_FL)
12881288
inode->i_flags |= S_DIRSYNC;
1289-
if (test_opt(inode->i_sb, XIP))
1289+
if (test_opt(inode->i_sb, DAX))
12901290
inode->i_flags |= S_DAX;
12911291
}
12921292

@@ -1388,9 +1388,9 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
13881388

13891389
if (S_ISREG(inode->i_mode)) {
13901390
inode->i_op = &ext2_file_inode_operations;
1391-
if (test_opt(inode->i_sb, XIP)) {
1391+
if (test_opt(inode->i_sb, DAX)) {
13921392
inode->i_mapping->a_ops = &ext2_aops;
1393-
inode->i_fop = &ext2_xip_file_operations;
1393+
inode->i_fop = &ext2_dax_file_operations;
13941394
} else if (test_opt(inode->i_sb, NOBH)) {
13951395
inode->i_mapping->a_ops = &ext2_nobh_aops;
13961396
inode->i_fop = &ext2_file_operations;

‎fs/ext2/namei.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ static int ext2_create (struct inode * dir, struct dentry * dentry, umode_t mode
104104
return PTR_ERR(inode);
105105

106106
inode->i_op = &ext2_file_inode_operations;
107-
if (test_opt(inode->i_sb, XIP)) {
107+
if (test_opt(inode->i_sb, DAX)) {
108108
inode->i_mapping->a_ops = &ext2_aops;
109-
inode->i_fop = &ext2_xip_file_operations;
109+
inode->i_fop = &ext2_dax_file_operations;
110110
} else if (test_opt(inode->i_sb, NOBH)) {
111111
inode->i_mapping->a_ops = &ext2_nobh_aops;
112112
inode->i_fop = &ext2_file_operations;
@@ -125,9 +125,9 @@ static int ext2_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
125125
return PTR_ERR(inode);
126126

127127
inode->i_op = &ext2_file_inode_operations;
128-
if (test_opt(inode->i_sb, XIP)) {
128+
if (test_opt(inode->i_sb, DAX)) {
129129
inode->i_mapping->a_ops = &ext2_aops;
130-
inode->i_fop = &ext2_xip_file_operations;
130+
inode->i_fop = &ext2_dax_file_operations;
131131
} else if (test_opt(inode->i_sb, NOBH)) {
132132
inode->i_mapping->a_ops = &ext2_nobh_aops;
133133
inode->i_fop = &ext2_file_operations;

‎fs/ext2/super.c‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ static int ext2_show_options(struct seq_file *seq, struct dentry *root)
294294
#ifdef CONFIG_FS_DAX
295295
if (sbi->s_mount_opt & EXT2_MOUNT_XIP)
296296
seq_puts(seq, ",xip");
297+
if (sbi->s_mount_opt & EXT2_MOUNT_DAX)
298+
seq_puts(seq, ",dax");
297299
#endif
298300

299301
if (!test_opt(sb, RESERVATION))
@@ -402,7 +404,7 @@ enum {
402404
Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic,
403405
Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug,
404406
Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr,
405-
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,
406408
Opt_usrquota, Opt_grpquota, Opt_reservation, Opt_noreservation
407409
};
408410

@@ -431,6 +433,7 @@ static const match_table_t tokens = {
431433
{Opt_acl, "acl"},
432434
{Opt_noacl, "noacl"},
433435
{Opt_xip, "xip"},
436+
{Opt_dax, "dax"},
434437
{Opt_grpquota, "grpquota"},
435438
{Opt_ignore, "noquota"},
436439
{Opt_quota, "quota"},
@@ -558,10 +561,14 @@ static int parse_options(char *options, struct super_block *sb)
558561
break;
559562
#endif
560563
case Opt_xip:
564+
ext2_msg(sb, KERN_INFO, "use dax instead of xip");
565+
set_opt(sbi->s_mount_opt, XIP);
566+
/* Fall through */
567+
case Opt_dax:
561568
#ifdef CONFIG_FS_DAX
562-
set_opt (sbi->s_mount_opt, XIP);
569+
set_opt(sbi->s_mount_opt, DAX);
563570
#else
564-
ext2_msg(sb, KERN_INFO, "xip option not supported");
571+
ext2_msg(sb, KERN_INFO, "dax option not supported");
565572
#endif
566573
break;
567574

@@ -905,15 +912,15 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
905912

906913
blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);
907914

908-
if (sbi->s_mount_opt & EXT2_MOUNT_XIP) {
915+
if (sbi->s_mount_opt & EXT2_MOUNT_DAX) {
909916
if (blocksize != PAGE_SIZE) {
910917
ext2_msg(sb, KERN_ERR,
911-
"error: unsupported blocksize for xip");
918+
"error: unsupported blocksize for dax");
912919
goto failed_mount;
913920
}
914921
if (!sb->s_bdev->bd_disk->fops->direct_access) {
915922
ext2_msg(sb, KERN_ERR,
916-
"error: device does not support xip");
923+
"error: device does not support dax");
917924
goto failed_mount;
918925
}
919926
}
@@ -1286,10 +1293,10 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
12861293
((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
12871294

12881295
es = sbi->s_es;
1289-
if ((sbi->s_mount_opt ^ old_opts.s_mount_opt) & EXT2_MOUNT_XIP) {
1296+
if ((sbi->s_mount_opt ^ old_opts.s_mount_opt) & EXT2_MOUNT_DAX) {
12901297
ext2_msg(sb, KERN_WARNING, "warning: refusing change of "
1291-
"xip flag with busy inodes while remounting");
1292-
sbi->s_mount_opt ^= EXT2_MOUNT_XIP;
1298+
"dax flag with busy inodes while remounting");
1299+
sbi->s_mount_opt ^= EXT2_MOUNT_DAX;
12931300
}
12941301
if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) {
12951302
spin_unlock(&sbi->s_lock);

0 commit comments

Comments
 (0)