Skip to content

Commit

Permalink
[XFS] Ensure that 2 GiB xfs logs work properly.
Browse files Browse the repository at this point in the history
We found this while experimenting with 2GiB xfs logs. The previous code
never assumed that xfs logs would ever get so large.

SGI-PV: 981502
SGI-Modid: xfs-linux-melb:xfs-kern:31058a

Signed-off-by: Michael Nishimoto <miken@agami.com>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
  • Loading branch information
Michael Nishimoto authored and Niv Sardi committed Jul 28, 2008
1 parent b41759c commit d729eae
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions fs/xfs/xfs_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,20 +226,24 @@ xlog_grant_sub_space(struct log *log, int bytes)
static void
xlog_grant_add_space_write(struct log *log, int bytes)
{
log->l_grant_write_bytes += bytes;
if (log->l_grant_write_bytes > log->l_logsize) {
log->l_grant_write_bytes -= log->l_logsize;
int tmp = log->l_logsize - log->l_grant_write_bytes;
if (tmp > bytes)
log->l_grant_write_bytes += bytes;
else {
log->l_grant_write_cycle++;
log->l_grant_write_bytes = bytes - tmp;
}
}

static void
xlog_grant_add_space_reserve(struct log *log, int bytes)
{
log->l_grant_reserve_bytes += bytes;
if (log->l_grant_reserve_bytes > log->l_logsize) {
log->l_grant_reserve_bytes -= log->l_logsize;
int tmp = log->l_logsize - log->l_grant_reserve_bytes;
if (tmp > bytes)
log->l_grant_reserve_bytes += bytes;
else {
log->l_grant_reserve_cycle++;
log->l_grant_reserve_bytes = bytes - tmp;
}
}

Expand Down

0 comments on commit d729eae

Please sign in to comment.