xfs
[Top] [All Lists]

do_div breakage?

To: lord@xxxxxxx
Subject: do_div breakage?
From: Daniel Moore <dxm@xxxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 10 Aug 2000 11:39:30 +1000
Cc: linux-xfs@xxxxxxxxxxx
Sender: owner-linux-xfs@xxxxxxxxxxx
With t-o-t XFS etc, I can trip an assert just by copying
a decent size file onto an empty XFS filesystem. Puzzlingly,
this doesn't happen for Nathan, running almost exactly the
same setup.

The assert in question is the "indlen > 0" one mentioned
recently:

XFS assertion failed: indlen > 0, file: xfs_bmap.c, line: 4921
kernel BUG at xfs_debug.c:50!

I've poked around a bit, and the problem appears to be with the
do_div call. This debug output shows the divides being done,
the expected answer and the actual answer ie 269 div 254 actually
equals 1 but do_div says 12755248.

It's downhill from there, as you might expect.

DXM 269 / 254 = 1
DXM   = 12755248
DXM 12755501 / 254 = 50218
DXM   = 0
DXM 253 / 254 = 0
DXM   = 0
DXM 253 / 254 = 0
DXM   = 0
DXM 253 / 254 = 0
DXM   = 0
DXM xfs_bmap_worst_indlen return 12755248
DXM 269 / 254 = 1
DXM   = 0
DXM 253 / 254 = 0
DXM   = 0
DXM 253 / 254 = 0
DXM   = 0
DXM 253 / 254 = 0
DXM   = 0
DXM 253 / 254 = 0
DXM   = 0
DXM xfs_bmap_worst_indlen return 0
XFS assertion failed: indlen > 0, file: xfs_bmap.c, line: 4921
kernel BUG at xfs_debug.c:50!

I was under the impression that do_div was a 64 bit thing, but
in my case at least, xfs_filblks_t is _32_ bits, and I'm
guessing the cause of the problems here.

If I replace the call do do_div in xfs_bmap_worst_indlen
with a normal divide, everything's peachy again:

...
DXM 269 / 254 = 1
DXM   = 1
DXM xfs_bmap_worst_indlen return 5 (1)
DXM 557 / 254 = 2
DXM   = 2
DXM 255 / 254 = 1
DXM   = 1
DXM xfs_bmap_worst_indlen return 6 (1)
...

-----------------------------------------------------
 Daniel Moore                  dxm@xxxxxxx
 R&D Software Engineer         Phone: +61-3-98348209
 SGI Performance Tools Group   Fax:   +61-3-98132378
-----------------------------------------------------


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