@@ -81,6 +81,33 @@ void ext2_error(struct super_block *sb, const char *function,
81
81
}
82
82
}
83
83
84
+ static void ext2_msg_fc (struct fs_context * fc , const char * prefix ,
85
+ const char * fmt , ...)
86
+ {
87
+ struct va_format vaf ;
88
+ va_list args ;
89
+ const char * s_id ;
90
+
91
+ if (fc -> purpose == FS_CONTEXT_FOR_RECONFIGURE ) {
92
+ s_id = fc -> root -> d_sb -> s_id ;
93
+ } else {
94
+ /* get last path component of source */
95
+ s_id = strrchr (fc -> source , '/' );
96
+ if (s_id )
97
+ s_id ++ ;
98
+ else
99
+ s_id = fc -> source ;
100
+ }
101
+ va_start (args , fmt );
102
+
103
+ vaf .fmt = fmt ;
104
+ vaf .va = & args ;
105
+
106
+ printk ("%sEXT2-fs (%s): %pV\n" , prefix , s_id , & vaf );
107
+
108
+ va_end (args );
109
+ }
110
+
84
111
void ext2_msg (struct super_block * sb , const char * prefix ,
85
112
const char * fmt , ...)
86
113
{
@@ -92,10 +119,7 @@ void ext2_msg(struct super_block *sb, const char *prefix,
92
119
vaf .fmt = fmt ;
93
120
vaf .va = & args ;
94
121
95
- if (sb )
96
- printk ("%sEXT2-fs (%s): %pV\n" , prefix , sb -> s_id , & vaf );
97
- else
98
- printk ("%sEXT2-fs: %pV\n" , prefix , & vaf );
122
+ printk ("%sEXT2-fs (%s): %pV\n" , prefix , sb -> s_id , & vaf );
99
123
100
124
va_end (args );
101
125
}
@@ -544,7 +568,7 @@ static int ext2_parse_param(struct fs_context *fc, struct fs_parameter *param)
544
568
ctx_clear_mount_opt (ctx , EXT2_MOUNT_OLDALLOC );
545
569
break ;
546
570
case Opt_nobh :
547
- ext2_msg ( NULL , KERN_INFO , "nobh option not supported\n" );
571
+ ext2_msg_fc ( fc , KERN_INFO , "nobh option not supported\n" );
548
572
break ;
549
573
#ifdef CONFIG_EXT2_FS_XATTR
550
574
case Opt_user_xattr :
@@ -555,7 +579,7 @@ static int ext2_parse_param(struct fs_context *fc, struct fs_parameter *param)
555
579
break ;
556
580
#else
557
581
case Opt_user_xattr :
558
- ext2_msg ( NULL , KERN_INFO , "(no)user_xattr options not supported" );
582
+ ext2_msg_fc ( fc , KERN_INFO , "(no)user_xattr options not supported" );
559
583
break ;
560
584
#endif
561
585
#ifdef CONFIG_EXT2_FS_POSIX_ACL
@@ -567,20 +591,20 @@ static int ext2_parse_param(struct fs_context *fc, struct fs_parameter *param)
567
591
break ;
568
592
#else
569
593
case Opt_acl :
570
- ext2_msg ( NULL , KERN_INFO , "(no)acl options not supported" );
594
+ ext2_msg_fc ( fc , KERN_INFO , "(no)acl options not supported" );
571
595
break ;
572
596
#endif
573
597
case Opt_xip :
574
- ext2_msg ( NULL , KERN_INFO , "use dax instead of xip" );
598
+ ext2_msg_fc ( fc , KERN_INFO , "use dax instead of xip" );
575
599
ctx_set_mount_opt (ctx , EXT2_MOUNT_XIP );
576
600
fallthrough ;
577
601
case Opt_dax :
578
602
#ifdef CONFIG_FS_DAX
579
- ext2_msg ( NULL , KERN_WARNING ,
603
+ ext2_msg_fc ( fc , KERN_WARNING ,
580
604
"DAX enabled. Warning: EXPERIMENTAL, use at your own risk" );
581
605
ctx_set_mount_opt (ctx , EXT2_MOUNT_DAX );
582
606
#else
583
- ext2_msg ( NULL , KERN_INFO , "dax option not supported" );
607
+ ext2_msg_fc ( fc , KERN_INFO , "dax option not supported" );
584
608
#endif
585
609
break ;
586
610
@@ -597,16 +621,16 @@ static int ext2_parse_param(struct fs_context *fc, struct fs_parameter *param)
597
621
case Opt_quota :
598
622
case Opt_usrquota :
599
623
case Opt_grpquota :
600
- ext2_msg ( NULL , KERN_INFO , "quota operations not supported" );
624
+ ext2_msg_fc ( fc , KERN_INFO , "quota operations not supported" );
601
625
break ;
602
626
#endif
603
627
case Opt_reservation :
604
628
if (!result .negated ) {
605
629
ctx_set_mount_opt (ctx , EXT2_MOUNT_RESERVATION );
606
- ext2_msg ( NULL , KERN_INFO , "reservations ON" );
630
+ ext2_msg_fc ( fc , KERN_INFO , "reservations ON" );
607
631
} else {
608
632
ctx_clear_mount_opt (ctx , EXT2_MOUNT_RESERVATION );
609
- ext2_msg ( NULL , KERN_INFO , "reservations OFF" );
633
+ ext2_msg_fc ( fc , KERN_INFO , "reservations OFF" );
610
634
}
611
635
break ;
612
636
case Opt_ignore :
0 commit comments