• Mikulas Patocka's avatar
    dm: unplug queues in threads · 7ff14a36
    Mikulas Patocka authored
    Remove an avoidable 3ms delay on some dm-raid1 and kcopyd I/O.
    
    It is specified that any submitted bio without BIO_RW_SYNC flag may plug the
    queue (i.e. block the requests from being dispatched to the physical device).
    
    The queue is unplugged when the caller calls blk_unplug() function. Usually, the
    sequence is that someone calls submit_bh to submit IO on a buffer. The IO plugs
    the queue and waits (to be possibly joined with other adjacent bios). Then, when
    the caller calls wait_on_buffer(), it unplugs the queue and submits the IOs to
    the disk.
    
    This was happenning:
    
    When doing O_SYNC writes, function fsync_buffers_list() submits a list of
    bios to dm_raid1, the bios are added to dm_raid1 write queue and kmirrord is
    woken up.
    
    fsync_buffers_list() calls wait_on_buffer().  That unplugs the queue, but
    there are no bios on the device queue as they are still in the dm_raid1 queue.
    
    wait_on_buffer() starts waiting until the IO is finished.
    
    kmirrord is scheduled, kmirrord takes bios...
    7ff14a36
dm-kcopyd.c 13.4 KB