Skip to content

Commit

Permalink
ext4: consolidate checks for resize of bigalloc into ext4_resize_begin
Browse files Browse the repository at this point in the history
Two different places checked for attempts to resize a filesystem with
the bigalloc feature. Move the check into ext4_resize_begin, which both
places already call.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Link: https://lore.kernel.org/r/bee03303d999225ecb3bfa5be8576b2f4c6edbe6.1623093259.git.josh@joshtriplett.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
  • Loading branch information
Josh Triplett authored and Theodore Ts'o committed Jun 24, 2021
1 parent 310c097 commit e9f9f61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
14 changes: 0 additions & 14 deletions fs/ext4/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,13 +692,6 @@ static long ext4_ioctl_group_add(struct file *file,
if (err)
return err;

if (ext4_has_feature_bigalloc(sb)) {
ext4_msg(sb, KERN_ERR,
"Online resizing not supported with bigalloc");
err = -EOPNOTSUPP;
goto group_add_out;
}

err = mnt_want_write_file(file);
if (err)
goto group_add_out;
Expand Down Expand Up @@ -921,13 +914,6 @@ static long __ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
goto group_extend_out;
}

if (ext4_has_feature_bigalloc(sb)) {
ext4_msg(sb, KERN_ERR,
"Online resizing not supported with bigalloc");
err = -EOPNOTSUPP;
goto group_extend_out;
}

err = mnt_want_write_file(filp);
if (err)
goto group_extend_out;
Expand Down
5 changes: 5 additions & 0 deletions fs/ext4/resize.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ int ext4_resize_begin(struct super_block *sb)
return -EPERM;
}

if (ext4_has_feature_bigalloc(sb)) {
ext4_msg(sb, KERN_ERR, "Online resizing not supported with bigalloc");
return -EOPNOTSUPP;
}

if (test_and_set_bit_lock(EXT4_FLAGS_RESIZING,
&EXT4_SB(sb)->s_ext4_flags))
ret = -EBUSY;
Expand Down

0 comments on commit e9f9f61

Please sign in to comment.