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
......@@ -1201,11 +1201,15 @@ int function2code (hashf_t func)
if (func == r5_hash)
return R5_HASH;
BUG() ; // should never happen
BUG() ; // should never happen
return 0;
}
#define SPRINTK(silent, ...) \
if (!(silent)) \
printk(__VA_ARGS__)
static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
{
struct inode *root_inode;
......@@ -1242,53 +1246,53 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
}
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;
}
/* try old format (undistributed bitmap, super block in 8-th 1k block of a device) */
if (!read_super_block (s, REISERFS_OLD_DISK_OFFSET_IN_BYTES))
if (!read_super_block (s, REISERFS_OLD_DISK_OFFSET_IN_BYTES))
old_format = 1;
/* try new format (64-th 1k block), which can contain reiserfs super block */
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));
goto error;
SPRINTK(silent, "sh-2021: reiserfs_fill_super: can not find reiserfs on %s\n", reiserfs_bdevname (s));
goto error;
}
rs = SB_DISK_SUPER_BLOCK (s);
/* 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,
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) ) {
printk("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");
printk("Or may be you forgot to reboot after fdisk when it told you to\n");
if ( s->s_bdev && s->s_bdev->bd_inode && i_size_read(s->s_bdev->bd_inode) < sb_block_count(rs)*sb_blocksize(rs)) {
SPRINTK(silent, "Filesystem on %s cannot be mounted because it is bigger than the device\n", reiserfs_bdevname(s));
SPRINTK(silent, "You may need to run fsck or increase size of your LVM partition\n");
SPRINTK(silent, "Or may be you forgot to reboot after fdisk when it told you to\n");
goto error;
}
sbi->s_mount_state = SB_REISERFS_STATE(s);
sbi->s_mount_state = REISERFS_VALID_FS ;
if (old_format ? read_old_bitmaps(s) : read_bitmaps(s)) {
printk ("jmacd-8: reiserfs_fill_super: unable to read bitmap\n");
if (old_format ? read_old_bitmaps(s) : read_bitmaps(s)) {
SPRINTK(silent, "jmacd-8: reiserfs_fill_super: unable to read bitmap\n");
goto error;
}
#ifdef CONFIG_REISERFS_CHECK
printk("reiserfs:warning: CONFIG_REISERFS_CHECK is set ON\n");
printk("reiserfs:warning: - it is slow mode for debugging.\n");
SPRINTK(silent, "reiserfs:warning: CONFIG_REISERFS_CHECK is set ON\n");
SPRINTK(silent, "reiserfs:warning: - it is slow mode for debugging.\n");
#endif
// set_device_ro(s->s_dev, 1) ;
if( journal_init(s, jdev_name, old_format) ) {
printk("sh-2022: reiserfs_fill_super: unable to initialize journal space\n") ;
if(journal_init(s, jdev_name, old_format)) {
SPRINTK(silent, "sh-2022: reiserfs_fill_super: unable to initialize journal space\n") ;
goto error ;
} else {
jinit_done = 1 ; /* once this is set, journal_release must be called
** if we error out of the mount
** if we error out of the mount
*/
}
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 ;
}
......@@ -1296,14 +1300,14 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
goto error;
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 ;
}
args.objectid = REISERFS_ROOT_OBJECTID ;
args.dirid = REISERFS_ROOT_PARENT_OBJECTID ;
root_inode = iget5_locked (s, REISERFS_ROOT_OBJECTID, reiserfs_find_actor, reiserfs_init_locked_inode, (void *)(&args));
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;
}
......@@ -1341,22 +1345,23 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
if (old_format_only(s)) {
/* filesystem of format 3.5 either with standard or non-standard
journal */
journal */
if (convert_reiserfs (s)) {
/* and -o conv is given */
reiserfs_warning ("reiserfs: converting 3.5 filesystem to the 3.6 format\n") ;
/* and -o conv is given */
if(!silent)
reiserfs_warning ("reiserfs: converting 3.5 filesystem to the 3.6 format\n") ;
if (is_reiserfs_3_5 (rs))
/* put magic string of 3.6 format. 2.2 will not be able to
mount this filesystem anymore */
memcpy (rs->s_v1.s_magic, reiserfs_3_6_magic_string,
memcpy (rs->s_v1.s_magic, reiserfs_3_6_magic_string,
sizeof (reiserfs_3_6_magic_string));
set_sb_version(rs,REISERFS_VERSION_2);
reiserfs_convert_objectid_map_v1(s) ;
set_bit(REISERFS_3_6, &(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") ;
}
}
......@@ -1369,7 +1374,7 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
s->s_dirt = 0;
} else {
if ( old_format_only(s) ) {
if ( old_format_only(s) && !silent) {
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