/* *sdevstate:Ifyoualterthis,youalsoneedtoalterscsi_sysfs.c *(fortheasciidescriptions)andthestatemodelenforcer: *scsi_lib:scsi_device_set_state().
*/ enum scsi_device_state {
SDEV_CREATED = 1, /* device created but not added to sysfs
* Only internal commands allowed (for inq) */
SDEV_RUNNING, /* device properly configured
* All commands allowed */
SDEV_CANCEL, /* beginning to delete device
* Only error handler commands allowed */
SDEV_DEL, /* device deleted
* no commands allowed */
SDEV_QUIESCE, /* Device quiescent. No block commands *willbeaccepted,onlyspecials(which
* originate in the mid-layer) */
SDEV_OFFLINE, /* Device offlined (by error handling or
* user request */
SDEV_TRANSPORT_OFFLINE, /* Offlined by transport class error handler */
SDEV_BLOCK, /* Device blocked by scsi lld. No *scsicommandsfromuserormidlayer *shouldbeissuedtothescsi
* lld. */
SDEV_CREATED_BLOCK, /* same as above but for created devices */
};
/* the next two are protected by the host->host_lock */ struct list_head siblings; /* list of all devices on this host */ struct list_head same_target_siblings; /* just the devices sharing same target id */
struct sbitmap budget_map;
atomic_t device_blocked; /* Device returned QUEUE_FULL. */
atomic_t restarts;
spinlock_t list_lock; struct list_head starved_entry; unsignedshort queue_depth; /* How deep of a queue we want */ unsignedshort max_queue_depth; /* max queue depth */ unsignedshort last_queue_full_depth; /* These two are used by */ unsignedshort last_queue_full_count; /* scsi_track_queue_full() */ unsignedlong last_queue_full_time; /* last queue full time */ unsignedlong queue_ramp_up_period; /* ramp up period in jiffies */ #define SCSI_DEFAULT_RAMP_UP_PERIOD (120 * HZ)
unsignedlong last_queue_ramp_up; /* last queue ramp up time */
unsignedint id, channel;
u64 lun; unsignedint manufacturer; /* Manufacturer of device, for using
* vendor-specific cmd's */ unsigned sector_size; /* size in bytes */
void *hostdata; /* available to low-level driver */ unsignedchar type; char scsi_level; char inq_periph_qual; /* PQ from INQUIRY data */ struct mutex inquiry_mutex; unsignedchar inquiry_len; /* valid bytes in 'inquiry' */ unsignedchar * inquiry; /* INQUIRY response data */ constchar * vendor; /* [back_compat] point into 'inquiry' ... */ constchar * model; /* ... after scan; point to static string */ constchar * rev; /* ... "nullnullnullnull" before scan */
unsigned removable:1; unsigned changed:1; /* Data invalid due to media change */ unsigned busy:1; /* Used to prevent races */ unsigned lockable:1; /* Able to prevent media removal */ unsigned locked:1; /* Media removal disabled */ unsigned borken:1; /* Tell the Seagate driver to be
* painfully slow on this device */ unsigned disconnect:1; /* can disconnect */ unsigned soft_reset:1; /* Uses soft reset option */ unsigned sdtr:1; /* Device supports SDTR messages */ unsigned wdtr:1; /* Device supports WDTR messages */ unsigned ppr:1; /* Device supports PPR messages */ unsigned tagged_supported:1; /* Supports SCSI-II tagged queuing */ unsigned simple_tags:1; /* simple queue tag messages are enabled */ unsigned was_reset:1; /* There was a bus reset on the bus for
* this device */ unsigned expecting_cc_ua:1; /* Expecting a CHECK_CONDITION/UNIT_ATTN
* because we did a bus reset. */ unsigned use_10_for_rw:1; /* first try 10-byte read / write */ unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */ unsigned set_dbd_for_ms:1; /* Set "DBD" field in mode sense */ unsigned read_before_ms:1; /* perform a READ before MODE SENSE */ unsigned no_report_opcodes:1; /* no REPORT SUPPORTED OPERATION CODES */ unsigned no_write_same:1; /* no WRITE SAME command */ unsigned use_16_for_rw:1; /* Use read/write(16) over read/write(10) */ unsigned use_16_for_sync:1; /* Use sync (16) over sync (10) */ unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */ unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */ unsigned skip_vpd_pages:1; /* do not read VPD pages */ unsigned try_vpd_pages:1; /* attempt to read VPD pages */ unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */ unsigned no_start_on_add:1; /* do not issue start on add */ unsigned allow_restart:1; /* issue START_UNIT in error handler */ unsigned start_stop_pwr_cond:1; /* Set power cond. in START_STOP_UNIT */ unsigned no_uld_attach:1; /* disable connecting to upper level drivers */ unsigned select_no_atn:1; unsigned fix_capacity:1; /* READ_CAPACITY is too high by 1 */ unsigned guess_capacity:1; /* READ_CAPACITY might be too high by 1 */ unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */ unsigned last_sector_bug:1; /* do not use multisector accesses on
SD_LAST_BUGGY_SECTORS */ unsigned no_read_disc_info:1; /* Avoid READ_DISC_INFO cmds */ unsigned no_read_capacity_16:1; /* Avoid READ_CAPACITY_16 cmds */ unsigned try_rc_10_first:1; /* Try READ_CAPACACITY_10 first */ unsigned security_supported:1; /* Supports Security Protocols */ unsigned is_visible:1; /* is the device visible in sysfs */ unsigned wce_default_on:1; /* Cache is ON by default */ unsigned no_dif:1; /* T10 PI (DIF) should be disabled */ unsigned broken_fua:1; /* Don't set FUA bit */ unsigned lun_in_cdb:1; /* Store LUN bits in CDB[1] */ unsigned unmap_limit_for_ws:1; /* Use the UNMAP limit for WRITE SAME */ unsigned rpm_autosuspend:1; /* Enable runtime autosuspend at device
* creation time */ unsigned ignore_media_change:1; /* Ignore MEDIA CHANGE on resume */ unsigned silence_suspend:1; /* Do not print runtime PM related messages */ unsigned no_vpd_size:1; /* No VPD size reported in header */
/* *scsi_target:representationofascsitarget,fornow,thisisonly *usedforsingle_lundevices.IfnoonehasactiveIOtothetarget, *starget_sdev_userisNULL,elseitpointstotheactivesdev.
*/ struct scsi_target { struct scsi_device *starget_sdev_user; struct list_head siblings; struct list_head devices; struct device dev; struct kref reap_ref; /* last put renders target invisible */ unsignedint channel; unsignedint id; /* target id ... replace
* scsi_device.id eventually */ unsignedint create:1; /* signal that it needs to be added */ unsignedint single_lun:1; /* Indicates we should only *allowI/Otooneoftheluns
* for the device at a time. */ unsignedint pdt_1f_for_no_lun:1; /* PDT = 0x1f
* means no lun present. */ unsignedint no_report_luns:1; /* Don't use
* REPORT LUNS for scanning. */ unsignedint expecting_lun_change:1; /* A device has reported *a3F/0EUA,otherdeviceson
* the same target will also. */ /* commands actually active on LLD. */
atomic_t target_busy;
atomic_t target_blocked;
char scsi_level; enum scsi_target_state state; void *hostdata; /* available to low-level driver */ unsignedlong starget_data[]; /* for the transport */ /* starget_data must be the last element!!!! */
} __attribute__((aligned(sizeof(unsignedlong))));
struct scsi_failure { int result;
u8 sense;
u8 asc;
u8 ascq; /* *Numberoftimesscsi_execute_cmdwillretrythefailure.Itdoes *notcountforthetotal_allowed.
*/
s8 allowed; /* Number of times the failure has been retried. */
s8 retries;
};
struct scsi_failures { /* *Ifascsi_failuredoesnothavearetrylimitsetupthislimitwill *beused.
*/ int total_allowed; int total_retries; struct scsi_failure *failure_definitions;
};
/* Optional arguments to scsi_execute_cmd */ struct scsi_exec_args { unsignedchar *sense; /* sense buffer */ unsignedint sense_len; /* sense buffer len */ struct scsi_sense_hdr *sshdr; /* decoded sense header */
blk_mq_req_flags_t req_flags; /* BLK_MQ_REQ flags */ int scmd_flags; /* SCMD flags */ int *resid; /* residual length */ struct scsi_failures *failures; /* failures to retry */
};
int scsi_execute_cmd(struct scsi_device *sdev, constunsignedchar *cmd,
blk_opf_t opf, void *buffer, unsignedint bufflen, int timeout, int retries, conststruct scsi_exec_args *args); void scsi_failures_reset_retries(struct scsi_failures *failures);
/* Macros to access the UNIT ATTENTION counters */ #define scsi_get_ua_new_media_ctr(sdev) atomic_read(&sdev->ua_new_media_ctr) #define scsi_get_ua_por_ctr(sdev) atomic_read(&sdev->ua_por_ctr)
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.17Bemerkung:
(vorverarbeitet am 2026-09-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.