Commit 51bf8d3c authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jaegeuk Kim
Browse files

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: 3c62be17 ("f2fs: support multiple devices")
Fixes: 0718afd4 ("block: introduce holder ops")
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent b5ab3276
Loading
Loading
Loading
Loading
+8 −12
Original line number Original line Diff line number Diff line
@@ -1561,6 +1561,7 @@ static void destroy_device_list(struct f2fs_sb_info *sbi)
	int i;
	int i;


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


	for (i = 0; i < max_devices; i++) {
	for (i = 0; i < max_devices; i++) {

		if (i == 0)
		if (i > 0 && !RDEV(i).path[0])
			FDEV(0).bdev = sbi->sb->s_bdev;
		else if (!RDEV(i).path[0])
			break;
			break;


		if (max_devices == 1) {
		if (max_devices > 1) {
			/* Single zoned block device mount */
			FDEV(0).bdev =
				blkdev_get_by_dev(sbi->sb->s_bdev->bd_dev, mode,
						  sbi->sb->s_type, NULL);
		} else {
			/* Multi-device mount */
			/* Multi-device mount */
			memcpy(FDEV(i).path, RDEV(i).path, MAX_PATH_LEN);
			memcpy(FDEV(i).path, RDEV(i).path, MAX_PATH_LEN);
			FDEV(i).total_segments =
			FDEV(i).total_segments =
@@ -4215,10 +4212,9 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
				FDEV(i).end_blk = FDEV(i).start_blk +
				FDEV(i).end_blk = FDEV(i).start_blk +
					(FDEV(i).total_segments <<
					(FDEV(i).total_segments <<
					sbi->log_blocks_per_seg) - 1;
					sbi->log_blocks_per_seg) - 1;
				FDEV(i).bdev = blkdev_get_by_path(FDEV(i).path,
					mode, sbi->sb->s_type, NULL);
			}
			}
			FDEV(i).bdev = blkdev_get_by_path(FDEV(i).path, mode,
							  sbi->sb->s_type,
							  NULL);
		}
		}
		if (IS_ERR(FDEV(i).bdev))
		if (IS_ERR(FDEV(i).bdev))
			return PTR_ERR(FDEV(i).bdev);
			return PTR_ERR(FDEV(i).bdev);