diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -4923,8 +4923,7 @@ int retval; CTL_DEBUG_PRINT(("ctl_config_move_done\n")); - KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, - ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); + CTL_IO_ASSERT_SCSI(io); if (ctl_debug & CTL_DEBUG_CDB_DATA) ctl_data_print(io); @@ -10560,8 +10559,7 @@ ctl_get_lba_len(union ctl_io *io, uint64_t *lba, uint64_t *len) { - KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, - ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); + CTL_IO_ASSERT_SCSI(io); switch (io->scsiio.cdb[0]) { case COMPARE_AND_WRITE: { @@ -10741,8 +10739,7 @@ uint64_t lba; uint32_t len; - KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, - ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); + CTL_IO_ASSERT_SCSI(io); /* If not UNMAP -- go other way. */ if (io->scsiio.cdb[0] != UNMAP) @@ -12323,8 +12320,7 @@ struct bintime cur_bt; #endif - KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, - ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); + CTL_IO_ASSERT_SCSI(io); #ifdef CTL_TIME_IO getbinuptime(&cur_bt); diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -1819,8 +1819,7 @@ be_lun = (struct ctl_be_block_lun *)CTL_BACKEND_LUN(io); - KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, - ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); + CTL_IO_ASSERT_SCSI(io); PRIV(io)->len = 0; diff --git a/sys/cam/ctl/ctl_io.h b/sys/cam/ctl/ctl_io.h --- a/sys/cam/ctl/ctl_io.h +++ b/sys/cam/ctl/ctl_io.h @@ -592,6 +592,9 @@ }; #ifdef _KERNEL +#define CTL_IO_ASSERT_SCSI(io) \ + KASSERT((io)->io_hdr.io_type == CTL_IO_SCSI, \ + ("%s: unexpected I/O type %x", __func__, (io)->io_hdr.io_type)) union ctl_io *ctl_alloc_io(void *pool_ref); union ctl_io *ctl_alloc_io_nowait(void *pool_ref); diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -1908,8 +1908,7 @@ struct cam_periph *periph; struct ctlfe_lun_softc *softc; - KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, - ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); + CTL_IO_ASSERT_SCSI(io); io->scsiio.ext_data_filled = 0; ccb = PRIV_CCB(io);