xfs
[Top] [All Lists]

Re: do_div breakage?

To: Daniel Moore <dxm@xxxxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: do_div breakage?
From: Steve Lord <lord@xxxxxxx>
Date: Thu, 10 Aug 2000 13:01:51 -0500
Cc: linux-xfs@xxxxxxxxxxx
In-reply-to: Message from Daniel Moore <dxm@clouds.melbourne.sgi.com> of "Thu, 10 Aug 2000 11:39:30 +1000." <200008100139.LAA92311@clouds.melbourne.sgi.com>
Sender: owner-linux-xfs@xxxxxxxxxxx
It looks like you must have undefined XFS_BIG_FILES somewhere, a real
fix for this issue involves making the do_div macro compile time
sensitive to the variables it is dealing with - which since you
cannot do sizeof at compile time means some runtime logic for a
compile time change - or I wade through all the calls again changing
the macros which are executing on specific types to ones with different
names so we can make the compile time decision.

Steve

> 
> 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>