mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
ext4: cleanup the dax handling in ext4_fill_super
Only call fs_dax_get_by_bdev once the sbi has been allocated and remove the need for the dax_dev local variable. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Link: https://lore.kernel.org/r/20211129102203.2243509-21-hch@lst.de Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
cea845cdef
commit
89b93a7b15
1 changed files with 3 additions and 4 deletions
|
@ -3878,7 +3878,6 @@ static void ext4_setup_csum_trigger(struct super_block *sb,
|
||||||
|
|
||||||
static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
||||||
{
|
{
|
||||||
struct dax_device *dax_dev = fs_dax_get_by_bdev(sb->s_bdev);
|
|
||||||
char *orig_data = kstrdup(data, GFP_KERNEL);
|
char *orig_data = kstrdup(data, GFP_KERNEL);
|
||||||
struct buffer_head *bh, **group_desc;
|
struct buffer_head *bh, **group_desc;
|
||||||
struct ext4_super_block *es = NULL;
|
struct ext4_super_block *es = NULL;
|
||||||
|
@ -3909,12 +3908,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
||||||
if ((data && !orig_data) || !sbi)
|
if ((data && !orig_data) || !sbi)
|
||||||
goto out_free_base;
|
goto out_free_base;
|
||||||
|
|
||||||
sbi->s_daxdev = dax_dev;
|
|
||||||
sbi->s_blockgroup_lock =
|
sbi->s_blockgroup_lock =
|
||||||
kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);
|
kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);
|
||||||
if (!sbi->s_blockgroup_lock)
|
if (!sbi->s_blockgroup_lock)
|
||||||
goto out_free_base;
|
goto out_free_base;
|
||||||
|
|
||||||
|
sbi->s_daxdev = fs_dax_get_by_bdev(sb->s_bdev);
|
||||||
sb->s_fs_info = sbi;
|
sb->s_fs_info = sbi;
|
||||||
sbi->s_sb = sb;
|
sbi->s_sb = sb;
|
||||||
sbi->s_inode_readahead_blks = EXT4_DEF_INODE_READAHEAD_BLKS;
|
sbi->s_inode_readahead_blks = EXT4_DEF_INODE_READAHEAD_BLKS;
|
||||||
|
@ -4299,7 +4298,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
||||||
goto failed_mount;
|
goto failed_mount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dax_dev) {
|
if (sbi->s_daxdev) {
|
||||||
if (blocksize == PAGE_SIZE)
|
if (blocksize == PAGE_SIZE)
|
||||||
set_bit(EXT4_FLAGS_BDEV_IS_DAX, &sbi->s_ext4_flags);
|
set_bit(EXT4_FLAGS_BDEV_IS_DAX, &sbi->s_ext4_flags);
|
||||||
else
|
else
|
||||||
|
@ -5095,10 +5094,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
||||||
out_fail:
|
out_fail:
|
||||||
sb->s_fs_info = NULL;
|
sb->s_fs_info = NULL;
|
||||||
kfree(sbi->s_blockgroup_lock);
|
kfree(sbi->s_blockgroup_lock);
|
||||||
|
fs_put_dax(sbi->s_daxdev);
|
||||||
out_free_base:
|
out_free_base:
|
||||||
kfree(sbi);
|
kfree(sbi);
|
||||||
kfree(orig_data);
|
kfree(orig_data);
|
||||||
fs_put_dax(dax_dev);
|
|
||||||
return err ? err : ret;
|
return err ? err : ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue