Skip to contentSkip to conversation

btrfs-progs: Adjust timing of safety delay countdown

PATCH Applied Noah Massey 2 participants 2 messages May 4, 2016 – May 5, 2016 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs-progs: Adjust timing of safety delay countdown

When printing the countdown in the safety delay, the number should correspond to the number of seconds remaining to wait at the time the delay is printed.

In other words, there should be a one second sleep after printing '1'.

---
 cmds-balance.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmds-balance.c +1 -1
index 5f05f60..8f3bf5b 100644
@@ -445,9 +445,9 @@ static int do_balance(const char *path, struct btrfs_ioctl_balance_args *args,
 		printf("\twarning. The operation will start in %d seconds.\n", delay);
 		printf("\tUse Ctrl-C to stop it.\n");
 		while (delay) {
-			sleep(1);
 			printf("%2d", delay--);
 			fflush(stdout);
+			sleep(1);
 		}
 		printf("\nStarting balance without any filters.\n");
 	}
Signature · 1 line
2.8.1
Applied
#1 lore raw
Quoted 7 lines · Noah Massey

When printing the countdown in the safety delay, the number should correspond to the number of seconds remaining to wait at the time the delay is printed.

In other words, there should be a one second sleep after printing '1'.

Applied, thanks.