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)
return -ENOMEM;
}
// Now build a Scsi_Request to pass down...
ScsiPassThruReq = scsi_allocate_request(ScsiDev);
ScsiPassThruReq = scsi_allocate_request(ScsiDev, GFP_KERNEL);
if (ScsiPassThruReq == NULL) {
kfree(buf);
return -ENOMEM;
......
......@@ -4990,7 +4990,7 @@ static int ioc_resetdrv(unsigned long arg, char *cmnd)
cmd.u.cache.DeviceNo = res.number;
#if LINUX_VERSION_CODE >= 0x020503
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
srp = scsi_allocate_request(sdev);
srp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!srp)
return -ENOMEM;
srp->sr_cmd_len = 12;
......@@ -5091,7 +5091,7 @@ static int ioc_general(unsigned long arg, char *cmnd)
#if LINUX_VERSION_CODE >= 0x020503
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
srp = scsi_allocate_request(sdev);
srp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!srp)
return -ENOMEM;
srp->sr_cmd_len = 12;
......@@ -5164,7 +5164,7 @@ static int ioc_hdrlist(unsigned long arg, char *cmnd)
#if LINUX_VERSION_CODE >= 0x020503
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
srp = scsi_allocate_request(sdev);
srp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!srp)
return -ENOMEM;
srp->sr_cmd_len = 12;
......@@ -5253,7 +5253,7 @@ static int ioc_rescan(unsigned long arg, char *cmnd)
#if LINUX_VERSION_CODE >= 0x020503
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
srp = scsi_allocate_request(sdev);
srp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!srp)
return -ENOMEM;
srp->sr_cmd_len = 12;
......@@ -5631,7 +5631,7 @@ static void gdth_flush(int hanum)
#if LINUX_VERSION_CODE >= 0x020503
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
srp = scsi_allocate_request(sdev);
srp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!srp)
return;
srp->sr_cmd_len = 12;
......@@ -5727,7 +5727,7 @@ void gdth_halt(void)
TRACE2(("gdth_halt(): reset controller %d\n", hanum));
#if LINUX_VERSION_CODE >= 0x020503
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
srp = scsi_allocate_request(sdev);
srp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!srp) {
#if LINUX_VERSION_CODE >= 0x020100
unregister_reboot_notifier(&gdth_notifier);
......
......@@ -44,7 +44,7 @@ static int gdth_set_info(char *buffer,int length,int hanum,int busnum)
#if LINUX_VERSION_CODE >= 0x020503
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
scp = scsi_allocate_request(sdev);
scp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!scp)
return -ENOMEM;
scp->sr_cmd_len = 12;
......@@ -797,7 +797,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,
#if LINUX_VERSION_CODE >= 0x020503
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
scp = scsi_allocate_request(sdev);
scp = scsi_allocate_request(sdev, GFP_KERNEL);
if (!scp)
return -ENOMEM;
scp->sr_cmd_len = 12;
......
......@@ -316,7 +316,7 @@ static Scsi_Request * osst_do_scsi(Scsi_Request *SRpnt, OS_Scsi_Tape *STp,
static int repeat = 0;
#endif
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));
if (signal_pending(current))
(STp->buffer)->syscall_result = (-EINTR);
......
......@@ -113,26 +113,21 @@ const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE] = {
*
* 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.
*
* 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 size = offset + sizeof(struct request);
struct scsi_request *sreq;
sreq = kmalloc(size, GFP_ATOMIC);
sreq = kmalloc(size, gfp_mask);
if (likely(sreq != NULL)) {
memset(sreq, 0, size);
sreq->sr_request = (struct request *)(((char *)sreq) + offset);
......
......@@ -1339,7 +1339,7 @@ static void scsi_eh_lock_done(struct scsi_cmnd *scmd)
**/
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)) {
printk(KERN_ERR "%s: request allocate failed,"
......
......@@ -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));
sreq = scsi_allocate_request(sdev);
sreq = scsi_allocate_request(sdev, GFP_KERNEL);
if (!sreq) {
printk("SCSI internal ioctl failed, no memory\n");
return -ENOMEM;
......@@ -321,7 +321,7 @@ int scsi_ioctl_send_command(struct scsi_device *sdev,
break;
}
sreq = scsi_allocate_request(sdev);
sreq = scsi_allocate_request(sdev, GFP_KERNEL);
if (!sreq) {
result = -EINTR;
goto error;
......
......@@ -1454,7 +1454,7 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,
unsigned char *buffer, int len, int timeout, int retries,
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;
if (!sreq)
......
......@@ -693,7 +693,7 @@ static int scsi_probe_and_add_lun(struct Scsi_Host *host,
sdev = scsi_alloc_sdev(host, channel, id, lun);
if (!sdev)
goto out;
sreq = scsi_allocate_request(sdev);
sreq = scsi_allocate_request(sdev, GFP_ATOMIC);
if (!sreq)
goto out_free_sdev;
result = kmalloc(256, GFP_ATOMIC |
......@@ -906,7 +906,7 @@ static int scsi_report_lun_scan(struct scsi_device *sdev, int bflags,
if (bflags & BLIST_NOLUN)
return 0;
sreq = scsi_allocate_request(sdev);
sreq = scsi_allocate_request(sdev, GFP_ATOMIC);
if (!sreq)
goto out;
......
......@@ -1174,7 +1174,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
if (!sdp->online)
goto out;
sreq = scsi_allocate_request(sdp);
sreq = scsi_allocate_request(sdp, GFP_KERNEL);
if (!sreq) {
printk(KERN_WARNING "(sd_revalidate_disk:) Request allocation "
"failure.\n");
......@@ -1355,12 +1355,12 @@ static int sd_remove(struct device *dev)
static void sd_shutdown(struct device *dev)
{
struct scsi_device *sdp = to_scsi_device(dev);
struct scsi_disk *sdkp;
struct scsi_disk *sdkp;
struct scsi_request *sreq;
int retries, res;
sdkp = dev_get_drvdata(dev);
if (!sdkp)
sdkp = dev_get_drvdata(dev);
if (!sdkp)
return; /* this can happen */
if (!sdp->online || !sdkp->WCE)
......@@ -1369,7 +1369,7 @@ static void sd_shutdown(struct device *dev)
printk(KERN_NOTICE "Synchronizing SCSI cache for disk %s: ",
sdkp->disk->disk_name);
sreq = scsi_allocate_request(sdp);
sreq = scsi_allocate_request(sdp, GFP_KERNEL);
if (!sreq) {
printk("FAILED\n No memory for request\n");
return;
......
......@@ -680,7 +680,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
sg_finish_rem_req(srp);
return -ENODEV;
}
SRpnt = scsi_allocate_request(sdp->device);
SRpnt = scsi_allocate_request(sdp->device, GFP_ATOMIC);
if (SRpnt == NULL) {
SCSI_LOG_TIMEOUT(1, printk("sg_write: no mem\n"));
sg_finish_rem_req(srp);
......
......@@ -599,7 +599,7 @@ static void get_sectorsize(struct scsi_cd *cd)
buffer = kmalloc(512, GFP_KERNEL | GFP_DMA);
if (!buffer)
goto Enomem;
SRpnt = scsi_allocate_request(cd->device);
SRpnt = scsi_allocate_request(cd->device, GFP_KERNEL);
if (!SRpnt)
goto Enomem;
......
......@@ -82,7 +82,7 @@ int sr_do_ioctl(Scsi_CD *cd, struct cdrom_generic_command *cgc)
int result, err = 0, retries = 0;
SDev = cd->device;
SRpnt = scsi_allocate_request(SDev);
SRpnt = scsi_allocate_request(SDev, GFP_KERNEL);
if (!SRpnt) {
printk(KERN_ERR "Unable to allocate SCSI request in sr_do_ioctl");
err = -ENOMEM;
......
......@@ -374,7 +374,7 @@ static Scsi_Request *
unsigned char *bp;
if (SRpnt == NULL) {
SRpnt = scsi_allocate_request(STp->device);
SRpnt = scsi_allocate_request(STp->device, GFP_ATOMIC);
if (SRpnt == NULL) {
DEBC( printk(KERN_ERR "%s: Can't get SCSI request.\n",
tape_name(STp)); );
......
......@@ -45,7 +45,7 @@ struct scsi_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_wait_req(struct scsi_request *, const void *cmnd,
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