Commit 715403ff authored by Oleg Drokin's avatar Oleg Drokin

journal.c:

  reiserfs: Fix initialization and cleanup of the external logging (Vladimir Saveliev) , and make sure to call set_blocksize() on the bdev for the external device. (Chris Mason)
parent 33b5a586
...@@ -1925,13 +1925,20 @@ static int release_journal_dev( struct super_block *super, ...@@ -1925,13 +1925,20 @@ static int release_journal_dev( struct super_block *super,
result = 0; result = 0;
if( journal -> j_dev_bd != NULL ) {
result = blkdev_put( journal -> j_dev_bd, BDEV_FS );
journal -> j_dev_bd = NULL;
}
if( journal -> j_dev_file != NULL ) { if( journal -> j_dev_file != NULL ) {
/*
* journal block device was taken via filp_open
*/
result = filp_close( journal -> j_dev_file, NULL ); result = filp_close( journal -> j_dev_file, NULL );
journal -> j_dev_file = NULL; journal -> j_dev_file = NULL;
journal -> j_dev_bd = NULL;
} else if( journal -> j_dev_bd != NULL ) {
/*
* journal block device was taken via bdget and blkdev_get
*/
result = blkdev_put( journal -> j_dev_bd, BDEV_FS );
journal -> j_dev_bd = NULL;
} }
if( result != 0 ) { if( result != 0 ) {
reiserfs_warning("sh-457: release_journal_dev: Cannot release journal device: %i", result ); reiserfs_warning("sh-457: release_journal_dev: Cannot release journal device: %i", result );
...@@ -1966,6 +1973,9 @@ static int journal_init_dev( struct super_block *super, ...@@ -1966,6 +1973,9 @@ static int journal_init_dev( struct super_block *super,
printk( "sh-458: journal_init_dev: cannot init journal device\n '%s': %i", printk( "sh-458: journal_init_dev: cannot init journal device\n '%s': %i",
kdevname( jdev ), result ); kdevname( jdev ), result );
else if (!kdev_same(jdev, super->s_dev)) {
set_blocksize(journal->j_dev_bd, super->s_blocksize);
}
return result; return result;
} }
...@@ -1981,15 +1991,12 @@ static int journal_init_dev( struct super_block *super, ...@@ -1981,15 +1991,12 @@ static int journal_init_dev( struct super_block *super,
} else if( jdev_inode -> i_bdev == NULL ) { } else if( jdev_inode -> i_bdev == NULL ) {
printk( "journal_init_dev: bdev unintialized for '%s'", jdev_name ); printk( "journal_init_dev: bdev unintialized for '%s'", jdev_name );
result = -ENOMEM; result = -ENOMEM;
} else if( ( result = blkdev_get( jdev_inode -> i_bdev, } else {
FMODE_READ | FMODE_WRITE,
0, BDEV_FS ) ) != 0 ) {
printk( "journal_init_dev: Cannot load device '%s': %i", jdev_name,
result );
} else
/* ok */ /* ok */
SB_JOURNAL_DEV( super ) = SB_JOURNAL_DEV( super ) =
to_kdev_t( jdev_inode -> i_bdev -> bd_dev ); to_kdev_t( jdev_inode -> i_bdev -> bd_dev );
set_blocksize(journal->j_dev_bd, super->s_blocksize);
}
} else { } else {
result = PTR_ERR( journal -> j_dev_file ); result = PTR_ERR( journal -> j_dev_file );
journal -> j_dev_file = NULL; journal -> j_dev_file = NULL;
......
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