Skip to contentSkip to conversation

fix xfs kernel so 2GiB logs work

PATCH In review Michael Nishimoto 2 participants 2 messages Apr 23, 2008 – Apr 24, 2008 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix xfs kernel so 2GiB logs work

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.

===========================================================

xfs_log.3.c 2008-04-01 11:56:53.000000000 -0700 renamed from xfs_log.2.c 2008-04-01 11:55:45.000000000 -0700 +12 -8
@@ -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;
        }
 }
#1 lore raw
Quoted 1 line · Michael Nishimoto

I hope that I've got everything now.

Almost ;)

xfs_log.3.c 2008-04-01 11:56:53.000000000 -0700

Quoted 10 lines

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.

===========================================================

xfs_log.3.c 2008-04-01 11:56:53.000000000 -0700 renamed from xfs_log.2.c 2008-04-01 11:55:45.000000000 -0700 +0 -0

We normally diff from the root of the kernel tree between a pristine tree and a modified tree such that:

fs/xfs/xfs_log.c 2008-04-24 10:39:15.696830268 +1000 renamed from fs/xfs/xfs_log.c 2008-04-23 09:31:29.000000000 +1000 +0 -0
@@ -226,20 +226,24 @@ xlog_grant_sub_space(struct log *log, in
 static void
 xlog_grant_add_space_write(struct log *log, int bytes)

....

is the path in the patch and you apply it via 'patch -p1 < file' in the root of the kernel tree.

xfs_log.3.c 2008-04-01 11:56:53.000000000 -0700 line 234

Quoted 6 lines
xfs_log.3.c 2008-04-01 11:56:53.000000000 -0700 renamed from xfs_log.2.c 2008-04-01 11:55:45.000000000 -0700 +0 -2
@@ -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) {

^^^^^^^

And it looks like your mailer has converted tabs to spaces.

Don't worry about either of those things for this patch, I've fixed them up when applying them to my test tree.

Cheers,

Dave.

Signature · 3 lines
Dave Chinner
Principal Engineer
SGI Australian Software Group