Re: Dividing a loff_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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.

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

 
> BTW: Yes, I know there are going to be performance issues etc due to alignment 
> issues between the Linux page cache and "my pages". I have a plan to deal 
> with that.
> 
> 
> TIA
> -- Charles

/Matti Aarnio
-
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

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux