aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/journal.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs/journal.c')
-rw-r--r--fs/reiserfs/journal.c60
1 files changed, 28 insertions, 32 deletions
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 060eb3f598e7..e396b2fa4743 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -1187,7 +1187,7 @@ static int flush_commit_list(struct super_block *s,
1187 1187
1188 if (retval) 1188 if (retval)
1189 reiserfs_abort(s, retval, "Journal write error in %s", 1189 reiserfs_abort(s, retval, "Journal write error in %s",
1190 __FUNCTION__); 1190 __func__);
1191 put_fs_excl(); 1191 put_fs_excl();
1192 return retval; 1192 return retval;
1193} 1193}
@@ -1534,7 +1534,7 @@ static int flush_journal_list(struct super_block *s,
1534 reiserfs_warning(s, 1534 reiserfs_warning(s,
1535 "clm-2082: Unable to flush buffer %llu in %s", 1535 "clm-2082: Unable to flush buffer %llu in %s",
1536 (unsigned long long)saved_bh-> 1536 (unsigned long long)saved_bh->
1537 b_blocknr, __FUNCTION__); 1537 b_blocknr, __func__);
1538 } 1538 }
1539 free_cnode: 1539 free_cnode:
1540 last = cn; 1540 last = cn;
@@ -1586,7 +1586,7 @@ static int flush_journal_list(struct super_block *s,
1586 if (err) 1586 if (err)
1587 reiserfs_abort(s, -EIO, 1587 reiserfs_abort(s, -EIO,
1588 "Write error while pushing transaction to disk in %s", 1588 "Write error while pushing transaction to disk in %s",
1589 __FUNCTION__); 1589 __func__);
1590 flush_older_and_return: 1590 flush_older_and_return:
1591 1591
1592 /* before we can update the journal header block, we _must_ flush all 1592 /* before we can update the journal header block, we _must_ flush all
@@ -1616,7 +1616,7 @@ static int flush_journal_list(struct super_block *s,
1616 if (err) 1616 if (err)
1617 reiserfs_abort(s, -EIO, 1617 reiserfs_abort(s, -EIO,
1618 "Write error while updating journal header in %s", 1618 "Write error while updating journal header in %s",
1619 __FUNCTION__); 1619 __func__);
1620 } 1620 }
1621 remove_all_from_journal_list(s, jl, 0); 1621 remove_all_from_journal_list(s, jl, 0);
1622 list_del_init(&jl->j_list); 1622 list_del_init(&jl->j_list);
@@ -2574,11 +2574,9 @@ static int release_journal_dev(struct super_block *super,
2574 2574
2575 result = 0; 2575 result = 0;
2576 2576
2577 if (journal->j_dev_file != NULL) { 2577 if (journal->j_dev_bd != NULL) {
2578 result = filp_close(journal->j_dev_file, NULL); 2578 if (journal->j_dev_bd->bd_dev != super->s_dev)
2579 journal->j_dev_file = NULL; 2579 bd_release(journal->j_dev_bd);
2580 journal->j_dev_bd = NULL;
2581 } else if (journal->j_dev_bd != NULL) {
2582 result = blkdev_put(journal->j_dev_bd); 2580 result = blkdev_put(journal->j_dev_bd);
2583 journal->j_dev_bd = NULL; 2581 journal->j_dev_bd = NULL;
2584 } 2582 }
@@ -2603,7 +2601,6 @@ static int journal_init_dev(struct super_block *super,
2603 result = 0; 2601 result = 0;
2604 2602
2605 journal->j_dev_bd = NULL; 2603 journal->j_dev_bd = NULL;
2606 journal->j_dev_file = NULL;
2607 jdev = SB_ONDISK_JOURNAL_DEVICE(super) ? 2604 jdev = SB_ONDISK_JOURNAL_DEVICE(super) ?
2608 new_decode_dev(SB_ONDISK_JOURNAL_DEVICE(super)) : super->s_dev; 2605 new_decode_dev(SB_ONDISK_JOURNAL_DEVICE(super)) : super->s_dev;
2609 2606
@@ -2620,35 +2617,34 @@ static int journal_init_dev(struct super_block *super,
2620 "cannot init journal device '%s': %i", 2617 "cannot init journal device '%s': %i",
2621 __bdevname(jdev, b), result); 2618 __bdevname(jdev, b), result);
2622 return result; 2619 return result;
2623 } else if (jdev != super->s_dev) 2620 } else if (jdev != super->s_dev) {
2621 result = bd_claim(journal->j_dev_bd, journal);
2622 if (result) {
2623 blkdev_put(journal->j_dev_bd);
2624 return result;
2625 }
2626
2624 set_blocksize(journal->j_dev_bd, super->s_blocksize); 2627 set_blocksize(journal->j_dev_bd, super->s_blocksize);
2628 }
2629
2625 return 0; 2630 return 0;
2626 } 2631 }
2627 2632
2628 journal->j_dev_file = filp_open(jdev_name, 0, 0); 2633 journal->j_dev_bd = open_bdev_excl(jdev_name, 0, journal);
2629 if (!IS_ERR(journal->j_dev_file)) { 2634 if (IS_ERR(journal->j_dev_bd)) {
2630 struct inode *jdev_inode = journal->j_dev_file->f_mapping->host; 2635 result = PTR_ERR(journal->j_dev_bd);
2631 if (!S_ISBLK(jdev_inode->i_mode)) { 2636 journal->j_dev_bd = NULL;
2632 reiserfs_warning(super, "journal_init_dev: '%s' is "
2633 "not a block device", jdev_name);
2634 result = -ENOTBLK;
2635 release_journal_dev(super, journal);
2636 } else {
2637 /* ok */
2638 journal->j_dev_bd = I_BDEV(jdev_inode);
2639 set_blocksize(journal->j_dev_bd, super->s_blocksize);
2640 reiserfs_info(super,
2641 "journal_init_dev: journal device: %s\n",
2642 bdevname(journal->j_dev_bd, b));
2643 }
2644 } else {
2645 result = PTR_ERR(journal->j_dev_file);
2646 journal->j_dev_file = NULL;
2647 reiserfs_warning(super, 2637 reiserfs_warning(super,
2648 "journal_init_dev: Cannot open '%s': %i", 2638 "journal_init_dev: Cannot open '%s': %i",
2649 jdev_name, result); 2639 jdev_name, result);
2640 return result;
2650 } 2641 }
2651 return result; 2642
2643 set_blocksize(journal->j_dev_bd, super->s_blocksize);
2644 reiserfs_info(super,
2645 "journal_init_dev: journal device: %s\n",
2646 bdevname(journal->j_dev_bd, b));
2647 return 0;
2652} 2648}
2653 2649
2654/** 2650/**
@@ -4316,5 +4312,5 @@ static void __reiserfs_journal_abort_soft(struct super_block *sb, int errno)
4316 4312
4317void reiserfs_journal_abort(struct super_block *sb, int errno) 4313void reiserfs_journal_abort(struct super_block *sb, int errno)
4318{ 4314{
4319 return __reiserfs_journal_abort_soft(sb, errno); 4315 __reiserfs_journal_abort_soft(sb, errno);
4320} 4316}