@@ -424,26 +424,23 @@ static const struct fs_parameter_spec erofs_fs_parameters[] = {
424424
425425static bool erofs_fc_set_dax_mode (struct fs_context * fc , unsigned int mode )
426426{
427- #ifdef CONFIG_FS_DAX
428- struct erofs_sb_info * sbi = fc -> s_fs_info ;
429-
430- switch (mode ) {
431- case EROFS_MOUNT_DAX_ALWAYS :
432- set_opt (& sbi -> opt , DAX_ALWAYS );
433- clear_opt (& sbi -> opt , DAX_NEVER );
434- return true;
435- case EROFS_MOUNT_DAX_NEVER :
436- set_opt (& sbi -> opt , DAX_NEVER );
437- clear_opt (& sbi -> opt , DAX_ALWAYS );
438- return true;
439- default :
427+ if (IS_ENABLED (CONFIG_FS_DAX )) {
428+ struct erofs_sb_info * sbi = fc -> s_fs_info ;
429+
430+ if (mode == EROFS_MOUNT_DAX_ALWAYS ) {
431+ set_opt (& sbi -> opt , DAX_ALWAYS );
432+ clear_opt (& sbi -> opt , DAX_NEVER );
433+ return true;
434+ } else if (mode == EROFS_MOUNT_DAX_NEVER ) {
435+ set_opt (& sbi -> opt , DAX_NEVER );
436+ clear_opt (& sbi -> opt , DAX_ALWAYS );
437+ return true;
438+ }
440439 DBG_BUGON (1 );
441440 return false;
442441 }
443- #else
444442 errorfc (fc , "dax options not supported" );
445443 return false;
446- #endif
447444}
448445
449446static int erofs_fc_parse_param (struct fs_context * fc ,
@@ -460,31 +457,26 @@ static int erofs_fc_parse_param(struct fs_context *fc,
460457
461458 switch (opt ) {
462459 case Opt_user_xattr :
463- #ifdef CONFIG_EROFS_FS_XATTR
464- if (result .boolean )
460+ if (!IS_ENABLED (CONFIG_EROFS_FS_XATTR ))
461+ errorfc (fc , "{,no}user_xattr options not supported" );
462+ else if (result .boolean )
465463 set_opt (& sbi -> opt , XATTR_USER );
466464 else
467465 clear_opt (& sbi -> opt , XATTR_USER );
468- #else
469- errorfc (fc , "{,no}user_xattr options not supported" );
470- #endif
471466 break ;
472467 case Opt_acl :
473- #ifdef CONFIG_EROFS_FS_POSIX_ACL
474- if (result .boolean )
468+ if (!IS_ENABLED (CONFIG_EROFS_FS_POSIX_ACL ))
469+ errorfc (fc , "{,no}acl options not supported" );
470+ else if (result .boolean )
475471 set_opt (& sbi -> opt , POSIX_ACL );
476472 else
477473 clear_opt (& sbi -> opt , POSIX_ACL );
478- #else
479- errorfc (fc , "{,no}acl options not supported" );
480- #endif
481474 break ;
482475 case Opt_cache_strategy :
483- #ifdef CONFIG_EROFS_FS_ZIP
484- sbi -> opt .cache_strategy = result .uint_32 ;
485- #else
486- errorfc (fc , "compression not supported, cache_strategy ignored" );
487- #endif
476+ if (!IS_ENABLED (CONFIG_EROFS_FS_ZIP ))
477+ errorfc (fc , "compression not supported, cache_strategy ignored" );
478+ else
479+ sbi -> opt .cache_strategy = result .uint_32 ;
488480 break ;
489481 case Opt_dax :
490482 if (!erofs_fc_set_dax_mode (fc , EROFS_MOUNT_DAX_ALWAYS ))
@@ -533,24 +525,21 @@ static int erofs_fc_parse_param(struct fs_context *fc,
533525 break ;
534526#endif
535527 case Opt_directio :
536- #ifdef CONFIG_EROFS_FS_BACKED_BY_FILE
537- if (result .boolean )
528+ if (!IS_ENABLED (CONFIG_EROFS_FS_BACKED_BY_FILE ))
529+ errorfc (fc , "%s option not supported" , erofs_fs_parameters [opt ].name );
530+ else if (result .boolean )
538531 set_opt (& sbi -> opt , DIRECT_IO );
539532 else
540533 clear_opt (& sbi -> opt , DIRECT_IO );
541- #else
542- errorfc (fc , "%s option not supported" , erofs_fs_parameters [opt ].name );
543- #endif
544534 break ;
545535 case Opt_fsoffset :
546536 sbi -> dif0 .fsoff = result .uint_64 ;
547537 break ;
548538 case Opt_inode_share :
549- #ifdef CONFIG_EROFS_FS_PAGE_CACHE_SHARE
550- set_opt (& sbi -> opt , INODE_SHARE );
551- #else
552- errorfc (fc , "%s option not supported" , erofs_fs_parameters [opt ].name );
553- #endif
539+ if (!IS_ENABLED (CONFIG_EROFS_FS_PAGE_CACHE_SHARE ))
540+ errorfc (fc , "%s option not supported" , erofs_fs_parameters [opt ].name );
541+ else
542+ set_opt (& sbi -> opt , INODE_SHARE );
554543 break ;
555544 }
556545 return 0 ;
@@ -809,8 +798,7 @@ static int erofs_fc_get_tree(struct fs_context *fc)
809798 ret = get_tree_bdev_flags (fc , erofs_fc_fill_super ,
810799 IS_ENABLED (CONFIG_EROFS_FS_BACKED_BY_FILE ) ?
811800 GET_TREE_BDEV_QUIET_LOOKUP : 0 );
812- #ifdef CONFIG_EROFS_FS_BACKED_BY_FILE
813- if (ret == - ENOTBLK ) {
801+ if (IS_ENABLED (CONFIG_EROFS_FS_BACKED_BY_FILE ) && ret == - ENOTBLK ) {
814802 struct file * file ;
815803
816804 if (!fc -> source )
@@ -824,7 +812,6 @@ static int erofs_fc_get_tree(struct fs_context *fc)
824812 sbi -> dif0 .file -> f_mapping -> a_ops -> read_folio )
825813 return get_tree_nodev (fc , erofs_fc_fill_super );
826814 }
827- #endif
828815 return ret ;
829816}
830817
@@ -1108,12 +1095,12 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root)
11081095 seq_puts (seq , ",dax=never" );
11091096 if (erofs_is_fileio_mode (sbi ) && test_opt (opt , DIRECT_IO ))
11101097 seq_puts (seq , ",directio" );
1111- #ifdef CONFIG_EROFS_FS_ONDEMAND
1112- if (sbi -> fsid )
1113- seq_printf (seq , ",fsid=%s" , sbi -> fsid );
1114- if (sbi -> domain_id )
1115- seq_printf (seq , ",domain_id=%s" , sbi -> domain_id );
1116- #endif
1098+ if ( IS_ENABLED ( CONFIG_EROFS_FS_ONDEMAND )) {
1099+ if (sbi -> fsid )
1100+ seq_printf (seq , ",fsid=%s" , sbi -> fsid );
1101+ if (sbi -> domain_id )
1102+ seq_printf (seq , ",domain_id=%s" , sbi -> domain_id );
1103+ }
11171104 if (sbi -> dif0 .fsoff )
11181105 seq_printf (seq , ",fsoffset=%llu" , sbi -> dif0 .fsoff );
11191106 if (test_opt (opt , INODE_SHARE ))
0 commit comments