Skip to content

Commit 2fa67a7

Browse files
stefanhaRHkevmw
authored andcommitted
virtio-blk: tidy up iothread_vq_mapping functions
Use noun_verb() function naming instead of verb_noun() because the former is the most common naming style for APIs. The next commit will move these functions into a header file so that virtio-scsi can call them. Shorten iothread_vq_mapping_apply()'s iothread_vq_mapping_list argument to just "list" like in the other functions. Signed-off-by: Stefan Hajnoczi <[email protected]> Reviewed-by: Kevin Wolf <[email protected]> Message-ID: <[email protected]> Tested-by: Peter Krempa <[email protected]> Signed-off-by: Kevin Wolf <[email protected]>
1 parent 366b581 commit 2fa67a7

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

hw/block/virtio-blk.c

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,8 +1424,8 @@ static const BlockDevOps virtio_block_ops = {
14241424
};
14251425

14261426
static bool
1427-
validate_iothread_vq_mapping_list(IOThreadVirtQueueMappingList *list,
1428-
uint16_t num_queues, Error **errp)
1427+
iothread_vq_mapping_validate(IOThreadVirtQueueMappingList *list, uint16_t
1428+
num_queues, Error **errp)
14291429
{
14301430
g_autofree unsigned long *vqs = bitmap_new(num_queues);
14311431
g_autoptr(GHashTable) iothreads =
@@ -1486,22 +1486,22 @@ validate_iothread_vq_mapping_list(IOThreadVirtQueueMappingList *list,
14861486
}
14871487

14881488
/**
1489-
* apply_iothread_vq_mapping:
1490-
* @iothread_vq_mapping_list: The mapping of virtqueues to IOThreads.
1489+
* iothread_vq_mapping_apply:
1490+
* @list: The mapping of virtqueues to IOThreads.
14911491
* @vq_aio_context: The array of AioContext pointers to fill in.
14921492
* @num_queues: The length of @vq_aio_context.
14931493
* @errp: If an error occurs, a pointer to the area to store the error.
14941494
*
14951495
* Fill in the AioContext for each virtqueue in the @vq_aio_context array given
1496-
* the iothread-vq-mapping parameter in @iothread_vq_mapping_list.
1496+
* the iothread-vq-mapping parameter in @list.
14971497
*
1498-
* cleanup_iothread_vq_mapping() must be called to free IOThread object
1498+
* iothread_vq_mapping_cleanup() must be called to free IOThread object
14991499
* references after this function returns success.
15001500
*
15011501
* Returns: %true on success, %false on failure.
15021502
**/
1503-
static bool apply_iothread_vq_mapping(
1504-
IOThreadVirtQueueMappingList *iothread_vq_mapping_list,
1503+
static bool iothread_vq_mapping_apply(
1504+
IOThreadVirtQueueMappingList *list,
15051505
AioContext **vq_aio_context,
15061506
uint16_t num_queues,
15071507
Error **errp)
@@ -1510,16 +1510,15 @@ static bool apply_iothread_vq_mapping(
15101510
size_t num_iothreads = 0;
15111511
size_t cur_iothread = 0;
15121512

1513-
if (!validate_iothread_vq_mapping_list(iothread_vq_mapping_list,
1514-
num_queues, errp)) {
1513+
if (!iothread_vq_mapping_validate(list, num_queues, errp)) {
15151514
return false;
15161515
}
15171516

1518-
for (node = iothread_vq_mapping_list; node; node = node->next) {
1517+
for (node = list; node; node = node->next) {
15191518
num_iothreads++;
15201519
}
15211520

1522-
for (node = iothread_vq_mapping_list; node; node = node->next) {
1521+
for (node = list; node; node = node->next) {
15231522
IOThread *iothread = iothread_by_id(node->value->iothread);
15241523
AioContext *ctx = iothread_get_aio_context(iothread);
15251524

@@ -1549,13 +1548,13 @@ static bool apply_iothread_vq_mapping(
15491548
}
15501549

15511550
/**
1552-
* cleanup_iothread_vq_mapping:
1551+
* iothread_vq_mapping_cleanup:
15531552
* @list: The mapping of virtqueues to IOThreads.
15541553
*
15551554
* Release IOThread object references that were acquired by
1556-
* apply_iothread_vq_mapping().
1555+
* iothread_vq_mapping_apply().
15571556
*/
1558-
static void cleanup_iothread_vq_mapping(IOThreadVirtQueueMappingList *list)
1557+
static void iothread_vq_mapping_cleanup(IOThreadVirtQueueMappingList *list)
15591558
{
15601559
IOThreadVirtQueueMappingList *node;
15611560

@@ -1597,7 +1596,7 @@ static bool virtio_blk_vq_aio_context_init(VirtIOBlock *s, Error **errp)
15971596
s->vq_aio_context = g_new(AioContext *, conf->num_queues);
15981597

15991598
if (conf->iothread_vq_mapping_list) {
1600-
if (!apply_iothread_vq_mapping(conf->iothread_vq_mapping_list,
1599+
if (!iothread_vq_mapping_apply(conf->iothread_vq_mapping_list,
16011600
s->vq_aio_context,
16021601
conf->num_queues,
16031602
errp)) {
@@ -1631,7 +1630,7 @@ static void virtio_blk_vq_aio_context_cleanup(VirtIOBlock *s)
16311630
assert(!s->ioeventfd_started);
16321631

16331632
if (conf->iothread_vq_mapping_list) {
1634-
cleanup_iothread_vq_mapping(conf->iothread_vq_mapping_list);
1633+
iothread_vq_mapping_cleanup(conf->iothread_vq_mapping_list);
16351634
}
16361635

16371636
if (conf->iothread) {

0 commit comments

Comments
 (0)