Skip to contentSkip to conversation

initialize sb->s_maxbytes

hugetlb William Lee Irwin III 1 participant 1 message Oct 8, 2004 HugeTLB

lore
Share & tools
lore
#0 lore raw

The following is included near-verbatim (reformatted) from a hugetlb feature request made of me. The request is perfectly reasonable and represents fixing what could probably be called a bug.

Apologies to Guy if cc:'ing on lkml threads is too verbose for him (there is at least an autoresponder, but hopefully that gets filtered).

akpm, please apply.

Quoted 17 lines · On Thu, Sep 30, 2004 at 05:30:29PM -0700, Cardwell Guy-PT2501 wrote:

Please excuse the intrusion and kindly refer me elsewhere if this question is inappropriate. My name is Guy Cardwell and I'm working
for Motorola in the area of biometrics. Though I'm not a kernel
hacker by trade, I've some experience and I'd like a pointer from you if I can get it.
A fingerprint search / match system I am working on has recently been modified to use Linux and hugetlbfs to hold very large ram resident databases of fingerprints.
One of the limitations I've run into is that as of kernel version 2.4.21, hugetblfs appears not to support the creation of files larger than 2GB. hugetlbfs_vmtruncate() checks against the s_maxbytes member of the super block and returns EFBIG if the requested file size is too large.
I think that s_maxbytes is getting its default value of MAX_NON_LFS from alloc_super() and hugetlbfs_fill_super() doesn't override that value. I looked over the rest of the hugetlbfs code, and I don't see a problem elsewhere with supporting huge files. I created a patch that

Quoted 8 lines

adds the line s_maxbytes=MAX_LFS_FILESIZE; to hugetlbfs_fill_super(), and that appears to do the trick in the kernel I built (i386, by the way). Does this seem right? Should this be a "real" kernel patch? Any suggestions / help are much appreciated.
Regards,
Guy Cardwell
Senior Research Engineer
Motorola ISD

fs/hugetlbfs/inode.c +1 -0
Index: mm3-2.6.9-rc3/fs/hugetlbfs/inode.c
===================================================================
@@ -653,6 +653,7 @@
 	sbinfo->free_blocks = config.nr_blocks;
 	sbinfo->max_inodes = config.nr_inodes;
 	sbinfo->free_inodes = config.nr_inodes;
+	sb->s_maxbytes = MAX_LFS_FILESIZE;
 	sb->s_blocksize = HPAGE_SIZE;
 	sb->s_blocksize_bits = HPAGE_SHIFT;
 	sb->s_magic = HUGETLBFS_MAGIC;