Skip to content

Commit 84c073f

Browse files
mikechristiemartinkpetersen
authored andcommitted
scsi: target: Fix write perf due to unneeded throttling
The write back throttling (WBT) code checks if REQ_SYNC | REQ_IDLE is set to determine if a write is O_DIRECT vs buffered. If the bits are not set then it assumes it's a buffered write and will throttle LIO if we hit certain metrics. LIO itself is not using the buffer cache and is doing direct I/O, so this has us set the direct bits so we are not throttled. When the initiator application is doing direct I/O this can greatly improve performance. It depends on the backend device but we have seen where the WBT code is throttling writes to only 20K IOPs with 4K I/Os when the device can support 100K+. Signed-off-by: Mike Christie <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 19d7102 commit 84c073f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/target/target_core_iblock.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,11 +740,16 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
740740

741741
if (data_direction == DMA_TO_DEVICE) {
742742
struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
743+
744+
/*
745+
* Set bits to indicate WRITE_ODIRECT so we are not throttled
746+
* by WBT.
747+
*/
748+
opf = REQ_OP_WRITE | REQ_SYNC | REQ_IDLE;
743749
/*
744750
* Force writethrough using REQ_FUA if a volatile write cache
745751
* is not enabled, or if initiator set the Force Unit Access bit.
746752
*/
747-
opf = REQ_OP_WRITE;
748753
miter_dir = SG_MITER_TO_SG;
749754
if (bdev_fua(ib_dev->ibd_bd)) {
750755
if (cmd->se_cmd_flags & SCF_FUA)

0 commit comments

Comments
 (0)