• Coly Li's avatar
    bcache: not use hard coded memset size in bch_cache_accounting_clear() · 83ff9318
    Coly Li authored
    In stats.c:bch_cache_accounting_clear(), a hard coded number '7' is
    used in memset(). It is because in struct cache_stats, there are 7
    atomic_t type members. This is not good when new members added into
    struct stats, the hard coded number will only clear part of memory.
    
    This patch replaces 'sizeof(unsigned long) * 7' by more generic
    'sizeof(struct cache_stats))', to avoid potential error if new
    member added into struct cache_stats.
    Signed-off-by: default avatarColy Li <colyli@suse.de>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    83ff9318
stats.c 6.52 KB