Skip to content

Commit 9cb78c1

Browse files
hreineckeChristoph Hellwig
authored andcommitted
scsi: use 64-bit LUNs
The SCSI standard defines 64-bit values for LUNs, and large arrays employing large or hierarchical LUN numbers become more and more common. So update the linux SCSI stack to use 64-bit LUN numbers. Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Christoph Hellwig <hch@infradead.org> Reviewed-by: Ewan Milne <emilne@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 755f516 commit 9cb78c1

86 files changed

Lines changed: 438 additions & 429 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/ata/libata-scsi.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3945,7 +3945,7 @@ void ata_scsi_hotplug(struct work_struct *work)
39453945
* Zero.
39463946
*/
39473947
int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
3948-
unsigned int id, unsigned int lun)
3948+
unsigned int id, u64 lun)
39493949
{
39503950
struct ata_port *ap = ata_shost_to_port(shost);
39513951
unsigned long flags;

‎drivers/ata/libata.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ extern void ata_schedule_scsi_eh(struct Scsi_Host *shost);
144144
extern void ata_scsi_dev_rescan(struct work_struct *work);
145145
extern int ata_bus_probe(struct ata_port *ap);
146146
extern int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
147-
unsigned int id, unsigned int lun);
147+
unsigned int id, u64 lun);
148148

149149

150150
/* libata-eh.c */

‎drivers/message/fusion/mptbase.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ typedef struct _VirtTarget {
405405
typedef struct _VirtDevice {
406406
VirtTarget *vtarget;
407407
u8 configured_lun;
408-
int lun;
408+
u64 lun;
409409
} VirtDevice;
410410

411411
/*

‎drivers/message/fusion/mptfc.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
204204
|| (loops > 0 && ioc->active == 0)) {
205205
spin_unlock_irqrestore(shost->host_lock, flags);
206206
dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
207-
"mptfc_block_error_handler.%d: %d:%d, port status is "
207+
"mptfc_block_error_handler.%d: %d:%llu, port status is "
208208
"%x, active flag %d, deferring %s recovery.\n",
209209
ioc->name, ioc->sh->host_no,
210210
SCpnt->device->id, SCpnt->device->lun,
@@ -218,15 +218,15 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
218218
if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata
219219
|| ioc->active == 0) {
220220
dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
221-
"%s.%d: %d:%d, failing recovery, "
221+
"%s.%d: %d:%llu, failing recovery, "
222222
"port state %x, active %d, vdevice %p.\n", caller,
223223
ioc->name, ioc->sh->host_no,
224224
SCpnt->device->id, SCpnt->device->lun, ready,
225225
ioc->active, SCpnt->device->hostdata));
226226
return FAILED;
227227
}
228228
dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
229-
"%s.%d: %d:%d, executing recovery.\n", caller,
229+
"%s.%d: %d:%llu, executing recovery.\n", caller,
230230
ioc->name, ioc->sh->host_no,
231231
SCpnt->device->id, SCpnt->device->lun));
232232
return (*func)(SCpnt);

‎drivers/message/fusion/mptscsih.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static void mptscsih_freeChainBuffers(MPT_ADAPTER *ioc, int req_idx);
9595
static void mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR *mf, SCSIIOReply_t *pScsiReply);
9696

9797
int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id,
98-
int lun, int ctx2abort, ulong timeout);
98+
u64 lun, int ctx2abort, ulong timeout);
9999

100100
int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
101101
int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
@@ -536,7 +536,7 @@ mptscsih_info_scsiio(MPT_ADAPTER *ioc, struct scsi_cmnd *sc, SCSIIOReply_t * pSc
536536
}
537537

538538
scsi_print_command(sc);
539-
printk(MYIOC_s_DEBUG_FMT "\tfw_channel = %d, fw_id = %d, lun = %d\n",
539+
printk(MYIOC_s_DEBUG_FMT "\tfw_channel = %d, fw_id = %d, lun = %llu\n",
540540
ioc->name, pScsiReply->Bus, pScsiReply->TargetID, sc->device->lun);
541541
printk(MYIOC_s_DEBUG_FMT "\trequest_len = %d, underflow = %d, "
542542
"resid = %d\n", ioc->name, scsi_bufflen(sc), sc->underflow,
@@ -692,7 +692,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
692692
*/
693693
if (scsi_state & MPI_SCSI_STATE_RESPONSE_INFO_VALID &&
694694
pScsiReply->ResponseInfo) {
695-
printk(MYIOC_s_NOTE_FMT "[%d:%d:%d:%d] "
695+
printk(MYIOC_s_NOTE_FMT "[%d:%d:%d:%llu] "
696696
"FCP_ResponseInfo=%08xh\n", ioc->name,
697697
sc->device->host->host_no, sc->device->channel,
698698
sc->device->id, sc->device->lun,
@@ -1155,7 +1155,7 @@ mptscsih_report_queue_full(struct scsi_cmnd *sc, SCSIIOReply_t *pScsiReply, SCSI
11551155
return;
11561156
ioc = hd->ioc;
11571157
if (time - hd->last_queue_full > 10 * HZ) {
1158-
dprintk(ioc, printk(MYIOC_s_WARN_FMT "Device (%d:%d:%d) reported QUEUE_FULL!\n",
1158+
dprintk(ioc, printk(MYIOC_s_WARN_FMT "Device (%d:%d:%llu) reported QUEUE_FULL!\n",
11591159
ioc->name, 0, sc->device->id, sc->device->lun));
11601160
hd->last_queue_full = time;
11611161
}
@@ -1518,7 +1518,7 @@ mptscsih_freeChainBuffers(MPT_ADAPTER *ioc, int req_idx)
15181518
*
15191519
**/
15201520
int
1521-
mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun,
1521+
mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, u64 lun,
15221522
int ctx2abort, ulong timeout)
15231523
{
15241524
MPT_FRAME_HDR *mf;
@@ -2380,7 +2380,7 @@ mptscsih_slave_configure(struct scsi_device *sdev)
23802380
vdevice = sdev->hostdata;
23812381

23822382
dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2383-
"device @ %p, channel=%d, id=%d, lun=%d\n",
2383+
"device @ %p, channel=%d, id=%d, lun=%llu\n",
23842384
ioc->name, sdev, sdev->channel, sdev->id, sdev->lun));
23852385
if (ioc->bus_type == SPI)
23862386
dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
@@ -2971,7 +2971,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io)
29712971
+ (my_idx * MPT_SENSE_BUFFER_ALLOC));
29722972

29732973
devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2974-
"%s: Sending Command 0x%02x for fw_channel=%d fw_id=%d lun=%d\n",
2974+
"%s: Sending Command 0x%02x for fw_channel=%d fw_id=%d lun=%llu\n",
29752975
ioc->name, __func__, cmd, io->channel, io->id, io->lun));
29762976

29772977
if (dir == MPI_SCSIIO_CONTROL_READ)

‎drivers/message/fusion/mptscsih.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ typedef struct _internal_cmd {
9898
u8 cmd; /* SCSI Op Code */
9999
u8 channel; /* bus number */
100100
u8 id; /* SCSI ID (virtual) */
101-
int lun;
101+
u64 lun;
102102
u8 flags; /* Bit Field - See above */
103103
u8 physDiskNum; /* Phys disk number, -1 else */
104104
u8 rsvd2;
@@ -115,7 +115,7 @@ extern int mptscsih_show_info(struct seq_file *, struct Scsi_Host *);
115115
extern const char * mptscsih_info(struct Scsi_Host *SChost);
116116
extern int mptscsih_qcmd(struct scsi_cmnd *SCpnt);
117117
extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel,
118-
u8 id, int lun, int ctx2abort, ulong timeout);
118+
u8 id, u64 lun, int ctx2abort, ulong timeout);
119119
extern void mptscsih_slave_destroy(struct scsi_device *device);
120120
extern int mptscsih_slave_configure(struct scsi_device *device);
121121
extern int mptscsih_abort(struct scsi_cmnd * SCpnt);

‎drivers/message/i2o/i2o_scsi.c‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static unsigned int i2o_scsi_max_lun = 255;
7878
struct i2o_scsi_host {
7979
struct Scsi_Host *scsi_host; /* pointer to the SCSI host */
8080
struct i2o_controller *iop; /* pointer to the I2O controller */
81-
unsigned int lun; /* lun's used for block devices */
81+
u64 lun; /* lun's used for block devices */
8282
struct i2o_device *channel[0]; /* channel->i2o_dev mapping table */
8383
};
8484

@@ -287,9 +287,8 @@ static int i2o_scsi_probe(struct device *dev)
287287
}
288288

289289
if (le64_to_cpu(lun) >= scsi_host->max_lun) {
290-
osm_warn("SCSI device lun (%lu) >= max_lun of I2O host (%d)",
291-
(long unsigned int)le64_to_cpu(lun),
292-
scsi_host->max_lun);
290+
osm_warn("SCSI device lun (%llu) >= max_lun of I2O host (%d)",
291+
le64_to_cpu(lun), scsi_host->max_lun);
293292
return -EFAULT;
294293
}
295294

@@ -308,9 +307,9 @@ static int i2o_scsi_probe(struct device *dev)
308307
if (rc)
309308
goto err;
310309

311-
osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %ld\n",
310+
osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %llu\n",
312311
i2o_dev->lct_data.tid, channel, le32_to_cpu(id),
313-
(long unsigned int)le64_to_cpu(lun));
312+
le64_to_cpu(lun));
314313

315314
return 0;
316315

‎drivers/s390/scsi/zfcp_dbf.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,8 @@ void zfcp_dbf_scsi(char *tag, struct scsi_cmnd *sc, struct zfcp_fsf_req *fsf)
418418
rec->scsi_retries = sc->retries;
419419
rec->scsi_allowed = sc->allowed;
420420
rec->scsi_id = sc->device->id;
421-
rec->scsi_lun = sc->device->lun;
421+
/* struct zfcp_dbf_scsi needs to be updated to handle 64bit LUNs */
422+
rec->scsi_lun = (u32)sc->device->lun;
422423
rec->host_scribble = (unsigned long)sc->host_scribble;
423424

424425
memcpy(rec->scsi_opcode, sc->cmnd,

‎drivers/s390/scsi/zfcp_unit.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
void zfcp_unit_scsi_scan(struct zfcp_unit *unit)
2222
{
2323
struct fc_rport *rport = unit->port->rport;
24-
unsigned int lun;
24+
u64 lun;
2525

2626
lun = scsilun_to_int((struct scsi_lun *) &unit->fcp_lun);
2727

@@ -188,7 +188,7 @@ struct scsi_device *zfcp_unit_sdev(struct zfcp_unit *unit)
188188
{
189189
struct Scsi_Host *shost;
190190
struct zfcp_port *port;
191-
unsigned int lun;
191+
u64 lun;
192192

193193
lun = scsilun_to_int((struct scsi_lun *) &unit->fcp_lun);
194194
port = unit->port;

‎drivers/scsi/53c700.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
10051005
DMA_TO_DEVICE);
10061006

10071007
cmnd[0] = REQUEST_SENSE;
1008-
cmnd[1] = (SCp->device->lun & 0x7) << 5;
1008+
cmnd[1] = (lun & 0x7) << 5;
10091009
cmnd[2] = 0;
10101010
cmnd[3] = 0;
10111011
cmnd[4] = SCSI_SENSE_BUFFERSIZE;
@@ -1396,7 +1396,8 @@ NCR_700_start_command(struct scsi_cmnd *SCp)
13961396
struct NCR_700_Host_Parameters *hostdata =
13971397
(struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0];
13981398
__u16 count = 1; /* for IDENTIFY message */
1399-
1399+
u8 lun = SCp->device->lun;
1400+
14001401
if(hostdata->state != NCR_700_HOST_FREE) {
14011402
/* keep this inside the lock to close the race window where
14021403
* the running command finishes on another CPU while we don't
@@ -1415,7 +1416,7 @@ NCR_700_start_command(struct scsi_cmnd *SCp)
14151416

14161417
hostdata->msgout[0] = NCR_700_identify((SCp->cmnd[0] != REQUEST_SENSE &&
14171418
slot->flags != NCR_700_FLAG_AUTOSENSE),
1418-
SCp->device->lun);
1419+
lun);
14191420
/* for INQUIRY or REQUEST_SENSE commands, we cannot be sure
14201421
* if the negotiated transfer parameters still hold, so
14211422
* always renegotiate them */

0 commit comments

Comments
 (0)