xfs
[Top] [All Lists]

[PATCH] fix xfs kernel so 2GiB logs work

To: XFS Mailing List <xfs@xxxxxxxxxxx>
Subject: [PATCH] fix xfs kernel so 2GiB logs work
From: Michael Nishimoto <miken@xxxxxxxxx>
Date: Wed, 23 Apr 2008 16:35:06 -0700
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mail/News 1.5.0.4 (X11/20060629)
I hope that I've got everything now.

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.

Signed-off-by: Michael Nishimoto <miken@xxxxxxxxx>
===========================================================
--- xfs_log.2.c 2008-04-01 11:55:45.000000000 -0700
+++ xfs_log.3.c 2008-04-01 11:56:53.000000000 -0700
@@ -230,20 +230,24 @@
 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;
-               log->l_grant_write_cycle++;
+       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;
-               log->l_grant_reserve_cycle++;
+       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;
        }
 }


<Prev in Thread] Current Thread [Next in Thread>