This patchset adds missing functionality to return the offset of non-matching read/compare data in the sense INFORMATION field on COMPARE AND WRITE miscompare. The functionality can be tested using the libiscsi CompareAndWrite.MiscompareSense test proposed via: https://github.com/sahlberg/libiscsi/pull/344 Changes since v3: - (4/4) optimize for equality, as suggested by Doug + perform byte-by-byte offset check only after memcmp() failure + drop Mike's RB tag due to this rework Changes since v2: - perform bad_sector->sense_info rename in overlooked ib_isert - drop scatterlist change queued via Jens' tree - add Mike's reviewed-by tag - rebase against Martin's 5.11/scsi-queue branch Changes since v1: - drop unnecessary WARN_ON() - fix two checkpatch warnings - drop single-use nlbas variable - avoid compare_len recalculation Cheers, David drivers/infiniband/ulp/isert/ib_isert.c | 4 +- drivers/target/target_core_sbc.c | 138 ++++++++++++++---------- drivers/target/target_core_transport.c | 33 +++--- include/target/target_core_base.h | 2 +- 4 files changed, 104 insertions(+), 73 deletions(-)