diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-17 11:27:23 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-17 11:27:23 -0500 |
| commit | 60da5bf47dd3d301a1d3bd4f0a4b9e29a184515c (patch) | |
| tree | 30de83370440aae5350d9ab3fbe6583abd439ee8 /block | |
| parent | 3c2e81ef344a90bb0a39d84af6878b4aeff568a2 (diff) | |
| parent | cbae8d45d61f3a8c155caf267d01e5e0f0b2f4b7 (diff) | |
Merge branch 'for-3.8/core' of git://git.kernel.dk/linux-block
Pull block layer core updates from Jens Axboe:
"Here are the core block IO bits for 3.8. The branch contains:
- The final version of the surprise device removal fixups from Bart.
- Don't hide EFI partitions under advanced partition types. It's
fairly wide spread these days. This is especially dangerous for
systems that have both msdos and efi partition tables, where you
want to keep them in sync.
- Cleanup of using -1 instead of the proper NUMA_NO_NODE
- Export control of bdi flusher thread CPU mask and default to using
the home node (if known) from Jeff.
- Export unplug tracepoint for MD.
- Core improvements from Shaohua. Reinstate the recursive merge, as
the original bug has been fixed. Add plugging for discard and also
fix a problem handling non pow-of-2 discard limits.
There's a trivial merge in block/blk-exec.c due to a fix that went
into 3.7-rc at a later point than -rc4 where this is based."
* 'for-3.8/core' of git://git.kernel.dk/linux-block:
block: export block_unplug tracepoint
block: add plug for blkdev_issue_discard
block: discard granularity might not be power of 2
deadline: Allow 0ms deadline latency, increase the read speed
partitions: enable EFI/GPT support by default
bsg: Remove unused function bsg_goose_queue()
block: Make blk_cleanup_queue() wait until request_fn finished
block: Avoid scheduling delayed work on a dead queue
block: Avoid that request_fn is invoked on a dead queue
block: Let blk_drain_queue() caller obtain the queue lock
block: Rename queue dead flag
bdi: add a user-tunable cpu_list for the bdi flusher threads
block: use NUMA_NO_NODE instead of -1
block: recursive merge requests
block CFQ: avoid moving request to different queue
Diffstat (limited to 'block')
| -rw-r--r-- | block/blk-cgroup.c | 2 | ||||
| -rw-r--r-- | block/blk-core.c | 127 | ||||
| -rw-r--r-- | block/blk-exec.c | 4 | ||||
| -rw-r--r-- | block/blk-lib.c | 26 | ||||
| -rw-r--r-- | block/blk-settings.c | 6 | ||||
| -rw-r--r-- | block/blk-sysfs.c | 4 | ||||
| -rw-r--r-- | block/blk-throttle.c | 2 | ||||
| -rw-r--r-- | block/blk.h | 4 | ||||
| -rw-r--r-- | block/bsg-lib.c | 13 | ||||
| -rw-r--r-- | block/cfq-iosched.c | 3 | ||||
| -rw-r--r-- | block/deadline-iosched.c | 2 | ||||
| -rw-r--r-- | block/elevator.c | 16 | ||||
| -rw-r--r-- | block/genhd.c | 2 | ||||
| -rw-r--r-- | block/partitions/Kconfig | 4 |
14 files changed, 122 insertions, 93 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 3f6d39d23bb6..b8858fb0cafa 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
| @@ -231,7 +231,7 @@ struct blkcg_gq *blkg_lookup_create(struct blkcg *blkcg, | |||
| 231 | * we shouldn't allow anything to go through for a bypassing queue. | 231 | * we shouldn't allow anything to go through for a bypassing queue. |
| 232 | */ | 232 | */ |
| 233 | if (unlikely(blk_queue_bypass(q))) | 233 | if (unlikely(blk_queue_bypass(q))) |
| 234 | return ERR_PTR(blk_queue_dead(q) ? -EINVAL : -EBUSY); | 234 | return ERR_PTR(blk_queue_dying(q) ? -EINVAL : -EBUSY); |
| 235 | return __blkg_lookup_create(blkcg, q, NULL); | 235 | return __blkg_lookup_create(blkcg, q, NULL); |
| 236 | } | 236 | } |
| 237 | EXPORT_SYMBOL_GPL(blkg_lookup_create); | 237 | EXPORT_SYMBOL_GPL(blkg_lookup_create); |
diff --git a/block/blk-core.c b/block/blk-core.c index 3c95c4d6e31a..c973249d68cd 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_remap); | 40 | EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_remap); |
| 41 | EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_remap); | 41 | EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_remap); |
| 42 | EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_complete); | 42 | EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_complete); |
| 43 | EXPORT_TRACEPOINT_SYMBOL_GPL(block_unplug); | ||
| 43 | 44 | ||
| 44 | DEFINE_IDA(blk_queue_ida); | 45 | DEFINE_IDA(blk_queue_ida); |
| 45 | 46 | ||
| @@ -219,12 +220,13 @@ static void blk_delay_work(struct work_struct *work) | |||
| 219 | * Description: | 220 | * Description: |
| 220 | * Sometimes queueing needs to be postponed for a little while, to allow | 221 | * Sometimes queueing needs to be postponed for a little while, to allow |
| 221 | * resources to come back. This function will make sure that queueing is | 222 | * resources to come back. This function will make sure that queueing is |
| 222 | * restarted around the specified time. | 223 | * restarted around the specified time. Queue lock must be held. |
| 223 | */ | 224 | */ |
| 224 | void blk_delay_queue(struct request_queue *q, unsigned long msecs) | 225 | void blk_delay_queue(struct request_queue *q, unsigned long msecs) |
| 225 | { | 226 | { |
| 226 | queue_delayed_work(kblockd_workqueue, &q->delay_work, | 227 | if (likely(!blk_queue_dead(q))) |
| 227 | msecs_to_jiffies(msecs)); | 228 | queue_delayed_work(kblockd_workqueue, &q->delay_work, |
| 229 | msecs_to_jiffies(msecs)); | ||
| 228 | } | 230 | } |
| 229 | EXPORT_SYMBOL(blk_delay_queue); | 231 | EXPORT_SYMBOL(blk_delay_queue); |
| 230 | 232 | ||
| @@ -293,6 +295,34 @@ void blk_sync_queue(struct request_queue *q) | |||
| 293 | EXPORT_SYMBOL(blk_sync_queue); | 295 | EXPORT_SYMBOL(blk_sync_queue); |
| 294 | 296 | ||
| 295 | /** | 297 | /** |
| 298 | * __blk_run_queue_uncond - run a queue whether or not it has been stopped | ||
| 299 | * @q: The queue to run | ||
| 300 | * | ||
| 301 | * Description: | ||
| 302 | * Invoke request handling on a queue if there are any pending requests. | ||
| 303 | * May be used to restart request handling after a request has completed. | ||
| 304 | * This variant runs the queue whether or not the queue has been | ||
| 305 | * stopped. Must be called with the queue lock held and interrupts | ||
| 306 | * disabled. See also @blk_run_queue. | ||
| 307 | */ | ||
| 308 | inline void __blk_run_queue_uncond(struct request_queue *q) | ||
| 309 | { | ||
| 310 | if (unlikely(blk_queue_dead(q))) | ||
| 311 | return; | ||
| 312 | |||
| 313 | /* | ||
| 314 | * Some request_fn implementations, e.g. scsi_request_fn(), unlock | ||
| 315 | * the queue lock internally. As a result multiple threads may be | ||
| 316 | * running such a request function concurrently. Keep track of the | ||
| 317 | * number of active request_fn invocations such that blk_drain_queue() | ||
| 318 | * can wait until all these request_fn calls have finished. | ||
| 319 | */ | ||
| 320 | q->request_fn_active++; | ||
| 321 | q->request_fn(q); | ||
| 322 | q->request_fn_active--; | ||
| 323 | } | ||
| 324 | |||
| 325 | /** | ||
| 296 | * __blk_run_queue - run a single device queue | 326 | * __blk_run_queue - run a single device queue |
| 297 | * @q: The queue to run | 327 | * @q: The queue to run |
| 298 | * | 328 | * |
| @@ -305,7 +335,7 @@ void __blk_run_queue(struct request_queue *q) | |||
| 305 | if (unlikely(blk_queue_stopped(q))) | 335 | if (unlikely(blk_queue_stopped(q))) |
| 306 | return; | 336 | return; |
| 307 | 337 | ||
| 308 | q->request_fn(q); | 338 | __blk_run_queue_uncond(q); |
| 309 | } | 339 | } |
| 310 | EXPORT_SYMBOL(__blk_run_queue); | 340 | EXPORT_SYMBOL(__blk_run_queue); |
| 311 | 341 | ||
| @@ -315,11 +345,11 @@ EXPORT_SYMBOL(__blk_run_queue); | |||
| 315 | * | 345 | * |
| 316 | * Description: | 346 | * Description: |
| 317 | * Tells kblockd to perform the equivalent of @blk_run_queue on behalf | 347 | * Tells kblockd to perform the equivalent of @blk_run_queue on behalf |
| 318 | * of us. | 348 | * of us. The caller must hold the queue lock. |
| 319 | */ | 349 | */ |
| 320 | void blk_run_queue_async(struct request_queue *q) | 350 | void blk_run_queue_async(struct request_queue *q) |
| 321 | { | 351 | { |
| 322 | if (likely(!blk_queue_stopped(q))) | 352 | if (likely(!blk_queue_stopped(q) && !blk_queue_dead(q))) |
| 323 | mod_delayed_work(kblockd_workqueue, &q->delay_work, 0); | 353 | mod_delayed_work(kblockd_workqueue, &q->delay_work, 0); |
| 324 | } | 354 | } |
| 325 | EXPORT_SYMBOL(blk_run_queue_async); | 355 | EXPORT_SYMBOL(blk_run_queue_async); |
| @@ -349,7 +379,7 @@ void blk_put_queue(struct request_queue *q) | |||
| 349 | EXPORT_SYMBOL(blk_put_queue); | 379 | EXPORT_SYMBOL(blk_put_queue); |
| 350 | 380 | ||
| 351 | /** | 381 | /** |
| 352 | * blk_drain_queue - drain requests from request_queue | 382 | * __blk_drain_queue - drain requests from request_queue |
| 353 | * @q: queue to drain | 383 | * @q: queue to drain |
| 354 | * @drain_all: whether to drain all requests or only the ones w/ ELVPRIV | 384 | * @drain_all: whether to drain all requests or only the ones w/ ELVPRIV |
| 355 | * | 385 | * |
| @@ -357,15 +387,17 @@ EXPORT_SYMBOL(blk_put_queue); | |||
| 357 | * If not, only ELVPRIV requests are drained. The caller is responsible | 387 | * If not, only ELVPRIV requests are drained. The caller is responsible |
| 358 | * for ensuring that no new requests which need to be drained are queued. | 388 | * for ensuring that no new requests which need to be drained are queued. |
| 359 | */ | 389 | */ |
| 360 | void blk_drain_queue(struct request_queue *q, bool drain_all) | 390 | static void __blk_drain_queue(struct request_queue *q, bool drain_all) |
| 391 | __releases(q->queue_lock) | ||
| 392 | __acquires(q->queue_lock) | ||
| 361 | { | 393 | { |
| 362 | int i; | 394 | int i; |
| 363 | 395 | ||
| 396 | lockdep_assert_held(q->queue_lock); | ||
| 397 | |||
| 364 | while (true) { | 398 | while (true) { |
| 365 | bool drain = false; | 399 | bool drain = false; |
| 366 | 400 | ||
| 367 | spin_lock_irq(q->queue_lock); | ||
| 368 | |||
| 369 | /* | 401 | /* |
| 370 | * The caller might be trying to drain @q before its | 402 | * The caller might be trying to drain @q before its |
| 371 | * elevator is initialized. | 403 | * elevator is initialized. |
| @@ -386,6 +418,7 @@ void blk_drain_queue(struct request_queue *q, bool drain_all) | |||
| 386 | __blk_run_queue(q); | 418 | __blk_run_queue(q); |
| 387 | 419 | ||
| 388 | drain |= q->nr_rqs_elvpriv; | 420 | drain |= q->nr_rqs_elvpriv; |
| 421 | drain |= q->request_fn_active; | ||
| 389 | 422 | ||
| 390 | /* | 423 | /* |
| 391 | * Unfortunately, requests are queued at and tracked from | 424 | * Unfortunately, requests are queued at and tracked from |
| @@ -401,11 +434,14 @@ void blk_drain_queue(struct request_queue *q, bool drain_all) | |||
| 401 | } | 434 | } |
| 402 | } | 435 | } |
| 403 | 436 | ||
| 404 | spin_unlock_irq(q->queue_lock); | ||
| 405 | |||
| 406 | if (!drain) | 437 | if (!drain) |
| 407 | break; | 438 | break; |
| 439 | |||
| 440 | spin_unlock_irq(q->queue_lock); | ||
| 441 | |||
| 408 | msleep(10); | 442 | msleep(10); |
