Whamcloud - gitweb
LU-13197 e2fsck: reduce memory usage for directories 43/37443/6
authorAndreas Dilger <adilger@whamcloud.com>
Wed, 5 Feb 2020 04:59:26 +0000 (21:59 -0700)
committerAndreas Dilger <adilger@whamcloud.com>
Sun, 24 May 2020 05:48:12 +0000 (05:48 +0000)
commit4eaf6ab403bbcab0036938ad1a6b9ec6d69734a0
tree134ceceae14a210866e986e071ae457c9992fc12
parentf4f013381df959141803cadd709d2301c176a204
LU-13197 e2fsck: reduce memory usage for directories

Pack struct dx_dir_info and dx_dirblock_info properly in memory, to
avoid holes, and fields are not larger than necessary.  This reduces
the memory needed for each hashed dir, according to pahole(1) from:

    struct dx_dir_info {
        /* size: 32, cachelines: 1, members: 6 */
        /* sum members: 26, holes: 1, sum holes: 2 */
        /* padding: 4 */
    };

    struct dx_dirblock_info {
        /* size: 56, cachelines: 1, members: 9 */
        /* sum members: 48, holes: 2, sum holes: 8 */
        /* last cacheline: 56 bytes */
    };

to 8 bytes less for each directory and directory block, and leaves
space for future use if needed (e.g. larger numblocks):

    struct dx_dir_info {
        /* size: 24, cachelines: 1, members: 6 */
        /* sum members: 20, holes: 1, sum holes: 4 */
        /* bit holes: 1, sum bit holes: 7 bits */
    };

    struct dx_dirblock_info {
        /* size: 48, cachelines: 1, members: 9 */
    };

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ibe19e9f7e6edb3df7029fffe5e2cecc68c3ebbe5
Reviewed-on: https://review.whamcloud.com/37443
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
e2fsck/dx_dirinfo.c
e2fsck/e2fsck.h
e2fsck/pass2.c