On 10/8/19 9:50 AM, Douglas Gilbert wrote: > Replace sg_get_rq_mark() with sg_find_srp_by_id() and > sg_get_ready_srp(). Add sg_chk_mmap() to check flags and > reserve buffer available for mmap() based requests. Add > sg_copy_sense() and sg_rec_v3_state() which is just > refactoring. Add sg_calc_rq_dur() and sg_get_dur() in > preparation for optional nanosecond duration timing. > > Signed-off-by: Douglas Gilbert <dgilbert@xxxxxxxxxxxx> > --- > drivers/scsi/sg.c | 293 +++++++++++++++++++++++++++++++--------------- > 1 file changed, 200 insertions(+), 93 deletions(-) > > diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c > index 4e6f6fb2a54e..7f3a4b937a5a 100644 > --- a/drivers/scsi/sg.c > +++ b/drivers/scsi/sg.c > @@ -158,16 +158,20 @@ struct sg_fd; > > struct sg_request { /* SG_MAX_QUEUE requests outstanding per file */ > struct list_head entry; /* list entry */ > - struct sg_fd *parentfp; /* NULL -> not in use */ > struct sg_scatter_hold data; /* hold buffer, perhaps scatter list */ > struct sg_io_hdr header; /* scsi command+info, see <scsi/sg.h> */ > u8 sense_b[SCSI_SENSE_BUFFERSIZE]; > + u32 duration; /* cmd duration in milliseconds */ > char res_used; /* 1 -> using reserve buffer, 0 -> not ... */ > char orphan; /* 1 -> drop on sight, 0 -> normal */ > char sg_io_owned; /* 1 -> packet belongs to SG_IO */ > /* done protected by rq_list_lock */ > char done; /* 0->before bh, 1->before read, 2->read */ > atomic_t rq_st; /* request state, holds a enum sg_rq_state */ > + u8 cmd_opcode; /* first byte of SCSI cdb */ > + u64 start_ns; /* starting point of command duration calc */ > + unsigned long frq_bm[1]; /* see SG_FRQ_* defines above */ > + struct sg_fd *parentfp; /* pointer to owning fd, even when on fl */ > struct request *rq; /* released in sg_rq_end_io(), bio kept */ > struct bio *bio; /* kept until this req -->SG_RS_INACTIVE */ > struct execute_work ew_orph; /* harvest orphan request */ cmd_opcode is used where? Cheers, Hannes -- Dr. Hannes Reinecke Teamlead Storage & Networking hare@xxxxxxx +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 247165 (AG München), GF: Felix Imendörffer