Skip to content

Commit 9de31ee

Browse files
committed
reiserfs: port block device access to file
Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 1d3aa0b commit 9de31ee

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

fs/reiserfs/journal.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2386,7 +2386,7 @@ static int journal_read(struct super_block *sb)
23862386

23872387
cur_dblock = SB_ONDISK_JOURNAL_1st_BLOCK(sb);
23882388
reiserfs_info(sb, "checking transaction log (%pg)\n",
2389-
journal->j_bdev_handle->bdev);
2389+
file_bdev(journal->j_bdev_file));
23902390
start = ktime_get_seconds();
23912391

23922392
/*
@@ -2447,7 +2447,7 @@ static int journal_read(struct super_block *sb)
24472447
* device and journal device to be the same
24482448
*/
24492449
d_bh =
2450-
reiserfs_breada(journal->j_bdev_handle->bdev, cur_dblock,
2450+
reiserfs_breada(file_bdev(journal->j_bdev_file), cur_dblock,
24512451
sb->s_blocksize,
24522452
SB_ONDISK_JOURNAL_1st_BLOCK(sb) +
24532453
SB_ONDISK_JOURNAL_SIZE(sb));
@@ -2588,9 +2588,9 @@ static void journal_list_init(struct super_block *sb)
25882588

25892589
static void release_journal_dev(struct reiserfs_journal *journal)
25902590
{
2591-
if (journal->j_bdev_handle) {
2592-
bdev_release(journal->j_bdev_handle);
2593-
journal->j_bdev_handle = NULL;
2591+
if (journal->j_bdev_file) {
2592+
fput(journal->j_bdev_file);
2593+
journal->j_bdev_file = NULL;
25942594
}
25952595
}
25962596

@@ -2605,7 +2605,7 @@ static int journal_init_dev(struct super_block *super,
26052605

26062606
result = 0;
26072607

2608-
journal->j_bdev_handle = NULL;
2608+
journal->j_bdev_file = NULL;
26092609
jdev = SB_ONDISK_JOURNAL_DEVICE(super) ?
26102610
new_decode_dev(SB_ONDISK_JOURNAL_DEVICE(super)) : super->s_dev;
26112611

@@ -2616,37 +2616,37 @@ static int journal_init_dev(struct super_block *super,
26162616
if ((!jdev_name || !jdev_name[0])) {
26172617
if (jdev == super->s_dev)
26182618
holder = NULL;
2619-
journal->j_bdev_handle = bdev_open_by_dev(jdev, blkdev_mode,
2619+
journal->j_bdev_file = bdev_file_open_by_dev(jdev, blkdev_mode,
26202620
holder, NULL);
2621-
if (IS_ERR(journal->j_bdev_handle)) {
2622-
result = PTR_ERR(journal->j_bdev_handle);
2623-
journal->j_bdev_handle = NULL;
2621+
if (IS_ERR(journal->j_bdev_file)) {
2622+
result = PTR_ERR(journal->j_bdev_file);
2623+
journal->j_bdev_file = NULL;
26242624
reiserfs_warning(super, "sh-458",
26252625
"cannot init journal device unknown-block(%u,%u): %i",
26262626
MAJOR(jdev), MINOR(jdev), result);
26272627
return result;
26282628
} else if (jdev != super->s_dev)
2629-
set_blocksize(journal->j_bdev_handle->bdev,
2629+
set_blocksize(file_bdev(journal->j_bdev_file),
26302630
super->s_blocksize);
26312631

26322632
return 0;
26332633
}
26342634

2635-
journal->j_bdev_handle = bdev_open_by_path(jdev_name, blkdev_mode,
2635+
journal->j_bdev_file = bdev_file_open_by_path(jdev_name, blkdev_mode,
26362636
holder, NULL);
2637-
if (IS_ERR(journal->j_bdev_handle)) {
2638-
result = PTR_ERR(journal->j_bdev_handle);
2639-
journal->j_bdev_handle = NULL;
2637+
if (IS_ERR(journal->j_bdev_file)) {
2638+
result = PTR_ERR(journal->j_bdev_file);
2639+
journal->j_bdev_file = NULL;
26402640
reiserfs_warning(super, "sh-457",
26412641
"journal_init_dev: Cannot open '%s': %i",
26422642
jdev_name, result);
26432643
return result;
26442644
}
26452645

2646-
set_blocksize(journal->j_bdev_handle->bdev, super->s_blocksize);
2646+
set_blocksize(file_bdev(journal->j_bdev_file), super->s_blocksize);
26472647
reiserfs_info(super,
26482648
"journal_init_dev: journal device: %pg\n",
2649-
journal->j_bdev_handle->bdev);
2649+
file_bdev(journal->j_bdev_file));
26502650
return 0;
26512651
}
26522652

@@ -2804,7 +2804,7 @@ int journal_init(struct super_block *sb, const char *j_dev_name,
28042804
"journal header magic %x (device %pg) does "
28052805
"not match to magic found in super block %x",
28062806
jh->jh_journal.jp_journal_magic,
2807-
journal->j_bdev_handle->bdev,
2807+
file_bdev(journal->j_bdev_file),
28082808
sb_jp_journal_magic(rs));
28092809
brelse(bhjh);
28102810
goto free_and_return;
@@ -2828,7 +2828,7 @@ int journal_init(struct super_block *sb, const char *j_dev_name,
28282828
reiserfs_info(sb, "journal params: device %pg, size %u, "
28292829
"journal first block %u, max trans len %u, max batch %u, "
28302830
"max commit age %u, max trans age %u\n",
2831-
journal->j_bdev_handle->bdev,
2831+
file_bdev(journal->j_bdev_file),
28322832
SB_ONDISK_JOURNAL_SIZE(sb),
28332833
SB_ONDISK_JOURNAL_1st_BLOCK(sb),
28342834
journal->j_trans_max,

fs/reiserfs/procfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ static int show_journal(struct seq_file *m, void *unused)
354354
"prepare: \t%12lu\n"
355355
"prepare_retry: \t%12lu\n",
356356
DJP(jp_journal_1st_block),
357-
SB_JOURNAL(sb)->j_bdev_handle->bdev,
357+
file_bdev(SB_JOURNAL(sb)->j_bdev_file),
358358
DJP(jp_journal_dev),
359359
DJP(jp_journal_size),
360360
DJP(jp_journal_trans_max),

fs/reiserfs/reiserfs.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ struct reiserfs_journal {
299299
/* oldest journal block. start here for traverse */
300300
struct reiserfs_journal_cnode *j_first;
301301

302-
struct bdev_handle *j_bdev_handle;
302+
struct file *j_bdev_file;
303303

304304
/* first block on s_dev of reserved area journal */
305305
int j_1st_reserved_block;
@@ -2810,10 +2810,10 @@ struct reiserfs_journal_header {
28102810

28112811
/* We need these to make journal.c code more readable */
28122812
#define journal_find_get_block(s, block) __find_get_block(\
2813-
SB_JOURNAL(s)->j_bdev_handle->bdev, block, s->s_blocksize)
2814-
#define journal_getblk(s, block) __getblk(SB_JOURNAL(s)->j_bdev_handle->bdev,\
2813+
file_bdev(SB_JOURNAL(s)->j_bdev_file), block, s->s_blocksize)
2814+
#define journal_getblk(s, block) __getblk(file_bdev(SB_JOURNAL(s)->j_bdev_file),\
28152815
block, s->s_blocksize)
2816-
#define journal_bread(s, block) __bread(SB_JOURNAL(s)->j_bdev_handle->bdev,\
2816+
#define journal_bread(s, block) __bread(file_bdev(SB_JOURNAL(s)->j_bdev_file),\
28172817
block, s->s_blocksize)
28182818

28192819
enum reiserfs_bh_state_bits {

0 commit comments

Comments
 (0)