• K
    dm: simplify request based suspend · 9f518b27
    Kiyoshi Ueda 提交于
    The semantics of bio-based dm were changed recently in the case of
    suspend with "--nolockfs" but without "--noflush".
    Before 2.6.30, I/Os submitted before the suspend invocation were always
    flushed.  From 2.6.30 onwards, I/Os submitted before the suspend
    invocation might not be flushed.  (For details, see
    http://marc.info/?t=123994433400003&r=1&w=2)
    
    This patch brings the behaviour of request-based dm into line with
    bio-based dm, simplifying the code and preparing for a subsequent patch
    that will wait for all in_flight I/Os to complete without stopping
    request_queue and use dm_wait_for_completion() for it.
    
    This change in semantics simplifies the suspend code as follows:
      o Suspend is implemented as stopping request_queue
        in request-based dm, and all I/Os are queued in the request_queue
        even after suspend is invoked.
      o In the old semantics, we had to track whether I/Os were
        queued before or after the suspend invocation, so a special
        barrier-like request called 'suspend marker' was introduced.
      o With the new semantics, we don't need to flush any I/O
        so we can remove the marker and the code related to the marker
        handling and I/O flushing.
    
    After removing this codes, the suspend sequence is now:
      1. Flush all I/Os by lock_fs() if needed.
      2. Stop dispatching any I/O by stopping the request_queue.
      3. Wait for all in-flight I/Os to be completed or requeued.
    Signed-off-by: NKiyoshi Ueda <k-ueda@ct.jp.nec.com>
    Signed-off-by: NJun'ichi Nomura <j-nomura@ce.jp.nec.com>
    Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
    9f518b27
dm.c 55.8 KB