• Vladimir Davydov's avatar
    cleancache: remove limit on the number of cleancache enabled filesystems · 3cb29d11
    Vladimir Davydov authored
    The limit equals 32 and is imposed by the number of entries in the
    fs_poolid_map and shared_fs_poolid_map.  Nowadays it is insufficient,
    because with containers on board a Linux host can have hundreds of
    active fs mounts.
    
    These maps were introduced by commit 49a9ab81
    
     ("mm: cleancache:
    lazy initialization to allow tmem backends to build/run as modules") in
    order to allow compiling cleancache drivers as modules.  Real pool ids
    are stored in these maps while super_block->cleancache_poolid points to
    an entry in the map, so that on cleancache registration we can walk over
    all (if there are <= 32 of them, of course) cleancache-enabled super
    blocks and assign real pool ids.
    
    Actually, there is absolutely no need in these maps, because we can
    iterate over all super blocks immediately using iterate_supers.  This is
    not racy, because cleancache_init_ops is called from mount_fs with
    super_block->s_umount held for writing, while iterate_supers takes this
    semaphore for reading, so if we call iterate_supers after setting
    cleancache_ops, all super blocks that had been created before
    cleancache_register_ops was called will be assigned pool ids by the
    action function of iterate_supers while all newer super blocks will
    receive it in cleancache_init_fs.
    
    This patch therefore removes the maps and hence the artificial limit on
    the number of cleancache enabled filesystems.
    
    Signed-off-by: default avatarVladimir Davydov <vdavydov@parallels.com>
    Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Cc: David Vrabel <david.vrabel@citrix.com>
    Cc: Mark Fasheh <mfasheh@suse.com>
    Cc: Joel Becker <jlbec@evilplan.org>
    Cc: Stefan Hengelein <ilendir@googlemail.com>
    Cc: Florian Schmaus <fschmaus@gmail.com>
    Cc: Andor Daam <andor.daam@googlemail.com>
    Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
    Cc: Bob Liu <lliubbo@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    3cb29d11