linux/drivers/md
Kiyoshi Ueda d0bcb87865 dm: add request based barrier support
This patch adds barrier support for request-based dm.

CORE DESIGN

The design is basically same as bio-based dm, which emulates barrier
by mapping empty barrier bios before/after a barrier I/O.
But request-based dm has been using struct request_queue for I/O
queueing, so the block-layer's barrier mechanism can be used.

o Summary of the block-layer's behavior (which is depended by dm-core)
  Request-based dm uses QUEUE_ORDERED_DRAIN_FLUSH ordered mode for
  I/O barrier.  It means that when an I/O requiring barrier is found
  in the request_queue, the block-layer makes pre-flush request and
  post-flush request just before and just after the I/O respectively.

  After the ordered sequence starts, the block-layer waits for all
  in-flight I/Os to complete, then gives drivers the pre-flush request,
  the barrier I/O and the post-flush request one by one.
  It means that the request_queue is stopped automatically by
  the block-layer until drivers complete each sequence.

o dm-core
  For the barrier I/O, treats it as a normal I/O, so no additional
  code is needed.

  For the pre/post-flush request, flushes caches by the followings:
    1. Make the number of empty barrier requests required by target's
       num_flush_requests, and map them (dm_rq_barrier()).
    2. Waits for the mapped barriers to complete (dm_rq_barrier()).
       If error has occurred, save the error value to md->barrier_error
       (dm_end_request()).
       (*) Basically, the first reported error is taken.
           But -EOPNOTSUPP supersedes any error and DM_ENDIO_REQUEUE
           follows.
    3. Requeue the pre/post-flush request if the error value is
       DM_ENDIO_REQUEUE.  Otherwise, completes with the error value
       (dm_rq_barrier_work()).
  The pre/post-flush work above is done in the kernel thread (kdmflush)
  context, since memory allocation which might sleep is needed in
  dm_rq_barrier() but sleep is not allowed in dm_request_fn(), which is
  an irq-disabled context.
  Also, clones of the pre/post-flush request share an original, so
  such clones can't be completed using the softirq context.
  Instead, complete them in the context of underlying device drivers.
  It should be safe since there is no I/O dispatching during
  the completion of such clones.

  For suspend, the workqueue of kdmflush needs to be flushed after
  the request_queue has been stopped.  Otherwise, the next flush work
  can be kicked even after the suspend completes.

TARGET INTERFACE

No new interface is added.
Just use the existing num_flush_requests in struct target_type
as same as bio-based dm.

Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
2009-12-10 23:52:18 +00:00
..
raid6test md: drivers/md/unroll.pl replaced with awk analog 2009-10-16 16:25:19 +11:00
.gitignore
bitmap.c md: remove clumsy usage of do_sync_mapping_range from bitmap code 2009-10-16 15:56:01 +11:00
bitmap.h md: move headers out of include/linux/raid/ 2009-03-31 14:27:03 +11:00
dm-bio-record.h dm: preserve bi_io_vec when resubmitting bios 2009-04-02 19:55:23 +01:00
dm-crypt.c dm crypt: make wipe message also wipe essiv key 2009-12-10 23:51:57 +00:00
dm-delay.c dm table: pass correct dev area size to device_area_is_valid 2009-07-23 20:30:42 +01:00
dm-exception-store.c dm snapshot: move cow ref from exception store to snap core 2009-12-10 23:52:12 +00:00
dm-exception-store.h dm snapshot: move cow ref from exception store to snap core 2009-12-10 23:52:12 +00:00
dm-io.c dm io: remove extra bi_io_vec region hack 2009-12-10 23:51:58 +00:00
dm-ioctl.c dm ioctl: prefer strlcpy over strncpy 2009-12-10 23:52:07 +00:00
dm-kcopyd.c dm kcopyd: accept zero size jobs 2009-12-10 23:52:13 +00:00
dm-linear.c dm table: pass correct dev area size to device_area_is_valid 2009-07-23 20:30:42 +01:00
dm-log-userspace-base.c dm log: userspace fix incorrect luid cast in userspace_ctr 2009-10-16 23:18:15 +01:00
dm-log-userspace-transfer.c dm/connector: Only process connector packages from privileged processes 2009-10-02 10:54:10 -07:00
dm-log-userspace-transfer.h dm log: userspace add luid to distinguish between concurrent log instances 2009-09-04 20:40:34 +01:00
dm-log.c dm raid1: report flush errors separately in status 2009-12-10 23:52:02 +00:00
dm-mpath.c [SCSI] scsi_dh: Change the scsidh_activate interface to be asynchronous 2009-12-04 12:00:46 -06:00
dm-mpath.h dm mpath: remove is_active from struct dm_path 2008-10-10 13:36:58 +01:00
dm-path-selector.c dm: path selector use module refcount directly 2009-04-02 19:55:27 +01:00
dm-path-selector.h dm mpath: add start_io and nr_bytes to path selectors 2009-06-22 10:12:27 +01:00
dm-queue-length.c dm mpath: add queue length load balancer 2009-06-22 10:12:27 +01:00
dm-raid1.c dm raid1: explicitly initialise bio_lists 2009-12-10 23:52:06 +00:00
dm-region-hash.c dm raid1: remove bio_endio from dm_rh_mark_nosync 2009-12-10 23:52:05 +00:00
dm-round-robin.c dm mpath: add start_io and nr_bytes to path selectors 2009-06-22 10:12:27 +01:00
dm-service-time.c dm mpath: add service time load balancer 2009-06-22 10:12:28 +01:00
dm-snap-persistent.c dm snapshot: move cow ref from exception store to snap core 2009-12-10 23:52:12 +00:00
dm-snap-transient.c dm snapshot: move cow ref from exception store to snap core 2009-12-10 23:52:12 +00:00
dm-snap.c dm snapshot: track suspended state in target 2009-12-10 23:52:12 +00:00
dm-stripe.c block: Optimal I/O limit wrapper 2009-09-14 08:24:52 +02:00
dm-sysfs.c dm: sysfs add empty release function to avoid debug warning 2009-12-10 23:51:53 +00:00
dm-table.c dm stripe: expose correct io hints 2009-09-04 20:40:25 +01:00
dm-target.c dm target: remove struct tt_internal 2009-04-02 19:55:28 +01:00
dm-uevent.c dm: avoid _hash_lock deadlock 2009-12-10 23:51:52 +00:00
dm-uevent.h dm: uevent generate events 2007-10-20 02:01:26 +01:00
dm-zero.c dm: consolidate target deregistration error handling 2009-01-06 03:04:58 +00:00
dm.c dm: add request based barrier support 2009-12-10 23:52:18 +00:00
dm.h dm io: use slab for struct io 2009-12-10 23:51:57 +00:00
faulty.c md: Move check for bitmap presence to personality code. 2009-06-18 08:49:23 +10:00
Kconfig Merge branch 'dmaengine' into async-tx-next 2009-09-08 17:55:21 -07:00
linear.c md: report device as congested when suspended 2009-09-23 18:10:29 +10:00
linear.h md/linear: use call_rcu to free obsolete 'conf' structures. 2009-06-18 08:49:42 +10:00
Makefile md: drivers/md/unroll.pl replaced with awk analog 2009-10-16 16:25:19 +11:00
md.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/sysctl-2.6 2009-12-08 07:38:50 -08:00
md.h md: report device as congested when suspended 2009-09-23 18:10:29 +10:00
mktables.c md/raid6: move raid6 data processing to raid6_pq.ko 2009-03-31 15:09:39 +11:00
multipath.c md: remove unnecessary memset from multipath. 2009-09-23 18:16:31 +10:00
multipath.h md: remove mddev_to_conf "helper" macro 2009-06-16 16:54:21 +10:00
raid0.c md: report device as congested when suspended 2009-09-23 18:10:29 +10:00
raid0.h md: remove mddev_to_conf "helper" macro 2009-06-16 16:54:21 +10:00
raid1.c md: revert incorrect fix for read error handling in raid1. 2009-12-01 17:30:59 +11:00
raid1.h md: remove mddev_to_conf "helper" macro 2009-06-16 16:54:21 +10:00
raid5.c md/raid5: Allow dirty-degraded arrays to be assembled when only party is degraded. 2009-11-13 17:47:00 +11:00
raid5.h md: fix problems with RAID6 calculations for DDF. 2009-10-16 16:27:34 +11:00
raid6algos.c md/raid6: move raid6 data processing to raid6_pq.ko 2009-03-31 15:09:39 +11:00
raid6altivec.uc md: drivers/md/unroll.pl replaced with awk analog 2009-10-16 16:25:19 +11:00
raid6int.uc md: drivers/md/unroll.pl replaced with awk analog 2009-10-16 16:25:19 +11:00
raid6mmx.c md/raid6: move raid6 data processing to raid6_pq.ko 2009-03-31 15:09:39 +11:00
raid6recov.c md/raid6: move raid6 data processing to raid6_pq.ko 2009-03-31 15:09:39 +11:00
raid6sse1.c md/raid6: move raid6 data processing to raid6_pq.ko 2009-03-31 15:09:39 +11:00
raid6sse2.c md/raid6: move raid6 data processing to raid6_pq.ko 2009-03-31 15:09:39 +11:00
raid6x86.h md: fix typo in FSF address 2009-03-31 14:57:37 +11:00
raid10.c md: raid1/raid10: handle allocation errors during array setup. 2009-10-16 15:55:44 +11:00
raid10.h md: remove mddev_to_conf "helper" macro 2009-06-16 16:54:21 +10:00
unroll.awk md: drivers/md/unroll.pl replaced with awk analog 2009-10-16 16:25:19 +11:00