Commit 8f05b672 authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] give scsi_allocate_request a gfp_mask

most callers really want GFP_KERNEL, not GFP_ATOMIC.
parent 5c8dc888
...@@ -603,7 +603,7 @@ int cpqfcTS_ioctl( struct scsi_device *ScsiDev, int Cmnd, void *arg) ...@@ -603,7 +603,7 @@ int cpqfcTS_ioctl( struct scsi_device *ScsiDev, int Cmnd, void *arg)
return -ENOMEM; return -ENOMEM;
} }
// Now build a Scsi_Request to pass down... // Now build a Scsi_Request to pass down...
ScsiPassThruReq = scsi_allocate_request(ScsiDev); ScsiPassThruReq = scsi_allocate_request(ScsiDev, GFP_KERNEL);
if (ScsiPassThruReq == NULL) { if (ScsiPassThruReq == NULL) {
kfree(buf); kfree(buf);
return -ENOMEM; return -ENOMEM;
......
...@@ -4990,7 +4990,7 @@ static int ioc_resetdrv(unsigned long arg, char *cmnd) ...@@ -4990,7 +4990,7 @@ static int ioc_resetdrv(unsigned long arg, char *cmnd)
cmd.u.cache.DeviceNo = res.number; cmd.u.cache.DeviceNo = res.number;
#if LINUX_VERSION_CODE >= 0x020503 #if LINUX_VERSION_CODE >= 0x020503
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]); sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
srp = scsi_allocate_request(sdev); srp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!srp) if (!srp)
return -ENOMEM; return -ENOMEM;
srp->sr_cmd_len = 12; srp->sr_cmd_len = 12;
...@@ -5091,7 +5091,7 @@ static int ioc_general(unsigned long arg, char *cmnd) ...@@ -5091,7 +5091,7 @@ static int ioc_general(unsigned long arg, char *cmnd)
#if LINUX_VERSION_CODE >= 0x020503 #if LINUX_VERSION_CODE >= 0x020503
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]); sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
srp = scsi_allocate_request(sdev); srp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!srp) if (!srp)
return -ENOMEM; return -ENOMEM;
srp->sr_cmd_len = 12; srp->sr_cmd_len = 12;
...@@ -5164,7 +5164,7 @@ static int ioc_hdrlist(unsigned long arg, char *cmnd) ...@@ -5164,7 +5164,7 @@ static int ioc_hdrlist(unsigned long arg, char *cmnd)
#if LINUX_VERSION_CODE >= 0x020503 #if LINUX_VERSION_CODE >= 0x020503
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]); sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
srp = scsi_allocate_request(sdev); srp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!srp) if (!srp)
return -ENOMEM; return -ENOMEM;
srp->sr_cmd_len = 12; srp->sr_cmd_len = 12;
...@@ -5253,7 +5253,7 @@ static int ioc_rescan(unsigned long arg, char *cmnd) ...@@ -5253,7 +5253,7 @@ static int ioc_rescan(unsigned long arg, char *cmnd)
#if LINUX_VERSION_CODE >= 0x020503 #if LINUX_VERSION_CODE >= 0x020503
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]); sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
srp = scsi_allocate_request(sdev); srp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!srp) if (!srp)
return -ENOMEM; return -ENOMEM;
srp->sr_cmd_len = 12; srp->sr_cmd_len = 12;
...@@ -5631,7 +5631,7 @@ static void gdth_flush(int hanum) ...@@ -5631,7 +5631,7 @@ static void gdth_flush(int hanum)
#if LINUX_VERSION_CODE >= 0x020503 #if LINUX_VERSION_CODE >= 0x020503
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]); sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
srp = scsi_allocate_request(sdev); srp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!srp) if (!srp)
return; return;
srp->sr_cmd_len = 12; srp->sr_cmd_len = 12;
...@@ -5727,7 +5727,7 @@ void gdth_halt(void) ...@@ -5727,7 +5727,7 @@ void gdth_halt(void)
TRACE2(("gdth_halt(): reset controller %d\n", hanum)); TRACE2(("gdth_halt(): reset controller %d\n", hanum));
#if LINUX_VERSION_CODE >= 0x020503 #if LINUX_VERSION_CODE >= 0x020503
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]); sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
srp = scsi_allocate_request(sdev); srp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!srp) { if (!srp) {
#if LINUX_VERSION_CODE >= 0x020100 #if LINUX_VERSION_CODE >= 0x020100
unregister_reboot_notifier(&gdth_notifier); unregister_reboot_notifier(&gdth_notifier);
......
...@@ -44,7 +44,7 @@ static int gdth_set_info(char *buffer,int length,int hanum,int busnum) ...@@ -44,7 +44,7 @@ static int gdth_set_info(char *buffer,int length,int hanum,int busnum)
#if LINUX_VERSION_CODE >= 0x020503 #if LINUX_VERSION_CODE >= 0x020503
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]); sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
scp = scsi_allocate_request(sdev); scp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!scp) if (!scp)
return -ENOMEM; return -ENOMEM;
scp->sr_cmd_len = 12; scp->sr_cmd_len = 12;
...@@ -797,7 +797,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset, ...@@ -797,7 +797,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,
#if LINUX_VERSION_CODE >= 0x020503 #if LINUX_VERSION_CODE >= 0x020503
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]); sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
scp = scsi_allocate_request(sdev); scp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!scp) if (!scp)
return -ENOMEM; return -ENOMEM;
scp->sr_cmd_len = 12; scp->sr_cmd_len = 12;
......
...@@ -316,7 +316,7 @@ static Scsi_Request * osst_do_scsi(Scsi_Request *SRpnt, OS_Scsi_Tape *STp, ...@@ -316,7 +316,7 @@ static Scsi_Request * osst_do_scsi(Scsi_Request *SRpnt, OS_Scsi_Tape *STp,
static int repeat = 0; static int repeat = 0;
#endif #endif
if (SRpnt == NULL) { if (SRpnt == NULL) {
if ((SRpnt = scsi_allocate_request(STp->device)) == NULL) { if ((SRpnt = scsi_allocate_request(STp->device, GFP_ATOMIC)) == NULL) {
printk(KERN_ERR "%s:E: Can't get SCSI request.\n", tape_name(STp)); printk(KERN_ERR "%s:E: Can't get SCSI request.\n", tape_name(STp));
if (signal_pending(current)) if (signal_pending(current))
(STp->buffer)->syscall_result = (-EINTR); (STp->buffer)->syscall_result = (-EINTR);
......
...@@ -113,26 +113,21 @@ const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE] = { ...@@ -113,26 +113,21 @@ const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE] = {
* *
* Purpose: Allocate a request descriptor. * Purpose: Allocate a request descriptor.
* *
* Arguments: device - device for which we want a request * Arguments: device - device for which we want a request
* gfp_mask - allocation flags passed to kmalloc
* *
* Lock status: No locks assumed to be held. This function is SMP-safe. * Lock status: No locks assumed to be held. This function is SMP-safe.
* *
* Returns: Pointer to request block. * Returns: Pointer to request block.
*
* Notes: With the new queueing code, it becomes important
* to track the difference between a command and a
* request. A request is a pending item in the queue that
* has not yet reached the top of the queue.
*
* XXX(hch): Need to add a gfp_mask argument.
*/ */
struct scsi_request *scsi_allocate_request(struct scsi_device *sdev) struct scsi_request *scsi_allocate_request(struct scsi_device *sdev,
int gfp_mask)
{ {
const int offset = ALIGN(sizeof(struct scsi_request), 4); const int offset = ALIGN(sizeof(struct scsi_request), 4);
const int size = offset + sizeof(struct request); const int size = offset + sizeof(struct request);
struct scsi_request *sreq; struct scsi_request *sreq;
sreq = kmalloc(size, GFP_ATOMIC); sreq = kmalloc(size, gfp_mask);
if (likely(sreq != NULL)) { if (likely(sreq != NULL)) {
memset(sreq, 0, size); memset(sreq, 0, size);
sreq->sr_request = (struct request *)(((char *)sreq) + offset); sreq->sr_request = (struct request *)(((char *)sreq) + offset);
......
...@@ -1339,7 +1339,7 @@ static void scsi_eh_lock_done(struct scsi_cmnd *scmd) ...@@ -1339,7 +1339,7 @@ static void scsi_eh_lock_done(struct scsi_cmnd *scmd)
**/ **/
static void scsi_eh_lock_door(struct scsi_device *sdev) static void scsi_eh_lock_door(struct scsi_device *sdev)
{ {
struct scsi_request *sreq = scsi_allocate_request(sdev); struct scsi_request *sreq = scsi_allocate_request(sdev, GFP_KERNEL);
if (unlikely(!sreq)) { if (unlikely(!sreq)) {
printk(KERN_ERR "%s: request allocate failed," printk(KERN_ERR "%s: request allocate failed,"
......
...@@ -98,7 +98,7 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, ...@@ -98,7 +98,7 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd,
SCSI_LOG_IOCTL(1, printk("Trying ioctl with scsi command %d\n", *cmd)); SCSI_LOG_IOCTL(1, printk("Trying ioctl with scsi command %d\n", *cmd));
sreq = scsi_allocate_request(sdev); sreq = scsi_allocate_request(sdev, GFP_KERNEL);
if (!sreq) { if (!sreq) {
printk("SCSI internal ioctl failed, no memory\n"); printk("SCSI internal ioctl failed, no memory\n");
return -ENOMEM; return -ENOMEM;
...@@ -321,7 +321,7 @@ int scsi_ioctl_send_command(struct scsi_device *sdev, ...@@ -321,7 +321,7 @@ int scsi_ioctl_send_command(struct scsi_device *sdev,
break; break;
} }
sreq = scsi_allocate_request(sdev); sreq = scsi_allocate_request(sdev, GFP_KERNEL);
if (!sreq) { if (!sreq) {
result = -EINTR; result = -EINTR;
goto error; goto error;
......
...@@ -1454,7 +1454,7 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage, ...@@ -1454,7 +1454,7 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,
unsigned char *buffer, int len, int timeout, int retries, unsigned char *buffer, int len, int timeout, int retries,
struct scsi_mode_data *data) struct scsi_mode_data *data)
{ {
struct scsi_request *sreq = scsi_allocate_request(sdev); struct scsi_request *sreq = scsi_allocate_request(sdev, GFP_KERNEL);
int ret; int ret;
if (!sreq) if (!sreq)
......
...@@ -693,7 +693,7 @@ static int scsi_probe_and_add_lun(struct Scsi_Host *host, ...@@ -693,7 +693,7 @@ static int scsi_probe_and_add_lun(struct Scsi_Host *host,
sdev = scsi_alloc_sdev(host, channel, id, lun); sdev = scsi_alloc_sdev(host, channel, id, lun);
if (!sdev) if (!sdev)
goto out; goto out;
sreq = scsi_allocate_request(sdev); sreq = scsi_allocate_request(sdev, GFP_ATOMIC);
if (!sreq) if (!sreq)
goto out_free_sdev; goto out_free_sdev;
result = kmalloc(256, GFP_ATOMIC | result = kmalloc(256, GFP_ATOMIC |
...@@ -906,7 +906,7 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags, ...@@ -906,7 +906,7 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags,
if (bflags & BLIST_NOLUN) if (bflags & BLIST_NOLUN)
return 0; return 0;
sreq = scsi_allocate_request(sdev); sreq = scsi_allocate_request(sdev, GFP_ATOMIC);
if (!sreq) if (!sreq)
goto out; goto out;
......
...@@ -1174,7 +1174,7 @@ static int sd_revalidate_disk(struct gendisk *disk) ...@@ -1174,7 +1174,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
if (!sdp->online) if (!sdp->online)
goto out; goto out;
sreq = scsi_allocate_request(sdp); sreq = scsi_allocate_request(sdp, GFP_KERNEL);
if (!sreq) { if (!sreq) {
printk(KERN_WARNING "(sd_revalidate_disk:) Request allocation " printk(KERN_WARNING "(sd_revalidate_disk:) Request allocation "
"failure.\n"); "failure.\n");
...@@ -1355,12 +1355,12 @@ static int sd_remove(struct device *dev) ...@@ -1355,12 +1355,12 @@ static int sd_remove(struct device *dev)
static void sd_shutdown(struct device *dev) static void sd_shutdown(struct device *dev)
{ {
struct scsi_device *sdp = to_scsi_device(dev); struct scsi_device *sdp = to_scsi_device(dev);
struct scsi_disk *sdkp; struct scsi_disk *sdkp;
struct scsi_request *sreq; struct scsi_request *sreq;
int retries, res; int retries, res;
sdkp = dev_get_drvdata(dev); sdkp = dev_get_drvdata(dev);
if (!sdkp) if (!sdkp)
return; /* this can happen */ return; /* this can happen */
if (!sdp->online || !sdkp->WCE) if (!sdp->online || !sdkp->WCE)
...@@ -1369,7 +1369,7 @@ static void sd_shutdown(struct device *dev) ...@@ -1369,7 +1369,7 @@ static void sd_shutdown(struct device *dev)
printk(KERN_NOTICE "Synchronizing SCSI cache for disk %s: ", printk(KERN_NOTICE "Synchronizing SCSI cache for disk %s: ",
sdkp->disk->disk_name); sdkp->disk->disk_name);
sreq = scsi_allocate_request(sdp); sreq = scsi_allocate_request(sdp, GFP_KERNEL);
if (!sreq) { if (!sreq) {
printk("FAILED\n No memory for request\n"); printk("FAILED\n No memory for request\n");
return; return;
......
...@@ -680,7 +680,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp, ...@@ -680,7 +680,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
sg_finish_rem_req(srp); sg_finish_rem_req(srp);
return -ENODEV; return -ENODEV;
} }
SRpnt = scsi_allocate_request(sdp->device); SRpnt = scsi_allocate_request(sdp->device, GFP_ATOMIC);
if (SRpnt == NULL) { if (SRpnt == NULL) {
SCSI_LOG_TIMEOUT(1, printk("sg_write: no mem\n")); SCSI_LOG_TIMEOUT(1, printk("sg_write: no mem\n"));
sg_finish_rem_req(srp); sg_finish_rem_req(srp);
......
...@@ -599,7 +599,7 @@ static void get_sectorsize(struct scsi_cd *cd) ...@@ -599,7 +599,7 @@ static void get_sectorsize(struct scsi_cd *cd)
buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); buffer = kmalloc(512, GFP_KERNEL | GFP_DMA);
if (!buffer) if (!buffer)
goto Enomem; goto Enomem;
SRpnt = scsi_allocate_request(cd->device); SRpnt = scsi_allocate_request(cd->device, GFP_KERNEL);
if (!SRpnt) if (!SRpnt)
goto Enomem; goto Enomem;
......
...@@ -82,7 +82,7 @@ int sr_do_ioctl(Scsi_CD *cd, struct cdrom_generic_command *cgc) ...@@ -82,7 +82,7 @@ int sr_do_ioctl(Scsi_CD *cd, struct cdrom_generic_command *cgc)
int result, err = 0, retries = 0; int result, err = 0, retries = 0;
SDev = cd->device; SDev = cd->device;
SRpnt = scsi_allocate_request(SDev); SRpnt = scsi_allocate_request(SDev, GFP_KERNEL);
if (!SRpnt) { if (!SRpnt) {
printk(KERN_ERR "Unable to allocate SCSI request in sr_do_ioctl"); printk(KERN_ERR "Unable to allocate SCSI request in sr_do_ioctl");
err = -ENOMEM; err = -ENOMEM;
......
...@@ -374,7 +374,7 @@ static Scsi_Request * ...@@ -374,7 +374,7 @@ static Scsi_Request *
unsigned char *bp; unsigned char *bp;
if (SRpnt == NULL) { if (SRpnt == NULL) {
SRpnt = scsi_allocate_request(STp->device); SRpnt = scsi_allocate_request(STp->device, GFP_ATOMIC);
if (SRpnt == NULL) { if (SRpnt == NULL) {
DEBC( printk(KERN_ERR "%s: Can't get SCSI request.\n", DEBC( printk(KERN_ERR "%s: Can't get SCSI request.\n",
tape_name(STp)); ); tape_name(STp)); );
......
...@@ -45,7 +45,7 @@ struct scsi_request { ...@@ -45,7 +45,7 @@ struct scsi_request {
level driver) of this request */ level driver) of this request */
}; };
extern struct scsi_request *scsi_allocate_request(struct scsi_device *); extern struct scsi_request *scsi_allocate_request(struct scsi_device *, int);
extern void scsi_release_request(struct scsi_request *); extern void scsi_release_request(struct scsi_request *);
extern void scsi_wait_req(struct scsi_request *, const void *cmnd, extern void scsi_wait_req(struct scsi_request *, const void *cmnd,
void *buffer, unsigned bufflen, void *buffer, unsigned bufflen,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment