1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

vdo: fix input units for minimim_io_size

When specifying minimum_io_size with --vdosettings,
command assumed wrong unit (sectors).

So '--vdosettings minimum_io_size=512|4096' resulted into
an error that only 512 or 4096 values are allowed, but
at the same time values  1 or 8 were accepted.

So fix by converting any number >= 512 to 'sectors' and
keep input of 1 or 8 still valid if anyone has been using
this before.

So now we take  512 or 4096  and still also  1 or 8 with the
same effect.

Also correct the 'error' message when invalid minimum_io_size
is specified.

(cherry picked from commit 158d3243b6)
This commit is contained in:
Zdenek Kabelac 2024-11-08 16:12:30 +01:00 committed by Marian Csontos
parent 38177186f7
commit 9a735a3998
2 changed files with 5 additions and 1 deletions

View File

@ -28,7 +28,7 @@ bool dm_vdo_validate_target_params(const struct dm_vdo_target_params *vtp,
if ((vtp->minimum_io_size != (512 >> SECTOR_SHIFT)) && if ((vtp->minimum_io_size != (512 >> SECTOR_SHIFT)) &&
(vtp->minimum_io_size != (4096 >> SECTOR_SHIFT))) { (vtp->minimum_io_size != (4096 >> SECTOR_SHIFT))) {
log_error("VDO minimum io size %u is unsupported [512, 4096].", log_error("VDO minimum io size %u is unsupported [512, 4096].",
vtp->minimum_io_size); (vtp->minimum_io_size << SECTOR_SHIFT));
valid = false; valid = false;
} }

View File

@ -1372,6 +1372,10 @@ int get_vdo_settings(struct cmd_context *cmd,
u |= VDO_CHANGE_ONLINE; u |= VDO_CHANGE_ONLINE;
} }
/* store size in sector units */
if (vtp->minimum_io_size >= 512)
vtp->minimum_io_size >>= SECTOR_SHIFT;
// validation of updated VDO option // validation of updated VDO option
if (!dm_vdo_validate_target_params(vtp, 0 /* vdo_size */)) if (!dm_vdo_validate_target_params(vtp, 0 /* vdo_size */))
goto_out; goto_out;