[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 24/45] blockdev: transactions: rename some things
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v4 24/45] blockdev: transactions: rename some things |
Date: |
Tue, 29 Mar 2022 23:40:46 +0300 |
Look at qmp_transaction(): dev_list is not obvious name for list of
actions. Let's look at qapi spec, this argument is "actions". Let's
follow the common practice of using same argument names in qapi scheme
and code.
To be honest, rename props to properties for same reason.
Next, we have to rename global map of actions, to not conflict with new
name for function argument.
Rename also dev_entry loop variable accordingly to new name of the
list.
Signed-off-by: Vladimir Sementsov-Ogievskiy <v.sementsov-og@mail.ru>
---
blockdev.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 65f01a31d1..8afd769bc4 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2276,7 +2276,7 @@ static void abort_commit(void *opaque)
g_assert_not_reached(); /* this action never succeeds */
}
-static const BlkActionOps actions[] = {
+static const BlkActionOps actions_map[] = {
[TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT] = {
.instance_size = sizeof(ExternalSnapshotState),
.action = external_snapshot_action,
@@ -2356,12 +2356,12 @@ static TransactionProperties
*get_transaction_properties(
* 'Atomic' group operations. The operations are performed as a set, and if
* any fail then we roll back all operations in the group.
*/
-void qmp_transaction(TransactionActionList *dev_list,
- bool has_props,
- struct TransactionProperties *props,
+void qmp_transaction(TransactionActionList *actions,
+ bool has_properties,
+ struct TransactionProperties *properties,
Error **errp)
{
- TransactionActionList *dev_entry = dev_list;
+ TransactionActionList *act = actions;
JobTxn *block_job_txn = NULL;
Error *local_err = NULL;
Transaction *tran = tran_new();
@@ -2369,8 +2369,8 @@ void qmp_transaction(TransactionActionList *dev_list,
/* Does this transaction get canceled as a group on failure?
* If not, we don't really need to make a JobTxn.
*/
- props = get_transaction_properties(props);
- if (props->completion_mode != ACTION_COMPLETION_MODE_INDIVIDUAL) {
+ properties = get_transaction_properties(properties);
+ if (properties->completion_mode != ACTION_COMPLETION_MODE_INDIVIDUAL) {
block_job_txn = job_txn_new();
}
@@ -2378,24 +2378,24 @@ void qmp_transaction(TransactionActionList *dev_list,
bdrv_drain_all();
/* We don't do anything in this loop that commits us to the operations */
- while (NULL != dev_entry) {
+ while (NULL != act) {
TransactionAction *dev_info = NULL;
const BlkActionOps *ops;
BlkActionState *state;
- dev_info = dev_entry->value;
- dev_entry = dev_entry->next;
+ dev_info = act->value;
+ act = act->next;
- assert(dev_info->type < ARRAY_SIZE(actions));
+ assert(dev_info->type < ARRAY_SIZE(actions_map));
- ops = &actions[dev_info->type];
+ ops = &actions_map[dev_info->type];
assert(ops->instance_size > 0);
state = g_malloc0(ops->instance_size);
state->ops = ops;
state->action = dev_info;
state->block_job_txn = block_job_txn;
- state->txn_props = props;
+ state->txn_props = properties;
state->ops->action(state, tran, &local_err);
if (local_err) {
@@ -2413,8 +2413,8 @@ delete_and_fail:
/* failure, and it is all-or-none; roll back all operations */
tran_abort(tran);
exit:
- if (!has_props) {
- qapi_free_TransactionProperties(props);
+ if (!has_properties) {
+ qapi_free_TransactionProperties(properties);
}
job_txn_unref(block_job_txn);
}
--
2.35.1
- [PATCH v4 14/45] block/snapshot: drop indirection around bdrv_snapshot_fallback_ptr, (continued)
- [PATCH v4 14/45] block/snapshot: drop indirection around bdrv_snapshot_fallback_ptr, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 15/45] block: refactor bdrv_remove_file_or_backing_child to bdrv_remove_child, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 16/45] block: drop bdrv_detach_child(), Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 17/45] block: drop bdrv_remove_filter_or_cow_child, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 18/45] block: bdrv_refresh_perms(): allow external tran, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 19/45] block: refactor bdrv_list_refresh_perms to allow any list of nodes, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 20/45] block: make permission update functions public, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 21/45] block: add bdrv_try_set_aio_context_tran transaction action, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 22/45] block: implemet bdrv_unref_tran(), Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 23/45] blockdev: refactor transaction to use Transaction API, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 24/45] blockdev: transactions: rename some things,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v4 25/45] blockdev: qmp_transaction: refactor loop to classic for, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 26/45] blockdev: transaction: refactor handling transaction properties, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 27/45] blockdev: qmp_transaction: drop extra generic layer, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 29/45] block: introduce BDRV_O_NOPERM flag, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 28/45] qapi: block: add blockdev-del transaction action, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 31/45] qapi: block: add blockdev-add transaction action, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 30/45] block: bdrv_insert_node(): use BDRV_O_NOPERM, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 32/45] iotests: add blockdev-add-transaction, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 33/45] block-backend: blk_root(): drop const specifier on return type, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 34/45] block/export: add blk_by_export_id(), Vladimir Sementsov-Ogievskiy, 2022/03/29