summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* blk-mq: allow changing of queue depth through sysfsJens Axboe2014-05-208-60/+134
| | | | | | | | | | | For request_fn based devices, the block layer exports a 'nr_requests' file through sysfs to allow adjusting of queue depth on the fly. Currently this returns -EINVAL for blk-mq, since it's not wired up. Wire this up for blk-mq, so that it now also always dynamic adjustments of the allowed queue depth for any given block device managed by blk-mq. Signed-off-by: Jens Axboe <axboe@fb.com>
* htmldocs: fix bio.c locationJens Axboe2014-05-201-1/+1
| | | | | | | Commit f9c78b2be2ca moved bio.c from fs/ to block/, but didn't update the docbook location. Fix that up. Signed-off-by: Jens Axboe <axboe@fb.com>
* block: move mm/bounce.c to block/Jens Axboe2014-05-193-1/+1
| | | | | | | | | Continue moving some of the block files that are scattered around. bounce.c contains only code for bouncing the contents of a bio. It's block proper code, not mm code. Suggested-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
* Merge branch 'for-3.16/blk-mq-tagging' into for-3.16/coreJens Axboe2014-05-199-27/+236
|\ | | | | | | | | | | | | Signed-off-by: Jens Axboe <axboe@fb.com> Conflicts: block/blk-mq-tag.c
| * blk-mq: improve support for shared tags mapsJens Axboe2014-05-139-27/+236
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for active queue tracking, meaning that the blk-mq tagging maintains a count of active users of a tag set. This allows us to maintain a notion of fairness between users, so that we can distribute the tag depth evenly without starving some users while allowing others to try unfair deep queues. If sharing of a tag set is detected, each hardware queue will track the depth of its own queue. And if this exceeds the total depth divided by the number of active queues, the user is actively throttled down. The active queue count is done lazily to avoid bouncing that data between submitter and completer. Each hardware queue gets marked active when it allocates its first tag, and gets marked inactive when 1) the last tag is cleared, and 2) the queue timeout grace period has passed. Signed-off-by: Jens Axboe <axboe@fb.com>
* | blk-mq: switch ctx pending map to the sparser blk_align_bitmapJens Axboe2014-05-192-30/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each hardware queue has a bitmap of software queues with pending requests. When new IO is queued on a software queue, the bit is set, and when IO is pruned on a hardware queue run, the bit is cleared. This causes a lot of traffic. Switch this from the regular BITS_PER_LONG bitmap to a sparser layout, similarly to what was done for blk-mq tagging. 20% performance increase was observed for single threaded IO, and about 15% performanc increase on multiple threads driving the same device. Signed-off-by: Jens Axboe <axboe@fb.com>
* | blk-mq: move the cache friendly bitmap type of out blk-mq-tagJens Axboe2014-05-193-11/+17
| | | | | | | | | | | | We will use it for the pending list in blk-mq core as well. Signed-off-by: Jens Axboe <axboe@fb.com>
* | block: move ioprio.c from fs/ to block/Jens Axboe2014-05-193-2/+3
| | | | | | | | | | | | | | Like commit f9c78b2b, move this block related file outside of fs/ and into the core block directory, block/. Signed-off-by: Jens Axboe <axboe@fb.com>
* | block: move bio.c and bio-integrity.c from fs/ to block/Jens Axboe2014-05-194-3/+3
| | | | | | | | | | | | | | | | | | | | They really belong in block/, especially now since it's not in drivers/block/ anymore. Additionally, the get_maintainer script gets it wrong when in fs/. Suggested-by: Christoph Hellwig <hch@infradead.org> Acked-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Jens Axboe <axboe@fb.com>
* | Merge branch 'for-3.16/blk-mq-tagging' into for-3.16/coreJens Axboe2014-05-102-25/+41
|\ \ | |/
| * blk-mq: bitmap tag: cleanup blk_mq_init_tagsMing Lei2014-05-101-4/+0
| | | | | | | | | | | | | | Both nr_cache and nr_tags arn't needed for bitmap tag anymore. Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
| * blk-mq: bitmap tag: select random tag betweet 0 and (depth - 1)Ming Lei2014-05-101-4/+1
| | | | | | | | | | | | | | | | | | The selected tag should be selected at random between 0 and (depth - 1) with probability 1/depth, instead between 0 and (depth - 2) with probability 1/(depth - 1). Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
| * blk-mq: bitmap tag: remove barrier in bt_clear_tag()Ming Lei2014-05-101-1/+0
| | | | | | | | | | | | | | | | The barrier isn't necessary because both atomic_dec_and_test() and wake_up() implicate one barrier. Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
| * blk-mq: bitmap tag: use clear_bit_unlock in bt_clear_tag()Ming Lei2014-05-101-1/+5
| | | | | | | | | | | | | | | | | | | | The unlock memory barrier need to order access to req in free path and clearing tag bit, otherwise either request free path may see a allocated request, or initialized request in allocate path might be modified by the ongoing free path. Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
| * blk-mq: use sparser tag layout for lower queue depthJens Axboe2014-05-092-16/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For best performance, spreading tags over multiple cachelines makes the tagging more efficient on multicore systems. But since we have 8 * sizeof(unsigned long) tags per cacheline, we don't always get a nice spread. Attempt to spread the tags over at least 4 cachelines, using fewer number of bits per unsigned long if we have to. This improves tagging performance in setups with 32-128 tags. For higher depths, the spread is the same as before (BITS_PER_LONG tags per cacheline). Signed-off-by: Jens Axboe <axboe@fb.com>
* | block: only calculate part_in_flight() onceJens Axboe2014-05-091-2/+5
| | | | | | | | | | | | | | | | | | We first check if we have inflight IO, then retrieve that same number again. Usually this isn't that costly since the chance of having the data dirtied in between is small, but there's no reason for calling part_in_flight() twice. Signed-off-by: Jens Axboe <axboe@fb.com>
* | blk-mq: fix race in IO start accountingJens Axboe2014-05-091-4/+2
|/ | | | | | | | | Commit c6d600c6 opened up a small race where we could attempt to account IO completion on a request, racing with IO start accounting. Fix this up by ensuring that we've accounted for IO start before inserting the request. Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: implement new and more efficient tagging schemeJens Axboe2014-05-095-99/+391
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | blk-mq currently uses percpu_ida for tag allocation. But that only works well if the ratio between tag space and number of CPUs is sufficiently high. For most devices and systems, that is not the case. The end result if that we either only utilize the tag space partially, or we end up attempting to fully exhaust it and run into lots of lock contention with stealing between CPUs. This is not optimal. This new tagging scheme is a hybrid bitmap allocator. It uses two tricks to both be SMP friendly and allow full exhaustion of the space: 1) We cache the last allocated (or freed) tag on a per blk-mq software context basis. This allows us to limit the space we have to search. The key element here is not caching it in the shared tag structure, otherwise we end up dirtying more shared cache lines on each allocate/free operation. 2) The tag space is split into cache line sized groups, and each context will start off randomly in that space. Even up to full utilization of the space, this divides the tag users efficiently into cache line groups, avoiding dirtying the same one both between allocators and between allocator and freeer. This scheme shows drastically better behaviour, both on small tag spaces but on large ones as well. It has been tested extensively to show better performance for all the cases blk-mq cares about. Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: initialize struct request fields individuallyChristoph Hellwig2014-05-092-5/+49
| | | | | | | | This allows us to avoid a non-atomic memset over ->atomic_flags as well as killing lots of duplicate initializations. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: update a hotplug comment for grammarJens Axboe2014-05-091-4/+4
| | | | Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: add basic round-robin of what CPU to queue workqueue work onJens Axboe2014-05-072-14/+35
| | | | | | | | Right now we just pick the first CPU in the mask, but that can easily overload that one. Add some basic batching and round-robin all the entries in the mask instead. Signed-off-by: Jens Axboe <axboe@fb.com>
* block/blk-throttle.c: fix return of 0/1 with return type boolFabian Frederick2014-05-021-4/+4
| | | | | | | | | Fix 4 coccinelle warnings. Cc: Jens Axboe <axboe@kernel.dk> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Jens Axboe <axboe@fb.com>
* block/blk-iopoll.c: use iop instead of iopollFabian Frederick2014-05-021-2/+2
| | | | | | | | | | All blk_iopoll functions use iop for parent iopoll structure except blk_iopoll_complete.This also fixes one kernel-doc warning. Cc: Jens Axboe <axboe@kernel.dk> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: remove extra requeue traceJens Axboe2014-05-021-4/+0
| | | | | | | | We already issue a blktrace requeue event in __blk_mq_requeue_request(), don't do it from the original caller as well. Signed-off-by: Jens Axboe <axboe@fb.com>
* block: Fix format string mismatch in cfq-iosched.cMasanari Iida2014-04-301-1/+1
| | | | | | | Fix format string mismatch in cfq_var_show() Signed-off-by: Masanari Iida <standby24x7@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: refactor request insertion/mergingJens Axboe2014-04-301-7/+15
| | | | | | | | | Refactor the logic around adding a new bio to a software queue, so we nest the ctx->lock where we really need it (merge and insertion) and don't hold it when we don't (init and IO start accounting). Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq remove debug BUG_ON() when draining software queuesJens Axboe2014-04-301-1/+0
| | | | | | It's never been of any use, lets get rid of it. Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: fix waiting for reserved tagsJens Axboe2014-04-293-4/+4
| | | | | | | | | | | | blk_mq_wait_for_tags() is only able to wait for "normal" tags, not reserved tags. Pass in which one we should attempt to get a tag for, so that waiting for reserved tags will work. Reserved tags are used for internal commands, which are usually serialized. Hence no waiting generally takes place, but we should ensure that it actually works if users need that functionality. Signed-off-by: Jens Axboe <axboe@fb.com>
* random: export add_disk_randomnessChristoph Hellwig2014-04-281-0/+1
| | | | | | | | | | This will be needed for pending changes to the scsi midlayer that now calls lower level block APIs, as well as any blk-mq driver that wants to contribute to the random pool. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Jens Axboe <axboe@fb.com>
* block: fold __blk_add_timer into blk_add_timerChristoph Hellwig2014-04-251-23/+11
| | | | | Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: respect rq_affinityChristoph Hellwig2014-04-254-46/+6
| | | | | | | | | | | | | | | | | | | | | | | The blk-mq code is using it's own version of the I/O completion affinity tunables, which causes a few issues: - the rq_affinity sysfs file doesn't work for blk-mq devices, even if it still is present, thus breaking existing tuning setups. - the rq_affinity = 1 mode, which is the defauly for legacy request based drivers isn't implemented at all. - blk-mq drivers don't implement any completion affinity with the default flag settings. This patches removes the blk-mq ipi_redirect flag and sysfs file, as well as the internal BLK_MQ_F_SHOULD_IPI flag and replaces it with code that respects the queue-wide rq_affinity flags and also implements the rq_affinity = 1 mode. This means I/O completion affinity can now only be tuned block-queue wide instead of per context, which seems more sensible to me anyway. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: fix race with timeouts and requeue eventsJens Axboe2014-04-244-18/+42
| | | | | | | | | | | | | If a requeue event races with a timeout, we can get into the situation where we attempt to complete a request from the timeout handler when it's not start anymore. This causes a crash. So have the timeout handler check that REQ_ATOM_STARTED is still set on the request - if not, we ignore the event. If this happens, the request has now been marked as complete. As a consequence, we need to ensure to clear REQ_ATOM_COMPLETE in blk_mq_start_request(), as to maintain proper request state. Signed-off-by: Jens Axboe <axboe@fb.com>
* Revert "blk-mq: initialize req->q in allocation"Jens Axboe2014-04-241-3/+1
| | | | | | | | This reverts commit 6a3c8a3ac0e68dcfc2a01f4aa1ca0edd1a1701eb. We need selective clearing of the request to make the init-at-free time completely safe. Otherwise we end up stomping on rq->atomic_flags, which we don't want to do.
* blk-mq: fix leak of set->tagsMing Lei2014-04-231-0/+1
| | | | | | | set->tags should be freed in blk_mq_free_tag_set(). Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
* fs/bio.c: remove nr_segs (unused function parameter)Fabian Frederick2014-04-221-3/+2
| | | | | | | | | | nr_segs is no longer used in bio_alloc_map_data since c8db444820a1e3 ("block: Don't save/copy bvec array anymore") Signed-off-by: Fabian Frederick <fabf@skynet.be> Cc: Jens Axboe <axboe@kernel.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jens Axboe <axboe@fb.com>
* fs/bio: remove bs paramater in biovec_create_poolFabian Frederick2014-04-223-4/+4
| | | | | | | | | bs is no longer used in biovec_create_pool since 9f060e2231ca96 ("block: Convert integrity to bvec_alloc_bs()") Signed-off-by: Fabian Frederick <fabf@skynet.be> Cc: Jens Axboe <axboe@kernel.dk> Signed-off-by: Jens Axboe <axboe@fb.com>
* block/blk-throttle.c: add static to blk_throtl_dispatch_work_fnFabian Frederick2014-04-211-1/+1
| | | | | | | | | blk_throtl_dispatch_work_fn is only used in blk-throttle.c Cc: Jens Axboe <axboe@kernel.dk> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Jens Axboe <axboe@fb.com>
* fs: fix new kernel-doc warnings in fs/bio.cRandy Dunlap2014-04-211-0/+2
| | | | | | | | | | Fix new kernel-doc warnings in fs/bio.c: Warning(fs/bio.c:316): No description found for parameter 'bio' Warning(fs/bio.c:316): No description found for parameter 'parent' Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: initialize req->q in allocationMing Lei2014-04-211-1/+3
| | | | | | | | | | | | | The patch basically reverts the patch of(blk-mq: initialize request on allocation) in Jens's tree(already in -next), and only initialize req->q in allocation for two reasons: - presumed cache hotness on completion - blk_rq_tagged(rq) depends on reset of req->mq_ctx Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: user (1 << order) to implement order_to_size()Ming Lei2014-04-211-6/+1
| | | | | | | Cc: Jörg-Volker Peetz <jvpeetz@web.de> Cc: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: fix allocation of set->tagsMing Lei2014-04-211-1/+2
| | | | | | | | type of set->tags is struct blk_mq_tags **. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: free hctx->ctx_map when init failedMing Lei2014-04-211-0/+1
| | | | | | | | Avoid memory leak in the failure path. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Jens Axboe <axboe@fb.com>
* sd/skd: stuff discard page in request->completion_dataJens Axboe2014-04-162-6/+5
| | | | | | | | Store the pointer to the page there, so we can always safely reference it from end_io context where ->bio may have been cleared. Signed-off-by: Jens Axboe <axboe@fb.com>
* jsflash: missed conversion from rq->buffer to bio_data(rq->bio)Jens Axboe2014-04-161-1/+1
| | | | Signed-off-by: Jens Axboe <axboe@fb.com>
* block: relax when to modify the timeout timerJens Axboe2014-04-161-2/+13
| | | | | | | | | | | | | | | | | Since we are now, by default, applying timer slack to expiry times, the logic for when to modify a timer in the block code is suboptimal. The block layer keeps a forward rolling timer per queue for all requests, and modifies this timer if a request has a shorter timeout than what the current expiry time is. However, this breaks down when our rounded timer values get applied slack. Then each new request ends up modifying the timer, since we're still a little in front of the timer + slack. Fix this by allowing a tolerance of HZ / 2, the timeout handling doesn't need to be very precise. This drastically cuts down the number of timer modifications we have to make. Signed-off-by: Jens Axboe <axboe@fb.com>
* block: export blk_finish_requestChristoph Hellwig2014-04-162-1/+3
| | | | | | | | This allows to mirror the blk-mq code flow for more a more readable I/O completion handler in SCSI. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: rename mq_flush_work struct request memberChristoph Hellwig2014-04-162-4/+4
| | | | | | | | We will use this work_struct to requeue scsi commands from the completion handler as well, so give it a more generic name. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: add blk_mq_requeue_requestChristoph Hellwig2014-04-162-2/+18
| | | | | | | | | | | | This allows to requeue a request that has been accepted by ->queue_rq earlier. This is needed by the SCSI layer in various error conditions. The existing internal blk_mq_requeue_request is renamed to __blk_mq_requeue_request as it is a lower level building block for this funtionality. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: add blk_mq_start_hw_queuesChristoph Hellwig2014-04-162-0/+12
| | | | | | | | | Add a helper to unconditionally kick contexts of a queue. This will be needed by the SCSI layer to provide fair queueing between multiple devices on a single host. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
* blk-mq: add blk_mq_delay_queueChristoph Hellwig2014-04-163-9/+46
| | | | | | | | | | | | Add a blk-mq equivalent to blk_delay_queue so that the scsi layer can ask to be kicked again after a delay. Signed-off-by: Christoph Hellwig <hch@lst.de> Modified by me to kill the unnecessary preempt disable/enable in the delayed workqueue handler. Signed-off-by: Jens Axboe <axboe@fb.com>
OpenPOWER on IntegriCloud