Skip to content

Commit 51bf8d3

Browse files
Christoph HellwigJaegeuk Kim
authored andcommitted
f2fs: don't reopen the main block device in f2fs_scan_devices
f2fs_scan_devices reopens the main device since the very beginning, which has always been useless, and also means that we don't pass the right holder for the reopen, which now leads to a warning as the core super.c holder ops aren't passed in for the reopen. Fixes: 3c62be1 ("f2fs: support multiple devices") Fixes: 0718afd ("block: introduce holder ops") Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent b5ab327 commit 51bf8d3

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

fs/f2fs/super.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,8 @@ static void destroy_device_list(struct f2fs_sb_info *sbi)
15611561
int i;
15621562

15631563
for (i = 0; i < sbi->s_ndevs; i++) {
1564-
blkdev_put(FDEV(i).bdev, sbi->sb->s_type);
1564+
if (i > 0)
1565+
blkdev_put(FDEV(i).bdev, sbi->sb->s_type);
15651566
#ifdef CONFIG_BLK_DEV_ZONED
15661567
kvfree(FDEV(i).blkz_seq);
15671568
#endif
@@ -4190,16 +4191,12 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
41904191
sbi->aligned_blksize = true;
41914192

41924193
for (i = 0; i < max_devices; i++) {
4193-
4194-
if (i > 0 && !RDEV(i).path[0])
4194+
if (i == 0)
4195+
FDEV(0).bdev = sbi->sb->s_bdev;
4196+
else if (!RDEV(i).path[0])
41954197
break;
41964198

4197-
if (max_devices == 1) {
4198-
/* Single zoned block device mount */
4199-
FDEV(0).bdev =
4200-
blkdev_get_by_dev(sbi->sb->s_bdev->bd_dev, mode,
4201-
sbi->sb->s_type, NULL);
4202-
} else {
4199+
if (max_devices > 1) {
42034200
/* Multi-device mount */
42044201
memcpy(FDEV(i).path, RDEV(i).path, MAX_PATH_LEN);
42054202
FDEV(i).total_segments =
@@ -4215,10 +4212,9 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
42154212
FDEV(i).end_blk = FDEV(i).start_blk +
42164213
(FDEV(i).total_segments <<
42174214
sbi->log_blocks_per_seg) - 1;
4215+
FDEV(i).bdev = blkdev_get_by_path(FDEV(i).path,
4216+
mode, sbi->sb->s_type, NULL);
42184217
}
4219-
FDEV(i).bdev = blkdev_get_by_path(FDEV(i).path, mode,
4220-
sbi->sb->s_type,
4221-
NULL);
42224218
}
42234219
if (IS_ERR(FDEV(i).bdev))
42244220
return PTR_ERR(FDEV(i).bdev);

0 commit comments

Comments
 (0)