From: Hannes Reinecke <hare@suse.de>
To: Christophe Varoqui <christophe.varoqui@gmail.com>
Cc: Hannes Reinecke <hare@suse.com>, dm-devel@redhat.com
Subject: [PATCH 3/6] Remove 'udev_sync' argument from dm_simplecmd()
Date: Wed, 4 May 2016 07:57:27 +0200 [thread overview]
Message-ID: <1462341450-5507-4-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1462341450-5507-1-git-send-email-hare@suse.de>
The 'udev_sync' attribute is pointless without a cookie, so we
can as well use the existence of the 'cookie' argument for
the same function.
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
libmultipath/devmapper.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index ab71fda..9facbb9 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -207,12 +207,10 @@ dm_prereq (void)
#define do_deferred(x) ((x) == DEFERRED_REMOVE_ON || (x) == DEFERRED_REMOVE_IN_PROGRESS)
static int
-dm_simplecmd (int task, const char *name, int no_flush, int need_sync,
+dm_simplecmd (int task, const char *name, int no_flush,
uint16_t udev_flags, int deferred_remove, uint32_t *cookie)
{
int r = 0;
- int udev_wait_flag = (need_sync && (task == DM_DEVICE_RESUME ||
- task == DM_DEVICE_REMOVE));
struct dm_task *dmt;
if (!(dmt = dm_task_create (task)))
@@ -231,7 +229,7 @@ dm_simplecmd (int task, const char *name, int no_flush, int need_sync,
if (do_deferred(deferred_remove))
dm_task_deferred_remove(dmt);
#endif
- if (udev_wait_flag &&
+ if (cookie &&
!dm_task_set_cookie(dmt, cookie,
DM_UDEV_DISABLE_LIBRARY_FALLBACK | udev_flags)) {
dm_udev_complete(*cookie);
@@ -239,7 +237,7 @@ dm_simplecmd (int task, const char *name, int no_flush, int need_sync,
}
r = dm_task_run (dmt);
- if (udev_wait_flag) {
+ if (cookie) {
if (!r)
dm_udev_complete(*cookie);
else
@@ -254,22 +252,27 @@ extern int
dm_simplecmd_flush (int task, const char *name, uint16_t udev_flags) {
uint32_t cookie = 0;
- return dm_simplecmd(task, name, 0, 1, udev_flags, 0, &cookie);
+ if (task == DM_DEVICE_RESUME ||
+ task == DM_DEVICE_REMOVE)
+ return dm_simplecmd(task, name, 0, udev_flags, 0, &cookie);
+ else
+ return dm_simplecmd(task, name, 0, udev_flags, 0, NULL);
}
extern int
dm_simplecmd_noflush (int task, const char *name, int needsync, uint16_t udev_flags) {
uint32_t cookie = 0;
- return dm_simplecmd(task, name, 1, needsync, udev_flags, 0, &cookie);
+ return dm_simplecmd(task, name, 1, udev_flags, 0,
+ needsync ? &cookie : NULL);
}
static int
dm_device_remove (const char *name, int needsync, int deferred_remove) {
uint32_t cookie = 0;
- return dm_simplecmd(DM_DEVICE_REMOVE, name, 0, needsync, 0,
- deferred_remove, &cookie);
+ return dm_simplecmd(DM_DEVICE_REMOVE, name, 0, 0,
+ deferred_remove, needsync ? &cookie : NULL);
}
static int
--
2.6.6
next prev parent reply other threads:[~2016-05-04 5:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-04 5:57 [PATCH 0/6] multipath cookie handling rework Hannes Reinecke
2016-05-04 5:57 ` [PATCH 1/6] libmultipath: pass in cookie as argument for dm_simplecmd() Hannes Reinecke
2016-05-06 19:06 ` Benjamin Marzinski
2016-05-04 5:57 ` [PATCH 2/6] libmultipath: pass in 'cookie' as argument for dm_addmap() Hannes Reinecke
2016-05-06 19:27 ` Benjamin Marzinski
2016-05-04 5:57 ` Hannes Reinecke [this message]
2016-05-06 19:50 ` [PATCH 3/6] Remove 'udev_sync' argument from dm_simplecmd() Benjamin Marzinski
2016-05-04 5:57 ` [PATCH 4/6] libmultipath: Fixup 'DM_DEVICE_RELOAD' handling Hannes Reinecke
2016-05-06 20:12 ` Benjamin Marzinski
2016-05-09 10:26 ` Hannes Reinecke
2016-05-09 14:56 ` Benjamin Marzinski
2016-05-04 5:57 ` [PATCH 5/6] devmapper: do not flush I/O for DM_DEVICE_CREATE Hannes Reinecke
2016-05-06 20:18 ` Benjamin Marzinski
2016-05-04 5:57 ` [PATCH 6/6] libmultipath: fixup dm_rename to complete cookie on failure Hannes Reinecke
2016-05-06 20:29 ` Benjamin Marzinski
2016-05-06 21:59 ` Alasdair G Kergon
2016-05-06 22:45 ` Benjamin Marzinski
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=1462341450-5507-4-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=christophe.varoqui@gmail.com \
--cc=dm-devel@redhat.com \
--cc=hare@suse.com \
/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.