Skip to content

Commit 2de7038

Browse files
author
Mike Snitzer
committed
dm vdo: check for VDO_SUCCESS return value from memory-alloc functions
VDO_SUCCESS and UDS_SUCCESS were used interchangably, update all callers of VDO's memory-alloc functions to consistently check for VDO_SUCCESS. Signed-off-by: Mike Snitzer <[email protected]> Signed-off-by: Matthew Sakai <[email protected]>
1 parent 97d3380 commit 2de7038

28 files changed

+82
-82
lines changed

drivers/md/dm-vdo/block-map.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,11 @@ static int __must_check allocate_cache_components(struct vdo_page_cache *cache)
223223

224224
result = vdo_allocate(cache->page_count, struct page_info, "page infos",
225225
&cache->infos);
226-
if (result != UDS_SUCCESS)
226+
if (result != VDO_SUCCESS)
227227
return result;
228228

229229
result = vdo_allocate_memory(size, VDO_BLOCK_SIZE, "cache pages", &cache->pages);
230-
if (result != UDS_SUCCESS)
230+
if (result != VDO_SUCCESS)
231231
return result;
232232

233233
result = vdo_int_map_create(cache->page_count, &cache->page_map);
@@ -2874,7 +2874,7 @@ int vdo_decode_block_map(struct block_map_state_2_0 state, block_count_t logical
28742874
result = vdo_allocate_extended(struct block_map,
28752875
vdo->thread_config.logical_zone_count,
28762876
struct block_map_zone, __func__, &map);
2877-
if (result != UDS_SUCCESS)
2877+
if (result != VDO_SUCCESS)
28782878
return result;
28792879

28802880
map->vdo = vdo;

drivers/md/dm-vdo/data-vio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ int make_data_vio_pool(struct vdo *vdo, data_vio_count_t pool_size,
847847

848848
result = vdo_allocate_extended(struct data_vio_pool, pool_size, struct data_vio,
849849
__func__, &pool);
850-
if (result != UDS_SUCCESS)
850+
if (result != VDO_SUCCESS)
851851
return result;
852852

853853
ASSERT_LOG_ONLY((discard_limit <= pool_size),

drivers/md/dm-vdo/dm-vdo-target.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ static int split_string(const char *string, char separator, char ***substring_ar
280280

281281
result = vdo_allocate(substring_count + 1, char *, "string-splitting array",
282282
&substrings);
283-
if (result != UDS_SUCCESS)
283+
if (result != VDO_SUCCESS)
284284
return result;
285285

286286
for (s = string; *s != 0; s++) {
@@ -289,7 +289,7 @@ static int split_string(const char *string, char separator, char ***substring_ar
289289

290290
result = vdo_allocate(length + 1, char, "split string",
291291
&substrings[current_substring]);
292-
if (result != UDS_SUCCESS) {
292+
if (result != VDO_SUCCESS) {
293293
free_string_array(substrings);
294294
return result;
295295
}
@@ -310,7 +310,7 @@ static int split_string(const char *string, char separator, char ***substring_ar
310310

311311
result = vdo_allocate(length + 1, char, "split string",
312312
&substrings[current_substring]);
313-
if (result != UDS_SUCCESS) {
313+
if (result != VDO_SUCCESS) {
314314
free_string_array(substrings);
315315
return result;
316316
}
@@ -1527,7 +1527,7 @@ static size_t get_bit_array_size(unsigned int bit_count)
15271527
* Since the array is initially NULL, this also initializes the array the first time we allocate an
15281528
* instance number.
15291529
*
1530-
* Return: UDS_SUCCESS or an error code from the allocation
1530+
* Return: VDO_SUCCESS or an error code from the allocation
15311531
*/
15321532
static int grow_bit_array(void)
15331533
{
@@ -1540,19 +1540,19 @@ static int grow_bit_array(void)
15401540
get_bit_array_size(instances.bit_count),
15411541
get_bit_array_size(new_count),
15421542
"instance number bit array", &new_words);
1543-
if (result != UDS_SUCCESS)
1543+
if (result != VDO_SUCCESS)
15441544
return result;
15451545

15461546
instances.bit_count = new_count;
15471547
instances.words = new_words;
1548-
return UDS_SUCCESS;
1548+
return VDO_SUCCESS;
15491549
}
15501550

15511551
/**
15521552
* allocate_instance() - Allocate an instance number.
15531553
* @instance_ptr: A point to hold the instance number
15541554
*
1555-
* Return: UDS_SUCCESS or an error code
1555+
* Return: VDO_SUCCESS or an error code
15561556
*
15571557
* This function must be called while holding the instances lock.
15581558
*/
@@ -1564,7 +1564,7 @@ static int allocate_instance(unsigned int *instance_ptr)
15641564
/* If there are no unallocated instances, grow the bit array. */
15651565
if (instances.count >= instances.bit_count) {
15661566
result = grow_bit_array();
1567-
if (result != UDS_SUCCESS)
1567+
if (result != VDO_SUCCESS)
15681568
return result;
15691569
}
15701570

@@ -1587,7 +1587,7 @@ static int allocate_instance(unsigned int *instance_ptr)
15871587
instances.count++;
15881588
instances.next = instance + 1;
15891589
*instance_ptr = instance;
1590-
return UDS_SUCCESS;
1590+
return VDO_SUCCESS;
15911591
}
15921592

15931593
static int construct_new_vdo_registered(struct dm_target *ti, unsigned int argc,

drivers/md/dm-vdo/encodings.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ static int allocate_partition(struct layout *layout, u8 id,
800800
int result;
801801

802802
result = vdo_allocate(1, struct partition, __func__, &partition);
803-
if (result != UDS_SUCCESS)
803+
if (result != VDO_SUCCESS)
804804
return result;
805805

806806
partition->id = id;

drivers/md/dm-vdo/funnel-queue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ int uds_make_funnel_queue(struct funnel_queue **queue_ptr)
1515
struct funnel_queue *queue;
1616

1717
result = vdo_allocate(1, struct funnel_queue, "funnel queue", &queue);
18-
if (result != UDS_SUCCESS)
18+
if (result != VDO_SUCCESS)
1919
return result;
2020

2121
/*

drivers/md/dm-vdo/funnel-workqueue.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ static int make_simple_work_queue(const char *thread_name_prefix, const char *na
324324
VDO_WORK_Q_MAX_PRIORITY);
325325

326326
result = vdo_allocate(1, struct simple_work_queue, "simple work queue", &queue);
327-
if (result != UDS_SUCCESS)
327+
if (result != VDO_SUCCESS)
328328
return result;
329329

330330
queue->private = private;
@@ -401,12 +401,12 @@ int vdo_make_work_queue(const char *thread_name_prefix, const char *name,
401401

402402
result = vdo_allocate(1, struct round_robin_work_queue, "round-robin work queue",
403403
&queue);
404-
if (result != UDS_SUCCESS)
404+
if (result != VDO_SUCCESS)
405405
return result;
406406

407407
result = vdo_allocate(thread_count, struct simple_work_queue *,
408408
"subordinate work queues", &queue->service_queues);
409-
if (result != UDS_SUCCESS) {
409+
if (result != VDO_SUCCESS) {
410410
vdo_free(queue);
411411
return result;
412412
}

drivers/md/dm-vdo/indexer/chapter-index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int uds_make_open_chapter_index(struct open_chapter_index **chapter_index,
2121
struct open_chapter_index *index;
2222

2323
result = vdo_allocate(1, struct open_chapter_index, "open chapter index", &index);
24-
if (result != UDS_SUCCESS)
24+
if (result != VDO_SUCCESS)
2525
return result;
2626

2727
/*

drivers/md/dm-vdo/indexer/config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ int uds_make_configuration(const struct uds_parameters *params,
326326
return result;
327327

328328
result = vdo_allocate(1, struct uds_configuration, __func__, &config);
329-
if (result != UDS_SUCCESS)
329+
if (result != VDO_SUCCESS)
330330
return result;
331331

332332
result = uds_make_index_geometry(DEFAULT_BYTES_PER_PAGE, record_pages_per_chapter,

drivers/md/dm-vdo/indexer/delta-index.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,18 +312,18 @@ static int initialize_delta_zone(struct delta_zone *delta_zone, size_t size,
312312
int result;
313313

314314
result = vdo_allocate(size, u8, "delta list", &delta_zone->memory);
315-
if (result != UDS_SUCCESS)
315+
if (result != VDO_SUCCESS)
316316
return result;
317317

318318
result = vdo_allocate(list_count + 2, u64, "delta list temp",
319319
&delta_zone->new_offsets);
320-
if (result != UDS_SUCCESS)
320+
if (result != VDO_SUCCESS)
321321
return result;
322322

323323
/* Allocate the delta lists. */
324324
result = vdo_allocate(list_count + 2, struct delta_list, "delta lists",
325325
&delta_zone->delta_lists);
326-
if (result != UDS_SUCCESS)
326+
if (result != VDO_SUCCESS)
327327
return result;
328328

329329
compute_coding_constants(mean_delta, &delta_zone->min_bits,
@@ -354,7 +354,7 @@ int uds_initialize_delta_index(struct delta_index *delta_index, unsigned int zon
354354

355355
result = vdo_allocate(zone_count, struct delta_zone, "Delta Index Zones",
356356
&delta_index->delta_zones);
357-
if (result != UDS_SUCCESS)
357+
if (result != VDO_SUCCESS)
358358
return result;
359359

360360
delta_index->zone_count = zone_count;
@@ -1048,7 +1048,7 @@ int uds_finish_restoring_delta_index(struct delta_index *delta_index,
10481048
u8 *data;
10491049

10501050
result = vdo_allocate(DELTA_LIST_MAX_BYTE_COUNT, u8, __func__, &data);
1051-
if (result != UDS_SUCCESS)
1051+
if (result != VDO_SUCCESS)
10521052
return result;
10531053

10541054
for (z = 0; z < reader_count; z++) {

drivers/md/dm-vdo/indexer/funnel-requestqueue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ int uds_make_request_queue(const char *queue_name,
199199
struct uds_request_queue *queue;
200200

201201
result = vdo_allocate(1, struct uds_request_queue, __func__, &queue);
202-
if (result != UDS_SUCCESS)
202+
if (result != VDO_SUCCESS)
203203
return result;
204204

205205
queue->processor = processor;

0 commit comments

Comments
 (0)