mirror of
https://github.com/adulau/aha.git
synced 2025-01-04 23:23:18 +00:00
[SCSI] megaraid_sas: replace pci_alloc_consitent with dma_alloc_coherent in ioctl path
Replaced pci_alloc_consistent with dma_alloc_coherent from the ioctl path. This is to avoid situations where ioctl fails for lack of memory (when system under heavy stress). Signed-off-by: Sumant Patro <sumant.patro@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
parent
cf62a0a543
commit
9f35fa8a14
1 changed files with 6 additions and 6 deletions
|
@ -2711,9 +2711,9 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
|
||||||
* For each user buffer, create a mirror buffer and copy in
|
* For each user buffer, create a mirror buffer and copy in
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < ioc->sge_count; i++) {
|
for (i = 0; i < ioc->sge_count; i++) {
|
||||||
kbuff_arr[i] = pci_alloc_consistent(instance->pdev,
|
kbuff_arr[i] = dma_alloc_coherent(&instance->pdev->dev,
|
||||||
ioc->sgl[i].iov_len,
|
ioc->sgl[i].iov_len,
|
||||||
&buf_handle);
|
&buf_handle, GFP_KERNEL);
|
||||||
if (!kbuff_arr[i]) {
|
if (!kbuff_arr[i]) {
|
||||||
printk(KERN_DEBUG "megasas: Failed to alloc "
|
printk(KERN_DEBUG "megasas: Failed to alloc "
|
||||||
"kernel SGL buffer for IOCTL \n");
|
"kernel SGL buffer for IOCTL \n");
|
||||||
|
@ -2740,8 +2740,8 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioc->sense_len) {
|
if (ioc->sense_len) {
|
||||||
sense = pci_alloc_consistent(instance->pdev, ioc->sense_len,
|
sense = dma_alloc_coherent(&instance->pdev->dev, ioc->sense_len,
|
||||||
&sense_handle);
|
&sense_handle, GFP_KERNEL);
|
||||||
if (!sense) {
|
if (!sense) {
|
||||||
error = -ENOMEM;
|
error = -ENOMEM;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -2800,12 +2800,12 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (sense) {
|
if (sense) {
|
||||||
pci_free_consistent(instance->pdev, ioc->sense_len,
|
dma_free_coherent(&instance->pdev->dev, ioc->sense_len,
|
||||||
sense, sense_handle);
|
sense, sense_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ioc->sge_count && kbuff_arr[i]; i++) {
|
for (i = 0; i < ioc->sge_count && kbuff_arr[i]; i++) {
|
||||||
pci_free_consistent(instance->pdev,
|
dma_free_coherent(&instance->pdev->dev,
|
||||||
kern_sge32[i].length,
|
kern_sge32[i].length,
|
||||||
kbuff_arr[i], kern_sge32[i].phys_addr);
|
kbuff_arr[i], kern_sge32[i].phys_addr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue