File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1393,16 +1393,21 @@ static inline void nvme_sq_flush(struct nvme_queue *nvmeq)
13931393/* Submit command to SQ */
13941394static inline void nvme_sq_submit_cmd (struct nvme_queue *nvmeq)
13951395{
1396- __u16 next_tail;
1396+ __u16 next_tail, pending ;
13971397
13981398 if (++nvmeq->sq_tail == nvmeq->qsize )
13991399 nvmeq->sq_tail = 0 ;
14001400
1401- next_tail = nvmeq->sq_tail + 1 ;
1402- if (next_tail == nvmeq->qsize )
1403- next_tail = 0 ;
1404- if (next_tail != nvmeq->last_sq_tail )
1405- return ;
1401+ /* Flush when batch reaches 32 or SQ is full */
1402+ pending = (nvmeq->sq_tail + nvmeq->qsize - nvmeq->last_sq_tail )
1403+ % nvmeq->qsize ;
1404+ if (pending < 32 ) {
1405+ next_tail = nvmeq->sq_tail + 1 ;
1406+ if (next_tail == nvmeq->qsize )
1407+ next_tail = 0 ;
1408+ if (next_tail != nvmeq->last_sq_tail )
1409+ return ;
1410+ }
14061411
14071412 nvme_sq_flush (nvmeq);
14081413}
You can’t perform that action at this time.
0 commit comments