Skip to content

Commit d4d0f5f

Browse files
KAGA-KOKOaxboe
authored andcommitted
skd: Remove skd_device.in_flight
Since skd_device.in_flight is only used to display the number of in-flight requests in debug messages, remove that member and introduce skd_in_flight(). That last function relies on the block layer to determine the number of in flight requests. 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>
1 parent a74d5b7 commit d4d0f5f

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

drivers/block/skd_main.c

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ struct skd_device {
238238
enum skd_drvr_state state;
239239
u32 drive_state;
240240

241-
atomic_t in_flight;
242241
u32 cur_max_queue_depth;
243242
u32 queue_low_water_mark;
244243
u32 dev_max_queue_depth;
@@ -391,6 +390,22 @@ static void skd_log_skreq(struct skd_device *skdev,
391390
* READ/WRITE REQUESTS
392391
*****************************************************************************
393392
*/
393+
static void skd_inc_in_flight(struct request *rq, void *data, bool reserved)
394+
{
395+
int *count = data;
396+
397+
count++;
398+
}
399+
400+
static int skd_in_flight(struct skd_device *skdev)
401+
{
402+
int count = 0;
403+
404+
blk_mq_tagset_busy_iter(&skdev->tag_set, skd_inc_in_flight, &count);
405+
406+
return count;
407+
}
408+
394409
static void
395410
skd_prep_rw_cdb(struct skd_scsi_request *scsi_req,
396411
int data_dir, unsigned lba,
@@ -567,9 +582,8 @@ static void skd_process_request(struct request *req, bool last)
567582
skmsg->length += sizeof(struct skd_scsi_request);
568583
fmh->num_protocol_cmds_coalesced++;
569584

570-
atomic_inc(&skdev->in_flight);
571585
dev_dbg(&skdev->pdev->dev, "req=0x%x busy=%d\n", skreq->id,
572-
atomic_read(&skdev->in_flight));
586+
skd_in_flight(skdev));
573587

574588
/*
575589
* If the FIT msg buffer is full send it.
@@ -1218,7 +1232,7 @@ static void skd_send_fitmsg(struct skd_device *skdev,
12181232
u64 qcmd;
12191233

12201234
dev_dbg(&skdev->pdev->dev, "dma address 0x%llx, busy=%d\n",
1221-
skmsg->mb_dma_address, atomic_read(&skdev->in_flight));
1235+
skmsg->mb_dma_address, skd_in_flight(skdev));
12221236
dev_dbg(&skdev->pdev->dev, "msg_buf %p\n", skmsg->msg_buf);
12231237

12241238
qcmd = skmsg->mb_dma_address;
@@ -1451,13 +1465,6 @@ static void skd_resolve_req_exception(struct skd_device *skdev,
14511465
static void skd_release_skreq(struct skd_device *skdev,
14521466
struct skd_request_context *skreq)
14531467
{
1454-
/*
1455-
* Decrease the number of active requests.
1456-
* Also decrements the count in the timeout slot.
1457-
*/
1458-
SKD_ASSERT(atomic_read(&skdev->in_flight) > 0);
1459-
atomic_dec(&skdev->in_flight);
1460-
14611468
/*
14621469
* Reclaim the skd_request_context
14631470
*/
@@ -1498,7 +1505,7 @@ static int skd_isr_completion_posted(struct skd_device *skdev,
14981505
dev_dbg(&skdev->pdev->dev,
14991506
"cycle=%d ix=%d got cycle=%d cmdctxt=0x%x stat=%d busy=%d rbytes=0x%x proto=%d\n",
15001507
skdev->skcomp_cycle, skdev->skcomp_ix, cmp_cycle,
1501-
cmp_cntxt, cmp_status, atomic_read(&skdev->in_flight),
1508+
cmp_cntxt, cmp_status, skd_in_flight(skdev),
15021509
cmp_bytes, skdev->proto_ver);
15031510

15041511
if (cmp_cycle != skdev->skcomp_cycle) {
@@ -1590,7 +1597,7 @@ static int skd_isr_completion_posted(struct skd_device *skdev,
15901597
}
15911598

15921599
if (skdev->state == SKD_DRVR_STATE_PAUSING &&
1593-
atomic_read(&skdev->in_flight) == 0) {
1600+
skd_in_flight(skdev) == 0) {
15941601
skdev->state = SKD_DRVR_STATE_PAUSED;
15951602
wake_up_interruptible(&skdev->waitq);
15961603
}
@@ -1929,8 +1936,6 @@ static void skd_recover_request(struct request *req, void *data, bool reserved)
19291936
static void skd_recover_requests(struct skd_device *skdev)
19301937
{
19311938
blk_mq_tagset_busy_iter(&skdev->tag_set, skd_recover_request, skdev);
1932-
1933-
atomic_set(&skdev->in_flight, 0);
19341939
}
19351940

19361941
static void skd_isr_msg_from_dev(struct skd_device *skdev)
@@ -3560,7 +3565,7 @@ static void skd_log_skdev(struct skd_device *skdev, const char *event)
35603565
skd_drive_state_to_str(skdev->drive_state), skdev->drive_state,
35613566
skd_skdev_state_to_str(skdev->state), skdev->state);
35623567
dev_dbg(&skdev->pdev->dev, " busy=%d limit=%d dev=%d lowat=%d\n",
3563-
atomic_read(&skdev->in_flight), skdev->cur_max_queue_depth,
3568+
skd_in_flight(skdev), skdev->cur_max_queue_depth,
35643569
skdev->dev_max_queue_depth, skdev->queue_low_water_mark);
35653570
dev_dbg(&skdev->pdev->dev, " cycle=%d cycle_ix=%d\n",
35663571
skdev->skcomp_cycle, skdev->skcomp_ix);

0 commit comments

Comments
 (0)