• Hugh Dickins's avatar
    shmem: respect MAX_LFS_FILESIZE · caefba17
    Hugh Dickins authored
    SHMEM_MAX_BYTES was derived from the maximum size of its triple-indirect
    swap vector, forgetting to take the MAX_LFS_FILESIZE limit into account.
    Never mind 256kB pages, even 8kB pages on 32-bit kernels allowed files to
    grow slightly bigger than that supposed maximum.
    Fix this by using the min of both (at build time not run time).  And it
    happens that this calculation is good as far as 8MB pages on 32-bit or
    16MB pages on 64-bit: though SHMSWP_MAX_INDEX gets truncated before that,
    it's truncated to such large numbers that we don't need to care.
    [akpm@linux-foundation.org: it needs pagemap.h]
    [akpm@linux-foundation.org: fix sparc64 min() warnings]
    Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
    Cc: Yuri Tikhonov <yur@emcraft.com>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Randy Dunlap <randy.dunlap@oracle.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
shmem.c 68.9 KB