Skip to content

Commit 512383a

Browse files
committed
f2fs: port block device access to files
Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 61ead71 commit 512383a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

fs/f2fs/f2fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ struct f2fs_bio_info {
12391239
#define FDEV(i) (sbi->devs[i])
12401240
#define RDEV(i) (raw_super->devs[i])
12411241
struct f2fs_dev_info {
1242-
struct bdev_handle *bdev_handle;
1242+
struct file *bdev_file;
12431243
struct block_device *bdev;
12441244
char path[MAX_PATH_LEN];
12451245
unsigned int total_segments;

fs/f2fs/super.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,7 @@ static void destroy_device_list(struct f2fs_sb_info *sbi)
16051605

16061606
for (i = 0; i < sbi->s_ndevs; i++) {
16071607
if (i > 0)
1608-
bdev_release(FDEV(i).bdev_handle);
1608+
fput(FDEV(i).bdev_file);
16091609
#ifdef CONFIG_BLK_DEV_ZONED
16101610
kvfree(FDEV(i).blkz_seq);
16111611
#endif
@@ -4247,7 +4247,7 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
42474247

42484248
for (i = 0; i < max_devices; i++) {
42494249
if (i == 0)
4250-
FDEV(0).bdev_handle = sb_bdev_handle(sbi->sb);
4250+
FDEV(0).bdev_file = sbi->sb->s_bdev_file;
42514251
else if (!RDEV(i).path[0])
42524252
break;
42534253

@@ -4267,14 +4267,14 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
42674267
FDEV(i).end_blk = FDEV(i).start_blk +
42684268
(FDEV(i).total_segments <<
42694269
sbi->log_blocks_per_seg) - 1;
4270-
FDEV(i).bdev_handle = bdev_open_by_path(
4270+
FDEV(i).bdev_file = bdev_file_open_by_path(
42714271
FDEV(i).path, mode, sbi->sb, NULL);
42724272
}
42734273
}
4274-
if (IS_ERR(FDEV(i).bdev_handle))
4275-
return PTR_ERR(FDEV(i).bdev_handle);
4274+
if (IS_ERR(FDEV(i).bdev_file))
4275+
return PTR_ERR(FDEV(i).bdev_file);
42764276

4277-
FDEV(i).bdev = FDEV(i).bdev_handle->bdev;
4277+
FDEV(i).bdev = file_bdev(FDEV(i).bdev_file);
42784278
/* to release errored devices */
42794279
sbi->s_ndevs = i + 1;
42804280

0 commit comments

Comments
 (0)