Skip to content

Commit 148a9ce

Browse files
lorelei-sakaiMikulas Patocka
authored andcommitted
dm vdo: remove checks that can not fail
Remove checks that can't fail. Signed-off-by: Matthew Sakai <msakai@redhat.com> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
1 parent f4e99b8 commit 148a9ce

File tree

2 files changed

+1
-22
lines changed

2 files changed

+1
-22
lines changed

drivers/md/dm-vdo/constants.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ enum {
4444
/* The default size of each slab journal, in blocks */
4545
DEFAULT_VDO_SLAB_JOURNAL_SIZE = 224,
4646

47-
/* Unit test minimum */
48-
MINIMUM_VDO_SLAB_JOURNAL_BLOCKS = 2,
49-
5047
/*
5148
* The initial size of lbn_operations and pbn_operations, which is based upon the expected
5249
* maximum number of outstanding VIOs. This value was chosen to make it highly unlikely

drivers/md/dm-vdo/encodings.c

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -711,24 +711,11 @@ int vdo_configure_slab(block_count_t slab_size, block_count_t slab_journal_block
711711
ref_blocks = vdo_get_saved_reference_count_size(slab_size - slab_journal_blocks);
712712
meta_blocks = (ref_blocks + slab_journal_blocks);
713713

714-
/* Make sure test code hasn't configured slabs to be too small. */
714+
/* Make sure configured slabs are not too small. */
715715
if (meta_blocks >= slab_size)
716716
return VDO_BAD_CONFIGURATION;
717717

718-
/*
719-
* If the slab size is very small, assume this must be a unit test and override the number
720-
* of data blocks to be a power of two (wasting blocks in the slab). Many tests need their
721-
* data_blocks fields to be the exact capacity of the configured volume, and that used to
722-
* fall out since they use a power of two for the number of data blocks, the slab size was
723-
* a power of two, and every block in a slab was a data block.
724-
*
725-
* TODO: Try to figure out some way of structuring testParameters and unit tests so this
726-
* hack isn't needed without having to edit several unit tests every time the metadata size
727-
* changes by one block.
728-
*/
729718
data_blocks = slab_size - meta_blocks;
730-
if ((slab_size < 1024) && !is_power_of_2(data_blocks))
731-
data_blocks = ((block_count_t) 1 << ilog2(data_blocks));
732719

733720
/*
734721
* Configure the slab journal thresholds. The flush threshold is 168 of 224 blocks in
@@ -1221,11 +1208,6 @@ int vdo_validate_config(const struct vdo_config *config,
12211208
if (result != VDO_SUCCESS)
12221209
return result;
12231210

1224-
result = VDO_ASSERT(config->slab_journal_blocks >= MINIMUM_VDO_SLAB_JOURNAL_BLOCKS,
1225-
"slab journal size meets minimum size");
1226-
if (result != VDO_SUCCESS)
1227-
return result;
1228-
12291211
result = VDO_ASSERT(config->slab_journal_blocks <= config->slab_size,
12301212
"slab journal size is within expected bound");
12311213
if (result != VDO_SUCCESS)

0 commit comments

Comments
 (0)