summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Kozina <okozina@redhat.com>2015-04-01 10:07:51 +0200
committerOndrej Kozina <okozina@redhat.com>2015-05-07 15:50:28 +0200
commit132b1ebff112a5c297a9de6be0e3e585e8d2f4f6 (patch)
tree31f82da34f7f0a6343487b1b858958d96704d197
parent570f90541041312e6c7c5865fd20f5f2947911f1 (diff)
downloadlvm2-132b1ebff112a5c297a9de6be0e3e585e8d2f4f6.tar.gz
polldaemon: few optimizations for lvmpolld polling
- always perform --abort with interval set to zero - do not read LV status for abort operations (less locking)
-rw-r--r--tools/polldaemon.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index 6107947c9..6be24a67f 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -483,7 +483,7 @@ static void _lvmpolld_poll_for_all_vgs(struct cmd_context *cmd,
&finished);
if (!r || finished)
dm_list_del(&idl->list);
- else
+ else if (!parms->aborting)
report_progress(cmd, idl->id, lpdp.parms);
}
@@ -501,12 +501,16 @@ static int _lvmpoll_daemon(struct cmd_context *cmd, struct poll_operation_id *id
struct processing_handle *handle = NULL;
unsigned finished = 0;
+ if (parms->aborting)
+ parms->interval = 0;
+
if (id) {
r = lvmpolld_poll_init(cmd, id, parms);
if (r && !parms->background) {
while (1) {
if (!(r = lvmpolld_request_info(id, parms, &finished)) ||
- finished || !(r = report_progress(cmd, id, parms)))
+ finished ||
+ (!parms->aborting && !(r = report_progress(cmd, id, parms))))
break;
_nanosleep(parms->interval, 0);
@@ -520,8 +524,6 @@ static int _lvmpoll_daemon(struct cmd_context *cmd, struct poll_operation_id *id
log_error("Failed to initialize processing handle.");
return ECMD_FAILED;
} else {
- if (parms->aborting)
- parms->interval = 0;
_lvmpolld_poll_for_all_vgs(cmd, parms, handle);
destroy_processing_handle(cmd, handle);
return ECMD_PROCESSED;