Commit 8bed1783 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Christian Brauner
Browse files

ext4: use fs_holder_ops for the log device



Use the generic fs_holder_ops to shut down the file system when the
log device goes away instead of duplicating the logic.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Message-Id: <20230802154131.2221419-11-hch@lst.de>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 6f5fc7de
Loading
Loading
Loading
Loading
+1 −10
Original line number Original line Diff line number Diff line
@@ -1097,15 +1097,6 @@ void ext4_update_dynamic_rev(struct super_block *sb)
	 */
	 */
}
}


static void ext4_bdev_mark_dead(struct block_device *bdev)
{
	ext4_force_shutdown(bdev->bd_holder, EXT4_GOING_FLAGS_NOLOGFLUSH);
}

static const struct blk_holder_ops ext4_holder_ops = {
	.mark_dead		= ext4_bdev_mark_dead,
};

/*
/*
 * Open the external journal device
 * Open the external journal device
 */
 */
@@ -1114,7 +1105,7 @@ static struct block_device *ext4_blkdev_get(dev_t dev, struct super_block *sb)
	struct block_device *bdev;
	struct block_device *bdev;


	bdev = blkdev_get_by_dev(dev, BLK_OPEN_READ | BLK_OPEN_WRITE, sb,
	bdev = blkdev_get_by_dev(dev, BLK_OPEN_READ | BLK_OPEN_WRITE, sb,
				 &ext4_holder_ops);
				 &fs_holder_ops);
	if (IS_ERR(bdev))
	if (IS_ERR(bdev))
		goto fail;
		goto fail;
	return bdev;
	return bdev;