• Jens Axboe's avatar
    [PATCH] issues with online scheduler switching · b743892d
    Jens Axboe authored
    There are two issues with online io scheduler switching that this patch
    addresses.  The first is pretty simple - it concerns racing with scheduler
    removal on switch.  elevator_find() does not grab a reference to the io
    scheduler, so before elevator_attach() is run it could go away.  Add
    elevator_get() to solve that.
    
    Second issue is the flushing out of requests that is needed before
    switching can be problematic with requests that aren't allocated in the
    block layer (such as requests on the stack of a process).  The problem is
    that we don't know when they will have finished, and most io schedulers
    need to access the elevator structures on io completion.  This can be fixed
    by adding an intermedia step that switches to noop, since it doesn't need
    to touch anything but the request_queue.  The queue drain can then safely
    be split into two operations - one that waits for file system requests, and
    one that waits for the queue to completely empty.  Requests arriving after
    the first drain will get stuck in a seperate queue list.
    Signed-off-by: default avatarJens Axboe <axboe@suse.de>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    b743892d
blkdev.h 21.4 KB