From: Andre Noll Date: Mon, 24 Aug 2009 08:34:46 +0000 (+0200) Subject: Move check for low disk space to try_to_free_disk_space(). X-Git-Tag: v0.1.4~24 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=a8e80f1cb5d4c7d4647f50a799e965137b5502a8;p=dss.git Move check for low disk space to try_to_free_disk_space(). The value is only used there, so move the check to this function. --- diff --git a/dss.c b/dss.c index 40eccab..d7d3e16 100644 --- a/dss.c +++ b/dss.c @@ -433,14 +433,19 @@ static int rename_incomplete_snapshot(int64_t start) return ret; } -static int try_to_free_disk_space(int low_disk_space) +static int try_to_free_disk_space(void) { int ret; struct snapshot_list sl; struct snapshot *victim; struct timeval now; const char *why; + int low_disk_space; + ret = disk_space_low(); + if (ret < 0) + return ret; + low_disk_space = ret; gettimeofday(&now, NULL); if (tv_diff(&next_removal_check, &now, NULL) > 0) return 0; @@ -1006,7 +1011,6 @@ static int select_loop(void) for (;;) { fd_set rfds; - int low_disk_space; struct timeval *tvp; if (remove_pid) @@ -1041,11 +1045,7 @@ static int select_loop(void) goto out; continue; } - ret = disk_space_low(); - if (ret < 0) - goto out; - low_disk_space = ret; - ret = try_to_free_disk_space(low_disk_space); + ret = try_to_free_disk_space(); if (ret < 0) goto out; if (snapshot_removal_status != HS_READY) {