aboutsummaryrefslogtreecommitdiff
path: root/block
AgeCommit message (Collapse)AuthorFilesLines
2014-05-30blk-mq: make the sysfs mq/ layout reflect current mappingsJens Axboe3-19/+93
Currently blk-mq registers all the hardware queues in sysfs, regardless of whether it uses them (e.g. they have CPU mappings) or not. The unused hardware queues lack the cpux/ directories, and the other sysfs entries (like active, pending, etc) are all zeroes. Change this so that sysfs correctly reflects the current mappings of the hardware queues. Signed-off-by: Jens Axboe <[email protected]>
2014-05-30Merge branch 'for-3.16/core' into for-3.16/driversJens Axboe5-37/+45
Pulled in for the blk_mq_tag_to_rq() change, which impacts mtip32xx. Signed-off-by: Jens Axboe <[email protected]>
2014-05-30blk-mq: blk_mq_tag_to_rq should handle flush requestShaohua Li2-4/+12
flush request is special, which borrows the tag from the parent request. Hence blk_mq_tag_to_rq needs special handling to return the flush request from the tag. Signed-off-by: Shaohua Li <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-29block: remove dead code in scsi_ioctl:blk_verify_commandDave Jones1-4/+0
filter gets assigned the address of blk_default_cmd_filter on entry to this function, so the !filter condition can never be true. Signed-off-by: Dave Jones <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-29blk-mq: request initialization optimizationsJens Axboe1-17/+9
We currently clear a lot more than we need to, so make that a bit more clever. Make some of the init dependent on features, like only setting start_time if we are going to use it. Signed-off-by: Jens Axboe <[email protected]>
2014-05-29block: add queue flag for disabling SG mergingJens Axboe2-7/+24
If devices are not SG starved, we waste a lot of time potentially collapsing SG segments. Enough that 1.5% of the CPU time goes to this, at only 400K IOPS. Add a queue flag, QUEUE_FLAG_NO_SG_MERGE, which just returns the number of vectors in a bio instead of looping over all segments and checking for collapsible ones. Add a BLK_MQ_F_SG_MERGE flag so that drivers can opt-in on the sg merging, if they so desire. Signed-off-by: Jens Axboe <[email protected]>
2014-05-29block: remove 'magic' from struct blk_plugJens Axboe1-5/+0
I don't think we've ever caught any bugs with this, and there's the list poisoning for the plug lists to catch uninitialized cases. So remove the magic member and save 8 bytes in the struct. Signed-off-by: Jens Axboe <[email protected]>
2014-05-28Merge branch 'for-3.16/core' into for-3.16/driversJens Axboe4-21/+33
Pull in core changes (again), since we got rid of the alloc/free hctx mq_ops hooks and mtip32xx then needed updating again. Signed-off-by: Jens Axboe <[email protected]>
2014-05-28blk-mq: remove alloc_hctx and free_hctx methodsChristoph Hellwig1-21/+5
There is no need for drivers to control hardware context allocation now that we do the context to node mapping in common code. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-28blk-mq: add file comments and update copyright noticesJens Axboe4-0/+28
None of the blk-mq files have an explanatory comment at the top for what that particular file does. Add that and add appropriate copyright notices as well. Signed-off-by: Jens Axboe <[email protected]>
2014-05-28Merge branch 'for-3.16/core' into for-3.16/driversJens Axboe21-495/+4631
mtip32xx uses blk_mq_alloc_reserved_request(), so pull in the core changes so we have a properly merged end result. Signed-off-by: Jens Axboe <[email protected]>
2014-05-28blk-mq: remove blk_mq_alloc_request_pinnedChristoph Hellwig1-32/+16
We now only have one caller left and can open code it there in a cleaner way. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-28blk-mq: do not use blk_mq_alloc_request_pinned in blk_mq_map_requestChristoph Hellwig1-3/+5
We already do a non-blocking allocation in blk_mq_map_request, no need to repeat it. Just call __blk_mq_alloc_request to wait directly. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-28blk-mq: remove blk_mq_wait_for_tagsChristoph Hellwig3-16/+6
The current logic for blocking tag allocation is rather confusing, as we first allocated and then free again a tag in blk_mq_wait_for_tags, just to attempt a non-blocking allocation and then repeat if someone else managed to grab the tag before us. Instead change blk_mq_alloc_request_pinned to simply do a blocking tag allocation itself and use the request we get back from it. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-28blk-mq: initialize request in __blk_mq_alloc_requestChristoph Hellwig1-32/+30
Both callers if __blk_mq_alloc_request want to initialize the request, so lift it into the common path. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-28blk-mq: merge blk_mq_alloc_reserved_request into blk_mq_alloc_requestChristoph Hellwig2-18/+4
Instead of having two almost identical copies of the same code just let the callers pass in the reserved flag directly. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-28blk-mq: add helper to insert requests from irq contextChristoph Hellwig2-13/+67
Both the cache flush state machine and the SCSI midlayer want to submit requests from irq context, and the current per-request requeue_work unfortunately causes corruption due to sharing with the csd field for flushes. Replace them with a per-request_queue list of requests to be requeued. Based on an earlier test by Ming Lei. Signed-off-by: Christoph Hellwig <[email protected]> Reported-by: Ming Lei <[email protected]> Tested-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-27blk-mq: allow non-softirq completionsJens Axboe1-3/+9
Right now we export two ways of completing a request: 1) blk_mq_complete_request(). This uses an IPI (if needed) and completes through q->softirq_done_fn(). It also works with timeouts. 2) blk_mq_end_io(). This completes inline, and ignores any timeout state of the request. Let blk_mq_complete_request() handle non-softirq_done_fn completions as well, by just completing inline. If a driver has enough completion ports to place completions correctly, it need not define a mq_ops->complete() and we can avoid an indirect function call by doing the completion inline. Signed-off-by: Jens Axboe <[email protected]>
2014-05-27blk-mq: pass in suggested NUMA node to ->alloc_hctx()Jens Axboe3-11/+32
Drivers currently have to figure this out on their own, and they are missing information to do it properly. The ones that did attempt to do it, do it wrong. So just pass in the suggested node directly to the alloc function. Signed-off-by: Jens Axboe <[email protected]>
2014-05-27block: only allocate/free mq_usage_counter in blk-mqMing Lei3-8/+6
The percpu counter is only used for blk-mq, so move its allocation and free inside blk-mq, and don't allocate it for legacy queue device. Signed-off-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-27blk-mq: avoid code duplicationMing Lei1-24/+37
blk_mq_exit_hw_queues() and blk_mq_free_hw_queues() are introduced to avoid code duplication. Signed-off-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-27blk-mq: fix leak of hctx->ctx_mapMing Lei1-0/+1
hctx->ctx_map should have been freed inside blk_mq_free_queue(). Signed-off-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-26block/blk-lib.c: make __blkdev_issue_zeroout staticFabian Frederick1-2/+2
__blkdev_issue_zeroout is only used in blk-lib.c Cc: Jens Axboe <[email protected]> Cc: Andrew Morton <[email protected]> Signed-off-by: Fabian Frederick <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-26blk-mq: idle all hardware contexts before freeing a queueChristoph Hellwig1-0/+1
Without this we can leak the active_queues reference if a command is freed while it is considered active. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-23blk-mq: allow setting of per-request timeoutsJens Axboe1-2/+6
Currently blk-mq uses the queue timeout for all requests. But for some commands, drivers may want to set a specific timeout for special requests. Allow this to be passed in through request->timeout, and use it if set. Signed-off-by: Jens Axboe <[email protected]>
2014-05-23blk-mq: export blk_mq_tag_busy_iterSam Bradshaw2-1/+1
Export the blk-mq in-flight tag iterator for driver consumption. This is particularly useful in exception paths or SRSI where in-flight IOs need to be cancelled and/or reissued. The NVMe driver conversion will use this. Signed-off-by: Sam Bradshaw <[email protected]> Signed-off-by: Matias Bjørling <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-22blk-mq: split make request handler for multi and single queueJens Axboe1-50/+157
We want slightly different behavior from them: - On single queue devices, we currently use the per-process plug for deferred IO and for merging. - On multi queue devices, we don't use the per-process plug, but we want to go straight to hardware for SYNC IO. Split blk_mq_make_request() into a blk_sq_make_request() for single queue devices, and retain blk_mq_make_request() for multi queue devices. Then we don't need multiple checks for q->nr_hw_queues in the request mapping. Signed-off-by: Jens Axboe <[email protected]>
2014-05-21blk-mq: save memory by freeing requests on unused hardware queuesJens Axboe1-52/+105
Depending on the topology of the machine and the number of queues exposed by a device, we can end up in a situation where some of the hardware queues are unused (as in, they don't map to any software queues). For this case, free up the memory used by the request map, as we will not use it. This can be a substantial amount of memory, depending on the number of queues vs CPUs and the queue depth of the device. Signed-off-by: Jens Axboe <[email protected]>
2014-05-21blk-mq: allow the hctx cpu hotplug notifier to return errorsJens Axboe3-9/+14
Prepare this for the next patch which adds more smarts in the plugging logic, so that we can save some memory. Signed-off-by: Jens Axboe <[email protected]>
2014-05-20blk-mq: Micro-optimize blk_queue_nomerges() checkRobert Elliott2-5/+6
In blk_mq_make_request(), do the blk_queue_nomerges() check outside the call to blk_attempt_plug_merge() to eliminate function call overhead when nomerges=2 (disabled) Signed-off-by: Robert Elliott <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-20blk-mq: initialize q->nr_requests after calling blk_queue_make_request()Jens Axboe1-0/+5
blk_queue_make_requests() overwrites our set value for q->nr_requests, turning it into the default of 128. Set this appropriately after initializing queue values in blk_queue_make_request(). Signed-off-by: Jens Axboe <[email protected]>
2014-05-20blk-mq: allow changing of queue depth through sysfsJens Axboe7-59/+133
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 <[email protected]>
2014-05-19block: move mm/bounce.c to block/Jens Axboe2-0/+288
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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-19Merge branch 'for-3.16/blk-mq-tagging' into for-3.16/coreJens Axboe6-27/+224
Signed-off-by: Jens Axboe <[email protected]> Conflicts: block/blk-mq-tag.c
2014-05-19blk-mq: switch ctx pending map to the sparser blk_align_bitmapJens Axboe1-28/+91
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 <[email protected]>
2014-05-19blk-mq: move the cache friendly bitmap type of out blk-mq-tagJens Axboe3-11/+17
We will use it for the pending list in blk-mq core as well. Signed-off-by: Jens Axboe <[email protected]>
2014-05-19block: move ioprio.c from fs/ to block/Jens Axboe2-1/+243
Like commit f9c78b2b, move this block related file outside of fs/ and into the core block directory, block/. Signed-off-by: Jens Axboe <[email protected]>
2014-05-19block: move bio.c and bio-integrity.c from fs/ to block/Jens Axboe3-1/+2697
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 <[email protected]> Acked-by: Al Viro <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-16cgroup: remove css_parent()Tejun Heo1-1/+1
cgroup in general is moving towards using cgroup_subsys_state as the fundamental structural component and css_parent() was introduced to convert from using cgroup->parent to css->parent. It was quite some time ago and we're moving forward with making css more prominent. This patch drops the trivial wrapper css_parent() and let the users dereference css->parent. While at it, explicitly mark fields of css which are public and immutable. v2: New usage from device_cgroup.c converted. Signed-off-by: Tejun Heo <[email protected]> Acked-by: Michal Hocko <[email protected]> Acked-by: Neil Horman <[email protected]> Acked-by: "David S. Miller" <[email protected]> Acked-by: Li Zefan <[email protected]> Cc: Vivek Goyal <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Johannes Weiner <[email protected]>
2014-05-13blk-mq: improve support for shared tags mapsJens Axboe6-27/+224
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 <[email protected]>
2014-05-13cgroup: replace cftype->write_string() with cftype->write()Tejun Heo2-30/+30
Convert all cftype->write_string() users to the new cftype->write() which maps directly to kernfs write operation and has full access to kernfs and cgroup contexts. The conversions are mostly mechanical. * @css and @cft are accessed using of_css() and of_cft() accessors respectively instead of being specified as arguments. * Should return @nbytes on success instead of 0. * @buf is not trimmed automatically. Trim if necessary. Note that blkcg and netprio don't need this as the parsers already handle whitespaces. cftype->write_string() has no user left after the conversions and removed. While at it, remove unnecessary local variable @p in cgroup_subtree_control_write() and stale comment about CGROUP_LOCAL_BUFFER_SIZE in cgroup_freezer.c. This patch doesn't introduce any visible behavior changes. v2: netprio was missing from conversion. Converted. Signed-off-by: Tejun Heo <[email protected]> Acked-by: Aristeu Rozanski <[email protected]> Acked-by: Vivek Goyal <[email protected]> Acked-by: Li Zefan <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Neil Horman <[email protected]> Cc: "David S. Miller" <[email protected]>
2014-05-13cgroup: rename css_tryget*() to css_tryget_online*()Tejun Heo1-1/+1
Unlike the more usual refcnting, what css_tryget() provides is the distinction between online and offline csses instead of protection against upping a refcnt which already reached zero. cgroup is planning to provide actual tryget which fails if the refcnt already reached zero. Let's rename the existing trygets so that they clearly indicate that they're onliness. I thought about keeping the existing names as-are and introducing new names for the planned actual tryget; however, given that each controller participates in the synchronization of the online state, it seems worthwhile to make it explicit that these functions are about on/offline state. Rename css_tryget() to css_tryget_online() and css_tryget_from_dir() to css_tryget_online_from_dir(). This is pure rename. v2: cgroup_freezer grew new usages of css_tryget(). Update accordingly. Signed-off-by: Tejun Heo <[email protected]> Acked-by: Johannes Weiner <[email protected]> Acked-by: Michal Hocko <[email protected]> Acked-by: Li Zefan <[email protected]> Cc: Vivek Goyal <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]>
2014-05-10Merge branch 'for-3.16/blk-mq-tagging' into for-3.16/coreJens Axboe2-25/+41
2014-05-10blk-mq: bitmap tag: cleanup blk_mq_init_tagsMing Lei1-4/+0
Both nr_cache and nr_tags arn't needed for bitmap tag anymore. Signed-off-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-10blk-mq: bitmap tag: select random tag betweet 0 and (depth - 1)Ming Lei1-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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-10blk-mq: bitmap tag: remove barrier in bt_clear_tag()Ming Lei1-1/+0
The barrier isn't necessary because both atomic_dec_and_test() and wake_up() implicate one barrier. Signed-off-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-10blk-mq: bitmap tag: use clear_bit_unlock in bt_clear_tag()Ming Lei1-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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
2014-05-09block: only calculate part_in_flight() onceJens Axboe1-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 <[email protected]>
2014-05-09blk-mq: fix race in IO start accountingJens Axboe1-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 <[email protected]>
2014-05-09blk-mq: use sparser tag layout for lower queue depthJens Axboe2-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 <[email protected]>