[OpenAFS-devel] 1.3.86 LINUX largefile-support broken
Hartmut Reuter
reuter@rzg.mpg.de
Tue, 02 Aug 2005 15:07:16 +0200
Rainer Toebbicke wrote:
> chas williams - CONTRACTOR wrote:
>
>> In message <42EE0716.4000102@rzg.mpg.de>,Hartmut Reuter writes:
>>
>>> 3 gb is under the 32bit line! if you try to write a 5 gb file you
>>> will see that this doesn't work correctly. It overwrites the begin of
>>> the file with the part beyond the 4gb-line!
>>
>>
>>
>> try this patch. it looks like shifting pp->index is an unsigned long.
>> the shift is probably wrapping. page_offset() casts it to loff_t before
>> shifting. not sure when page_offset() came into existence.
>>
>> Index: src/afs/LINUX/osi_vnodeops.c
>> ===================================================================
>> RCS file: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v
>> retrieving revision 1.112
>> diff -u -u -r1.112 osi_vnodeops.c
>> --- src/afs/LINUX/osi_vnodeops.c 26 Jul 2005 17:39:00 -0000 1.112
>> +++ src/afs/LINUX/osi_vnodeops.c 1 Aug 2005 13:36:33 -0000
>> @@ -1263,7 +1267,7 @@
>> cred_t *credp = crref();
>> #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
>> char *address;
>> - afs_offs_t offset = pp->index << PAGE_CACHE_SHIFT;
>> + afs_offs_t offset = page_offset(pp);
>> #else
>> ulong address = afs_linux_page_address(pp);
>> afs_offs_t offset = pageoff(pp);
>> @@ -1359,7 +1362,7 @@
>> int f_flags = 0;
>>
>> buffer = kmap(pp) + offset;
>> - base = (pp->index << PAGE_CACHE_SHIFT) + offset;
>> + base = page_offset(pp) + offset;
>>
>> credp = crref();
>> lock_kernel();
>
>
> On my 2.6.9-11.ELsmp x86_64 test machine this just leads to "kernel:
> libafs: Unknown symbol page_offset" when loading.
>
> page_offset is defined in linux/nfs_fs.h (and yes the BIG difference
> seems to be the loff_t cast) which should probably be included - but
> does it exist for all kernels?
>
> --- openafs/src/afs/LINUX/osi_vnodeops.c.old 2005-08-02
> 10:42:25.000000000 +0200
> +++ openafs/src/afs/LINUX/osi_vnodeops.c 2005-08-02
> 13:00:50.000000000 +0200
> @@ -34,6 +34,7 @@
> #include "h/pagemap.h"
> #if defined(AFS_LINUX24_ENV)
> #include "h/smp_lock.h"
> +#include "linux/nfs_fs.h"
> #endif
> #if defined(AFS_LINUX26_ENV)
> #include "h/writeback.h"
>
> (no time to test the 3G, 5G cases yet, though...)
>
Well, I have now after Rainer's patch been able to write and read a 5 gb
file and it seems to work. But I am not sure that all kernel versions
support this. Therefor 5 years ago I chose this - may be ugly or
complicated - code to have large file support under linux which always
worked.
Hartmut
-----------------------------------------------------------------
Hartmut Reuter e-mail reuter@rzg.mpg.de
phone +49-89-3299-1328
RZG (Rechenzentrum Garching) fax +49-89-3299-1301
Computing Center of the Max-Planck-Gesellschaft (MPG) and the
Institut fuer Plasmaphysik (IPP)
-----------------------------------------------------------------