Commit f37b1ef8 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix reiserfs handling of `silent' option.

From: Nikita Danilov <Nikita@Namesys.COM>

Patch to teach fs/reiserfs/super.c:reiserfs_fill_super() to respect @silent
parameter and to not issue any output if @silent is set.

Also remove some trailing white spaces, while we are here.
parent 0eeebbed
...@@ -1206,6 +1206,10 @@ int function2code (hashf_t func) ...@@ -1206,6 +1206,10 @@ int function2code (hashf_t func)
return 0; return 0;
} }
#define SPRINTK(silent, ...) \
if (!(silent)) \
printk(__VA_ARGS__)
static int reiserfs_fill_super (struct super_block * s, void * data, int silent) static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
{ {
struct inode *root_inode; struct inode *root_inode;
...@@ -1242,7 +1246,7 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent) ...@@ -1242,7 +1246,7 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
} }
if (blocks) { if (blocks) {
printk("jmacd-7: reiserfs_fill_super: resize option for remount only\n"); SPRINTK(silent, "jmacd-7: reiserfs_fill_super: resize option for remount only\n");
goto error; goto error;
} }
...@@ -1251,7 +1255,7 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent) ...@@ -1251,7 +1255,7 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
old_format = 1; old_format = 1;
/* try new format (64-th 1k block), which can contain reiserfs super block */ /* try new format (64-th 1k block), which can contain reiserfs super block */
else if (read_super_block (s, REISERFS_DISK_OFFSET_IN_BYTES)) { else if (read_super_block (s, REISERFS_DISK_OFFSET_IN_BYTES)) {
printk("sh-2021: reiserfs_fill_super: can not find reiserfs on %s\n", reiserfs_bdevname (s)); SPRINTK(silent, "sh-2021: reiserfs_fill_super: can not find reiserfs on %s\n", reiserfs_bdevname (s));
goto error; goto error;
} }
...@@ -1259,10 +1263,10 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent) ...@@ -1259,10 +1263,10 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
/* Let's do basic sanity check to verify that underlying device is not /* Let's do basic sanity check to verify that underlying device is not
smaller than the filesystem. If the check fails then abort and scream, smaller than the filesystem. If the check fails then abort and scream,
because bad stuff will happen otherwise. */ because bad stuff will happen otherwise. */
if ( s->s_bdev && s->s_bdev->bd_inode && i_size_read(s->s_bdev->bd_inode) < sb_block_count(rs)*sb_blocksize(rs) ) { if ( s->s_bdev && s->s_bdev->bd_inode && i_size_read(s->s_bdev->bd_inode) < sb_block_count(rs)*sb_blocksize(rs)) {
printk("Filesystem on %s cannot be mounted because it is bigger than the device\n", reiserfs_bdevname(s)); SPRINTK(silent, "Filesystem on %s cannot be mounted because it is bigger than the device\n", reiserfs_bdevname(s));
printk("You may need to run fsck or increase size of your LVM partition\n"); SPRINTK(silent, "You may need to run fsck or increase size of your LVM partition\n");
printk("Or may be you forgot to reboot after fdisk when it told you to\n"); SPRINTK(silent, "Or may be you forgot to reboot after fdisk when it told you to\n");
goto error; goto error;
} }
...@@ -1270,17 +1274,17 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent) ...@@ -1270,17 +1274,17 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
sbi->s_mount_state = REISERFS_VALID_FS ; sbi->s_mount_state = REISERFS_VALID_FS ;
if (old_format ? read_old_bitmaps(s) : read_bitmaps(s)) { if (old_format ? read_old_bitmaps(s) : read_bitmaps(s)) {
printk ("jmacd-8: reiserfs_fill_super: unable to read bitmap\n"); SPRINTK(silent, "jmacd-8: reiserfs_fill_super: unable to read bitmap\n");
goto error; goto error;
} }
#ifdef CONFIG_REISERFS_CHECK #ifdef CONFIG_REISERFS_CHECK
printk("reiserfs:warning: CONFIG_REISERFS_CHECK is set ON\n"); SPRINTK(silent, "reiserfs:warning: CONFIG_REISERFS_CHECK is set ON\n");
printk("reiserfs:warning: - it is slow mode for debugging.\n"); SPRINTK(silent, "reiserfs:warning: - it is slow mode for debugging.\n");
#endif #endif
// set_device_ro(s->s_dev, 1) ; // set_device_ro(s->s_dev, 1) ;
if( journal_init(s, jdev_name, old_format) ) { if(journal_init(s, jdev_name, old_format)) {
printk("sh-2022: reiserfs_fill_super: unable to initialize journal space\n") ; SPRINTK(silent, "sh-2022: reiserfs_fill_super: unable to initialize journal space\n") ;
goto error ; goto error ;
} else { } else {
jinit_done = 1 ; /* once this is set, journal_release must be called jinit_done = 1 ; /* once this is set, journal_release must be called
...@@ -1288,7 +1292,7 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent) ...@@ -1288,7 +1292,7 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
*/ */
} }
if (reread_meta_blocks(s)) { if (reread_meta_blocks(s)) {
printk("jmacd-9: reiserfs_fill_super: unable to reread meta blocks after journal init\n") ; SPRINTK(silent, "jmacd-9: reiserfs_fill_super: unable to reread meta blocks after journal init\n") ;
goto error ; goto error ;
} }
...@@ -1296,14 +1300,14 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent) ...@@ -1296,14 +1300,14 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
goto error; goto error;
if (bdev_read_only(s->s_bdev) && !(s->s_flags & MS_RDONLY)) { if (bdev_read_only(s->s_bdev) && !(s->s_flags & MS_RDONLY)) {
printk("clm-7000: Detected readonly device, marking FS readonly\n") ; SPRINTK(silent, "clm-7000: Detected readonly device, marking FS readonly\n") ;
s->s_flags |= MS_RDONLY ; s->s_flags |= MS_RDONLY ;
} }
args.objectid = REISERFS_ROOT_OBJECTID ; args.objectid = REISERFS_ROOT_OBJECTID ;
args.dirid = REISERFS_ROOT_PARENT_OBJECTID ; args.dirid = REISERFS_ROOT_PARENT_OBJECTID ;
root_inode = iget5_locked (s, REISERFS_ROOT_OBJECTID, reiserfs_find_actor, reiserfs_init_locked_inode, (void *)(&args)); root_inode = iget5_locked (s, REISERFS_ROOT_OBJECTID, reiserfs_find_actor, reiserfs_init_locked_inode, (void *)(&args));
if (!root_inode) { if (!root_inode) {
printk ("jmacd-10: reiserfs_fill_super: get root inode failed\n"); SPRINTK(silent, "jmacd-10: reiserfs_fill_super: get root inode failed\n");
goto error; goto error;
} }
...@@ -1344,6 +1348,7 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent) ...@@ -1344,6 +1348,7 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
journal */ journal */
if (convert_reiserfs (s)) { if (convert_reiserfs (s)) {
/* and -o conv is given */ /* and -o conv is given */
if(!silent)
reiserfs_warning ("reiserfs: converting 3.5 filesystem to the 3.6 format\n") ; reiserfs_warning ("reiserfs: converting 3.5 filesystem to the 3.6 format\n") ;
if (is_reiserfs_3_5 (rs)) if (is_reiserfs_3_5 (rs))
...@@ -1356,7 +1361,7 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent) ...@@ -1356,7 +1361,7 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
reiserfs_convert_objectid_map_v1(s) ; reiserfs_convert_objectid_map_v1(s) ;
set_bit(REISERFS_3_6, &(sbi->s_properties)); set_bit(REISERFS_3_6, &(sbi->s_properties));
clear_bit(REISERFS_3_5, &(sbi->s_properties)); clear_bit(REISERFS_3_5, &(sbi->s_properties));
} else { } else if (!silent){
reiserfs_warning("reiserfs: using 3.5.x disk format\n") ; reiserfs_warning("reiserfs: using 3.5.x disk format\n") ;
} }
} }
...@@ -1369,7 +1374,7 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent) ...@@ -1369,7 +1374,7 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
s->s_dirt = 0; s->s_dirt = 0;
} else { } else {
if ( old_format_only(s) ) { if ( old_format_only(s) && !silent) {
reiserfs_warning("reiserfs: using 3.5.x disk format\n") ; reiserfs_warning("reiserfs: using 3.5.x disk format\n") ;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment