summaryrefslogtreecommitdiffstats
path: root/drivers/block/skd_main.c
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@wdc.com>2017-08-17 13:13:37 -0700
committerJens Axboe <axboe@kernel.dk>2017-08-18 08:45:29 -0600
commit74c74282c554f48f6a24b5050e486db5202fc1a2 (patch)
treef83b8c993f5b6704b4d60dda26bbf56a8cadbde9 /drivers/block/skd_main.c
parente2bb5548279a95cf5b2ecc7cb070a743aade3445 (diff)
downloadlinux-74c74282c554f48f6a24b5050e486db5202fc1a2.tar.bz2
skd: Optimize locking
Only take skdev->lock if necessary. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.de> Cc: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/skd_main.c')
-rw-r--r--drivers/block/skd_main.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index a732bb8040f4..bcd8df0bf203 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -490,7 +490,7 @@ static void skd_process_request(struct request *req, bool last)
const u32 tag = blk_mq_unique_tag(req);
struct skd_request_context *const skreq = blk_mq_rq_to_pdu(req);
struct skd_scsi_request *scsi_req;
- unsigned long flags;
+ unsigned long flags = 0;
const u32 lba = blk_rq_pos(req);
const u32 count = blk_rq_sectors(req);
const int data_dir = rq_data_dir(req);
@@ -525,9 +525,13 @@ static void skd_process_request(struct request *req, bool last)
sizeof(struct fit_sg_descriptor),
DMA_TO_DEVICE);
- spin_lock_irqsave(&skdev->lock, flags);
/* Either a FIT msg is in progress or we have to start one. */
- skmsg = skdev->skmsg;
+ if (skd_max_req_per_msg == 1) {
+ skmsg = NULL;
+ } else {
+ spin_lock_irqsave(&skdev->lock, flags);
+ skmsg = skdev->skmsg;
+ }
if (!skmsg) {
skmsg = &skdev->skmsg_table[tag];
skdev->skmsg = skmsg;
@@ -574,11 +578,16 @@ static void skd_process_request(struct request *req, bool last)
/*
* If the FIT msg buffer is full send it.
*/
- if (last || fmh->num_protocol_cmds_coalesced >= skd_max_req_per_msg) {
+ if (skd_max_req_per_msg == 1) {
skd_send_fitmsg(skdev, skmsg);
- skdev->skmsg = NULL;
+ } else {
+ if (last ||
+ fmh->num_protocol_cmds_coalesced >= skd_max_req_per_msg) {
+ skd_send_fitmsg(skdev, skmsg);
+ skdev->skmsg = NULL;
+ }
+ spin_unlock_irqrestore(&skdev->lock, flags);
}
- spin_unlock_irqrestore(&skdev->lock, flags);
}
static blk_status_t skd_mq_queue_rq(struct blk_mq_hw_ctx *hctx,