Skip to content

Commit

Permalink
Unreserve space if needed when the disk is full.
Browse files Browse the repository at this point in the history
  • Loading branch information
kr committed Sep 30, 2009
1 parent 96ad113 commit d7e6a0f
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions binlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,16 +531,21 @@ maintain_invariant(size_t n)

r = ensure_free_space(to_move);
if (r != to_move) {
/* TODO unreserve n bytes */
return twarnx("ensure_free_space"), 0;
twarnx("ensure_free_space");
if (newest_binlog->reserved >= n) {
newest_binlog->reserved -= n;
} else {
twarnx("failed to unreserve %zd bytes", n); /* can't happen */
}
return 0;
}

move_reserved(to_move, current_binlog, newest_binlog);
binlog_use_next();
}

/* Invariant 2. */

/* Invariant 2. */

z = sizeof(size_t) + sizeof(struct job);
reserved_later = current_binlog->reserved - n;
Expand All @@ -554,8 +559,13 @@ maintain_invariant(size_t n)

r = ensure_free_space(remainder);
if (r != remainder) {
/* TODO unreserve n bytes */
return twarnx("ensure_free_space"), 0;
twarnx("ensure_free_space");
if (newest_binlog->reserved >= n) {
newest_binlog->reserved -= n;
} else {
twarnx("failed to unreserve %zd bytes", n); /* can't happen */
}
return 0;
}
move_reserved(remainder, current_binlog, newest_binlog);

Expand Down

0 comments on commit d7e6a0f

Please sign in to comment.