Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: target: Add atomic support to target_core_iblock

Make target_core_iblock use the LIO helper function to translate its
block_device atomic settings to LIO settings. If we then get a write
that LIO has indicated is atomic via the SCF_ATOMIC flag, we use the
REQ_ATOMIC flag to tell the block layer to perform an atomic write.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Link: https://patch.msgid.link/20251020103820.2917593-8-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Mike Christie and committed by
Martin K. Petersen
8e62d8f4 2d966888

+5
+5
drivers/target/target_core_iblock.c
··· 152 152 if (bdev_nonrot(bd)) 153 153 dev->dev_attrib.is_nonrot = 1; 154 154 155 + target_configure_write_atomic_from_bdev(&dev->dev_attrib, bd); 156 + 155 157 bi = bdev_get_integrity(bd); 156 158 if (!bi) 157 159 return 0; ··· 775 773 else if (!bdev_write_cache(ib_dev->ibd_bd)) 776 774 opf |= REQ_FUA; 777 775 } 776 + 777 + if (cmd->se_cmd_flags & SCF_ATOMIC) 778 + opf |= REQ_ATOMIC; 778 779 } else { 779 780 opf = REQ_OP_READ; 780 781 miter_dir = SG_MITER_FROM_SG;