• T
    bcache: fix I/O significant decline while backend devices registering · 94f71c16
    Tang Junhui 提交于
    I attached several backend devices in the same cache set, and produced lots
    of dirty data by running small rand I/O writes in a long time, then I
    continue run I/O in the others cached devices, and stopped a cached device,
    after a mean while, I register the stopped device again, I see the running
    I/O in the others cached devices dropped significantly, sometimes even
    jumps to zero.
    
    In currently code, bcache would traverse each keys and btree node to count
    the dirty data under read locker, and the writes threads can not get the
    btree write locker, and when there is a lot of keys and btree node in the
    registering device, it would last several seconds, so the write I/Os in
    others cached device are blocked and declined significantly.
    
    In this patch, when a device registering to a ache set, which exist others
    cached devices with running I/Os, we get the amount of dirty data of the
    device in an incremental way, and do not block other cached devices all the
    time.
    
    Patch v2: Rename some variables and macros name as Coly suggested.
    Signed-off-by: NTang Junhui <tang.junhui@zte.com.cn>
    Signed-off-by: NColy Li <colyli@suse.de>
    Signed-off-by: NJens Axboe <axboe@kernel.dk>
    94f71c16
writeback.c 20.0 KB