1
0
Fork 0
alistair23-linux/include
Tejun Heo add703fda9 blk-mq: use percpu_ref for mq usage count
Currently, blk-mq uses a percpu_counter to keep track of how many
usages are in flight.  The percpu_counter is drained while freezing to
ensure that no usage is left in-flight after freezing is complete.
blk_mq_queue_enter/exit() and blk_mq_[un]freeze_queue() implement this
per-cpu gating mechanism.

This type of code has relatively high chance of subtle bugs which are
extremely difficult to trigger and it's way too hairy to be open coded
in blk-mq.  percpu_ref can serve the same purpose after the recent
changes.  This patch replaces the open-coded per-cpu usage counting
and draining mechanism with percpu_ref.

blk_mq_queue_enter() performs tryget_live on the ref and exit()
performs put.  blk_mq_freeze_queue() kills the ref and waits until the
reference count reaches zero.  blk_mq_unfreeze_queue() revives the ref
and wakes up the waiters.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Nicholas A. Bellinger <nab@linux-iscsi.org>
Cc: Kent Overstreet <kmo@daterainc.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
2014-07-01 10:34:38 -06:00
..
acpi ACPI / processor replace __attribute__((packed)) by __packed 2014-06-17 14:00:15 +02:00
asm-generic percpu: preffity percpu header files 2014-06-17 19:12:40 -04:00
clocksource
crypto crypto: hash - Add real ahash walk interface 2014-05-21 20:56:12 +08:00
drm drm/i915: BDW: Adding Reserved PCI IDs. 2014-06-24 14:56:16 +03:00
dt-bindings The i.MX fixes for 3.16: 2014-06-23 14:12:48 +02:00
keys
kvm
linux blk-mq: use percpu_ref for mq usage count 2014-07-01 10:34:38 -06:00
math-emu
media Merge branch 'topic/omap3isp' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 2014-06-12 23:04:28 -07:00
memory
misc
net ipv4: fix dst race in sk_dst_get() 2014-06-25 17:41:44 -07:00
pcmcia
ras
rdma Merge branches 'core', 'cxgb3', 'cxgb4', 'iser', 'iwpm', 'misc', 'mlx4', 'mlx5', 'noio', 'ocrdma', 'qib', 'srp' and 'usnic' into for-next 2014-06-10 10:12:14 -07:00
rxrpc
scsi Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2014-06-12 22:38:32 -07:00
sound ALSA: control: Protect user controls against concurrent access 2014-06-18 15:12:33 +02:00
target target: Report correct response length for some commands 2014-06-11 12:15:30 -07:00
trace tracing: Add __field_struct macro for TRACE_EVENT() 2014-06-21 00:18:42 -04:00
uapi sound fixes for 3.16-rc3 2014-06-27 17:21:36 -07:00
video Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-06-12 11:32:30 -07:00
xen Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-06-12 14:27:40 -07:00
Kbuild