From 36058cb1d7cbd4e9aa2dc199ff31e7173a4baefd Mon Sep 17 00:00:00 2001 From: Michael Nishimoto Date: Mon, 19 May 2008 16:34:20 +1000 Subject: [PATCH] --- yaml --- r: 107408 b: refs/heads/master c: d729eae8933cb3eb8edf1446532c178b66b293a9 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/xfs/xfs_log.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 11538ca7c901..4dde9c5bea3f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b41759cf11c84ad0d569c0ef200c449ad2cc24e3 +refs/heads/master: d729eae8933cb3eb8edf1446532c178b66b293a9 diff --git a/trunk/fs/xfs/xfs_log.c b/trunk/fs/xfs/xfs_log.c index 16a01abe2490..6195cc880101 100644 --- a/trunk/fs/xfs/xfs_log.c +++ b/trunk/fs/xfs/xfs_log.c @@ -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; } }