Commit 8d22022c authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Martin K. Petersen

scsi: gdth: reuse dma coherent allocation in gdth_show_info

gdth_show_info currently allocs and frees a dma buffer four times which
isn't very efficient. Reuse a single allocation instead.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 9f475ebf
...@@ -226,11 +226,13 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host) ...@@ -226,11 +226,13 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
#endif #endif
if (ha->more_proc) { if (ha->more_proc) {
size_t size = max_t(size_t, GDTH_SCRATCH, sizeof(gdth_hget_str));
/* more information: 2. about physical devices */ /* more information: 2. about physical devices */
seq_puts(m, "\nPhysical Devices:"); seq_puts(m, "\nPhysical Devices:");
flag = FALSE; flag = FALSE;
buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); buf = gdth_ioctl_alloc(ha, size, FALSE, &paddr);
if (!buf) if (!buf)
goto stop_output; goto stop_output;
for (i = 0; i < ha->bus_cnt; ++i) { for (i = 0; i < ha->bus_cnt; ++i) {
...@@ -323,7 +325,6 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host) ...@@ -323,7 +325,6 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
} }
} }
} }
gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
if (!flag) if (!flag)
seq_puts(m, "\n --\n"); seq_puts(m, "\n --\n");
...@@ -332,9 +333,6 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host) ...@@ -332,9 +333,6 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
seq_puts(m, "\nLogical Drives:"); seq_puts(m, "\nLogical Drives:");
flag = FALSE; flag = FALSE;
buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr);
if (!buf)
goto stop_output;
for (i = 0; i < MAX_LDRIVES; ++i) { for (i = 0; i < MAX_LDRIVES; ++i) {
if (!ha->hdr[i].is_logdrv) if (!ha->hdr[i].is_logdrv)
continue; continue;
...@@ -408,7 +406,6 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host) ...@@ -408,7 +406,6 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
seq_printf(m, seq_printf(m,
" To Array Drv.:\t%s\n", hrec); " To Array Drv.:\t%s\n", hrec);
} }
gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
if (!flag) if (!flag)
seq_puts(m, "\n --\n"); seq_puts(m, "\n --\n");
...@@ -417,9 +414,6 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host) ...@@ -417,9 +414,6 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
seq_puts(m, "\nArray Drives:"); seq_puts(m, "\nArray Drives:");
flag = FALSE; flag = FALSE;
buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr);
if (!buf)
goto stop_output;
for (i = 0; i < MAX_LDRIVES; ++i) { for (i = 0; i < MAX_LDRIVES; ++i) {
if (!(ha->hdr[i].is_arraydrv && ha->hdr[i].is_master)) if (!(ha->hdr[i].is_arraydrv && ha->hdr[i].is_master))
continue; continue;
...@@ -468,8 +462,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host) ...@@ -468,8 +462,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
hrec); hrec);
} }
} }
gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr);
if (!flag) if (!flag)
seq_puts(m, "\n --\n"); seq_puts(m, "\n --\n");
...@@ -477,9 +470,6 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host) ...@@ -477,9 +470,6 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
seq_puts(m, "\nHost Drives:"); seq_puts(m, "\nHost Drives:");
flag = FALSE; flag = FALSE;
buf = gdth_ioctl_alloc(ha, sizeof(gdth_hget_str), FALSE, &paddr);
if (!buf)
goto stop_output;
for (i = 0; i < MAX_LDRIVES; ++i) { for (i = 0; i < MAX_LDRIVES; ++i) {
if (!ha->hdr[i].is_logdrv || if (!ha->hdr[i].is_logdrv ||
(ha->hdr[i].is_arraydrv && !ha->hdr[i].is_master)) (ha->hdr[i].is_arraydrv && !ha->hdr[i].is_master))
...@@ -510,7 +500,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host) ...@@ -510,7 +500,7 @@ int gdth_show_info(struct seq_file *m, struct Scsi_Host *host)
} }
} }
} }
gdth_ioctl_free(ha, sizeof(gdth_hget_str), buf, paddr); gdth_ioctl_free(ha, size, buf, paddr);
for (i = 0; i < MAX_HDRIVES; ++i) { for (i = 0; i < MAX_HDRIVES; ++i) {
if (!(ha->hdr[i].present)) if (!(ha->hdr[i].present))
......
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