[lvm-devel] master - poll: add stdout fflush after poll query

Zdenek Kabelac zkabelac at sourceware.org
Sat May 12 16:25:30 UTC 2018


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6740c78e838b0b2322097de307fb41f1eeb60839
Commit:        6740c78e838b0b2322097de307fb41f1eeb60839
Parent:        09fcc8eaa8eb7fa4fcd7c6611bfbfb83f726ae38
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Mon May 7 11:46:09 2018 +0200
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Sat May 12 11:30:05 2018 +0200

poll: add stdout fflush after poll query

ATM it's a bit ugly to enforce flushing of 'stdio' here, but works as quick
hot-fix.

log_print*() is using buffered I/O.

But for pooling with typical 1s interval this may take a while before
buffer about continues progress gets flushed.
So ATM fflush().

TODO: either add  log_print*_with_flush() or maybe directly use just
line buffering with log_print() and only log_debug() keep using buffered
I/O mode.
---
 tools/polldaemon.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index 020be21..05a4758 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -80,6 +80,8 @@ static int _check_lv_status(struct cmd_context *cmd,
 	}
 
 	progress = parms->poll_fns->poll_progress(cmd, lv, name, parms);
+	fflush(stdout);
+
 	if (progress == PROGRESS_CHECK_FAILED)
 		return_0;
 
@@ -448,6 +450,7 @@ static int _report_progress(struct cmd_context *cmd, struct poll_operation_id *i
 		ret = 0;
 		goto out;
 	}
+	fflush(stdout);
 
 	ret = 1;
 




More information about the lvm-devel mailing list