Features/VirtioSCSI/TCM Overview

From QEMU
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The official website of the in-kernel SCSI target has diagrams and information: http://linux-iscsi.org/. It can be difficult to get an overview, so this page explains the main concepts and gives pointers to the code.

Architecture

The in-kernel SCSI target has frontends, backends, and a core:

Fabric module <-> Target core <-> Backing store

The target core is a SCSI engine that implements the semantics of a SCSI target described in the SCSI Architecture Model (SAM). The target core does not directly communicate with initiators and it does not directly access data on disk.

Fabric modules implement the frontend of the SCSI target. The speak specific protocols that transport SCSI commands. For example, the iSCSI fabric module implements the iSCSI server and protocol.

Backing stores implement methods of accessing data on disk. This includes RAM disk, file, block device, and SCSI pass-through.

This architecture allows the target core to be independent of the fabric (e.g. iSCSI, FibreChannel, virtio-scsi, etc) and backing storage (e.g. RAM disk, file, SCSI pass-through).

tcm_vhost is a fabric module. It connects a KVM guest with the in-kernel target, allowing SCSI commands and responses to be exchanged. More precisely, it uses existing vhost infrastructure to implement the virtio-scsi device.

Code

The in-kernel SCSI target is located in drivers/target/ in the Linux source tree.

Interesting files and directories include:

  • target_core_transport.c - SCSI task execution model
  • target_core_device.c - device and LUN relationships
  • target_core_iblock.c - Linux block device backing store
  • target_core_pscsi.c - SCSI pass-through backing store
  • iscsi/ - iSCSI fabric module
  • tcm_vhost/ - tcm_vhost fabric module