From: Jens Axboe Date: Wed, 28 May 2014 15:50:26 +0000 (-0600) Subject: Merge branch 'for-3.16/core' into for-3.16/drivers X-Git-Tag: v4.9.8~5950^2~50^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6178976500ae61fa7b12ebb2d3de816dc9396388;p=platform%2Fkernel%2Flinux-rpi3.git Merge branch 'for-3.16/core' into for-3.16/drivers 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 --- 6178976500ae61fa7b12ebb2d3de816dc9396388 diff --cc drivers/block/mtip32xx/mtip32xx.c index ae331ab,59c5abe..ea323e9 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@@ -174,17 -173,44 +174,17 @@@ static bool mtip_check_surprise_removal return false; /* device present */ } -/* - * Obtain an empty command slot. - * - * This function needs to be reentrant since it could be called - * at the same time on multiple CPUs. The allocation of the - * command slot must be atomic. - * - * @port Pointer to the port data structure. - * - * return value - * >= 0 Index of command slot obtained. - * -1 No command slots available. - */ -static int get_slot(struct mtip_port *port) +static struct mtip_cmd *mtip_get_int_command(struct driver_data *dd) { - int slot, i; - unsigned int num_command_slots = port->dd->slot_groups * 32; + struct request *rq; - rq = blk_mq_alloc_reserved_request(dd->queue, 0, __GFP_WAIT); - /* - * Try 10 times, because there is a small race here. - * that's ok, because it's still cheaper than a lock. - * - * Race: Since this section is not protected by lock, same bit - * could be chosen by different process contexts running in - * different processor. So instead of costly lock, we are going - * with loop. - */ - for (i = 0; i < 10; i++) { - slot = find_next_zero_bit(port->allocated, - num_command_slots, 1); - if ((slot < num_command_slots) && - (!test_and_set_bit(slot, port->allocated))) - return slot; - } - dev_warn(&port->dd->pdev->dev, "Failed to get a tag.\n"); ++ rq = blk_mq_alloc_request(dd->queue, 0, __GFP_WAIT, true); + return blk_mq_rq_to_pdu(rq); +} - mtip_check_surprise_removal(port->dd->pdev); - return -1; +static void mtip_put_int_command(struct driver_data *dd, struct mtip_cmd *cmd) +{ + blk_put_request(blk_mq_rq_from_pdu(cmd)); } /*