All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vladimir.sementsov-ogievskiy@openvz.org>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, v.sementsov-og@mail.ru, qemu-devel@nongnu.org,
	Markus Armbruster <armbru@redhat.com>,
	hreitz@redhat.com, vsementsov@openvz.org
Subject: [PATCH v5 24/45] blockdev: transactions: rename some things
Date: Thu, 31 Mar 2022 00:28:41 +0300	[thread overview]
Message-ID: <20220330212902.590099-25-vsementsov@openvz.org> (raw)
In-Reply-To: <20220330212902.590099-1-vsementsov@openvz.org>

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 <vsementsov@openvz.org>
---
 blockdev.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index a9fb5f66b0..177f3ff989 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2299,7 +2299,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,
@@ -2381,12 +2381,12 @@ static TransactionProperties *get_transaction_properties(
  *
  * Always run under BQL.
  */
-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();
@@ -2396,8 +2396,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();
     }
 
@@ -2405,24 +2405,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) {
@@ -2440,8 +2440,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



  parent reply	other threads:[~2022-03-30 23:51 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30 21:28 [PATCH v5 00/45] Transactional block-graph modifying API Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 01/45] block: BlockDriver: add .filtered_child_is_backing field Vladimir Sementsov-Ogievskiy
2022-06-07  9:57   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 02/45] block: introduce bdrv_open_file_child() helper Vladimir Sementsov-Ogievskiy
2022-06-07  9:57   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 03/45] block/blklogwrites: don't care to remove bs->file child on failure Vladimir Sementsov-Ogievskiy
2022-06-07 10:05   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 04/45] test-bdrv-graph-mod: update test_parallel_perm_update test case Vladimir Sementsov-Ogievskiy
2022-06-07 10:53   ` Hanna Reitz
2022-06-09 13:08     ` Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 05/45] tests-bdrv-drain: bdrv_replace_test driver: declare supports_backing Vladimir Sementsov-Ogievskiy
2022-06-07 10:59   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 06/45] test-bdrv-graph-mod: fix filters to be filters Vladimir Sementsov-Ogievskiy
2022-06-07 11:22   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 07/45] block: document connection between child roles and bs->backing/bs->file Vladimir Sementsov-Ogievskiy
2022-06-07 12:11   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 08/45] block/snapshot: stress that we fallback to primary child Vladimir Sementsov-Ogievskiy
2022-06-07 13:42   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 09/45] Revert "block: Let replace_child_noperm free children" Vladimir Sementsov-Ogievskiy
2022-06-07 14:03   ` Hanna Reitz
2022-06-07 15:09     ` Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 10/45] Revert "block: Let replace_child_tran keep indirect pointer" Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 11/45] Revert "block: Restructure remove_file_or_backing_child()" Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 12/45] Revert "block: Pass BdrvChild ** to replace_child_noperm" Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 13/45] block: Manipulate bs->file / bs->backing pointers in .attach/.detach Vladimir Sementsov-Ogievskiy
2022-06-07 15:55   ` Hanna Reitz
2022-06-09 13:40     ` Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 14/45] block/snapshot: drop indirection around bdrv_snapshot_fallback_ptr Vladimir Sementsov-Ogievskiy
2022-06-07 15:58   ` Hanna Reitz
2022-06-09 14:44     ` Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 15/45] block: refactor bdrv_remove_file_or_backing_child to bdrv_remove_child Vladimir Sementsov-Ogievskiy
2022-06-08 10:04   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 16/45] block: drop bdrv_detach_child() Vladimir Sementsov-Ogievskiy
2022-06-08 10:22   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 17/45] block: drop bdrv_remove_filter_or_cow_child Vladimir Sementsov-Ogievskiy
2022-06-08 10:40   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 18/45] block: bdrv_refresh_perms(): allow external tran Vladimir Sementsov-Ogievskiy
2022-06-08 10:57   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 19/45] block: refactor bdrv_list_refresh_perms to allow any list of nodes Vladimir Sementsov-Ogievskiy
2022-06-08 11:27   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 20/45] block: make permission update functions public Vladimir Sementsov-Ogievskiy
2022-06-08 11:31   ` Hanna Reitz
2022-03-30 21:28 ` [PATCH v5 21/45] block: add bdrv_try_set_aio_context_tran transaction action Vladimir Sementsov-Ogievskiy
2022-06-08 11:49   ` Hanna Reitz
2022-06-09 14:56     ` Vladimir Sementsov-Ogievskiy
2022-06-13  7:12       ` Hanna Reitz
2022-06-13  7:46   ` Hanna Reitz
2022-06-20 20:57     ` Vladimir Sementsov-Ogievskiy
2022-06-21 11:04       ` Hanna Reitz
2022-06-21 11:44         ` Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 22/45] block: implemet bdrv_unref_tran() Vladimir Sementsov-Ogievskiy
2022-06-13  9:07   ` Hanna Reitz
2022-06-20 21:16     ` Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 23/45] blockdev: refactor transaction to use Transaction API Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` Vladimir Sementsov-Ogievskiy [this message]
2022-03-30 21:28 ` [PATCH v5 25/45] blockdev: qmp_transaction: refactor loop to classic for Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 26/45] blockdev: transaction: refactor handling transaction properties Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 27/45] blockdev: qmp_transaction: drop extra generic layer Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 28/45] qapi: block: add blockdev-del transaction action Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 29/45] block: introduce BDRV_O_NOPERM flag Vladimir Sementsov-Ogievskiy
2022-06-13  9:54   ` Hanna Reitz
2022-06-21 12:11     ` Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 30/45] block: bdrv_insert_node(): use BDRV_O_NOPERM Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 31/45] qapi: block: add blockdev-add transaction action Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 32/45] iotests: add blockdev-add-transaction Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 33/45] block-backend: blk_root(): drop const specifier on return type Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 34/45] block/export: add blk_by_export_id() Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 35/45] block: make bdrv_find_child() function public Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 36/45] block: bdrv_replace_child_bs(): move to external transaction Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 37/45] qapi: add x-blockdev-replace command Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 38/45] qapi: add x-blockdev-replace transaction action Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 39/45] block: bdrv_get_xdbg_block_graph(): report export ids Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 40/45] iotests.py: qemu_img_create: use imgfmt by default Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 41/45] iotests.py: introduce VM.assert_edges_list() method Vladimir Sementsov-Ogievskiy
2022-03-30 21:28 ` [PATCH v5 42/45] iotests.py: add VM.qmp_check() helper Vladimir Sementsov-Ogievskiy
2022-03-30 21:29 ` [PATCH v5 43/45] iotests: add filter-insertion Vladimir Sementsov-Ogievskiy
2022-03-30 21:29 ` [PATCH v5 44/45] block: bdrv_open_inherit: create BlockBackend only when necessary Vladimir Sementsov-Ogievskiy
2022-03-30 21:29 ` [PATCH v5 45/45] block/copy-before-write: correct permission scheme Vladimir Sementsov-Ogievskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220330212902.590099-25-vsementsov@openvz.org \
    --to=vladimir.sementsov-ogievskiy@openvz.org \
    --cc=armbru@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=v.sementsov-og@mail.ru \
    --cc=vsementsov@openvz.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.