summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Kozina <okozina@redhat.com>2015-04-01 10:07:51 +0200
committerOndrej Kozina <okozina@redhat.com>2015-04-01 11:01:23 +0200
commit96c6251f0ff64d9823f26fb447129141ebf3fcf9 (patch)
tree151b21d159ff46c14d16adcf106a003a220f7572
parentff08f91e7b67af2722c71147e65c907015ab2ab7 (diff)
downloadlvm2-96c6251f0ff64d9823f26fb447129141ebf3fcf9.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 1b5c1a551..a09aa8607 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -485,7 +485,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);
}
@@ -503,12 +503,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);
@@ -522,8 +526,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;