aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Nishimoto <miken@agami.com>2008-05-19 16:34:20 +1000
committerNiv Sardi <xaiki@debian.org>2008-07-28 16:58:11 +1000
commitd729eae8933cb3eb8edf1446532c178b66b293a9 (patch)
tree6cabfe6889c740a12c663dc01152c7d8cfe867e5
parentb41759cf11c84ad0d569c0ef200c449ad2cc24e3 (diff)
downloadkernel_samsung_crespo-d729eae8933cb3eb8edf1446532c178b66b293a9.zip
kernel_samsung_crespo-d729eae8933cb3eb8edf1446532c178b66b293a9.tar.gz
kernel_samsung_crespo-d729eae8933cb3eb8edf1446532c178b66b293a9.tar.bz2
[XFS] Ensure that 2 GiB xfs logs work properly.
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>
-rw-r--r--fs/xfs/xfs_log.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 16a01ab..6195cc8 100644
--- a/fs/xfs/xfs_log.c
+++ b/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;
}
}