On Thursday 14 September 2006 00:13, Matti Aarnio wrote: > On Wed, Sep 13, 2006 at 09:53:25PM +1200, Charles Manning wrote: > > Hi > > > > I have a scenario where I need to use non-power-of-2 storage page sizes > > within a file system. > > > > If I just try something like > > > > my_page_offset = loff_t_offset / my_page_size; > > > > I get link errors because of a missing _divsi3. If nobody else is using > > _divsi3 then it is probably poor form to consider using it. My bad it is actually __divdi3. > > > > Questions: > > 1) Is there a safe/better way to divide loff_t by a value. > > 2) Is there a better way to do this sort of thing? Any examples where > > this kind of thing happen? > > The issue is that in the 32-bit intel processors the 64 bit division is > not a native thing, and instead is done by a libgcc intrinsics (_divsi3) Actually, the file system I work on is typically used with ARM processors, some or all of which don't even have a divide instruction. > > We have not wanted to have the arbitrary 64-bit division available within > the kernel because a) it is slow as hell, b) not having it will quickly > reveal places where coding is done for simplicity and not for performance. Thanx. I fully appreciate the reasons why this is done. > > With 64-bit x86-84 it would be native division.. > > The kernel does have almost arbitrary 64-bit division, that one is used by > kprintf() to convert binary values to text format. Search for do_div() I'll give that a try. -- CHarles - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html