3131#include "ext2.h"
3232#include "xattr.h"
3333#include "acl.h"
34+ #include "xip.h"
3435
3536static void ext2_sync_super (struct super_block * sb ,
3637 struct ext2_super_block * es );
@@ -257,7 +258,7 @@ enum {
257258 Opt_bsd_df , Opt_minix_df , Opt_grpid , Opt_nogrpid ,
258259 Opt_resgid , Opt_resuid , Opt_sb , Opt_err_cont , Opt_err_panic , Opt_err_ro ,
259260 Opt_nouid32 , Opt_check , Opt_nocheck , Opt_debug , Opt_oldalloc , Opt_orlov , Opt_nobh ,
260- Opt_user_xattr , Opt_nouser_xattr , Opt_acl , Opt_noacl ,
261+ Opt_user_xattr , Opt_nouser_xattr , Opt_acl , Opt_noacl , Opt_xip ,
261262 Opt_ignore , Opt_err ,
262263};
263264
@@ -286,6 +287,7 @@ static match_table_t tokens = {
286287 {Opt_nouser_xattr , "nouser_xattr" },
287288 {Opt_acl , "acl" },
288289 {Opt_noacl , "noacl" },
290+ {Opt_xip , "xip" },
289291 {Opt_ignore , "grpquota" },
290292 {Opt_ignore , "noquota" },
291293 {Opt_ignore , "quota" },
@@ -397,6 +399,13 @@ static int parse_options (char * options,
397399 printk ("EXT2 (no)acl options not supported\n" );
398400 break ;
399401#endif
402+ case Opt_xip :
403+ #ifdef CONFIG_EXT2_FS_XIP
404+ set_opt (sbi -> s_mount_opt , XIP );
405+ #else
406+ printk ("EXT2 xip option not supported\n" );
407+ #endif
408+ break ;
400409 case Opt_ignore :
401410 break ;
402411 default :
@@ -640,6 +649,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
640649 ((EXT2_SB (sb )-> s_mount_opt & EXT2_MOUNT_POSIX_ACL ) ?
641650 MS_POSIXACL : 0 );
642651
652+ ext2_xip_verify_sb (sb ); /* see if bdev supports xip, unset
653+ EXT2_MOUNT_XIP if not */
654+
643655 if (le32_to_cpu (es -> s_rev_level ) == EXT2_GOOD_OLD_REV &&
644656 (EXT2_HAS_COMPAT_FEATURE (sb , ~0U ) ||
645657 EXT2_HAS_RO_COMPAT_FEATURE (sb , ~0U ) ||
@@ -668,6 +680,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
668680
669681 blocksize = BLOCK_SIZE << le32_to_cpu (sbi -> s_es -> s_log_block_size );
670682
683+ if ((ext2_use_xip (sb )) && ((blocksize != PAGE_SIZE ) ||
684+ (sb -> s_blocksize != blocksize ))) {
685+ if (!silent )
686+ printk ("XIP: Unsupported blocksize\n" );
687+ goto failed_mount ;
688+ }
689+
671690 /* If the blocksize doesn't match, re-read the thing.. */
672691 if (sb -> s_blocksize != blocksize ) {
673692 brelse (bh );
@@ -916,6 +935,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
916935{
917936 struct ext2_sb_info * sbi = EXT2_SB (sb );
918937 struct ext2_super_block * es ;
938+ unsigned long old_mount_opt = sbi -> s_mount_opt ;
919939
920940 /*
921941 * Allow the "check" option to be passed as a remount option.
@@ -927,6 +947,11 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
927947 ((sbi -> s_mount_opt & EXT2_MOUNT_POSIX_ACL ) ? MS_POSIXACL : 0 );
928948
929949 es = sbi -> s_es ;
950+ if (((sbi -> s_mount_opt & EXT2_MOUNT_XIP ) !=
951+ (old_mount_opt & EXT2_MOUNT_XIP )) &&
952+ invalidate_inodes (sb ))
953+ ext2_warning (sb , __FUNCTION__ , "busy inodes while remounting " \
954+ "xip remain in cache (no functional problem)" );
930955 if ((* flags & MS_RDONLY ) == (sb -> s_flags & MS_RDONLY ))
931956 return 0 ;
932957 if (* flags & MS_RDONLY ) {
0 commit comments