Commit 68b781fe authored by Stefan Haberland's avatar Stefan Haberland Committed by Martin Schwidefsky

[S390] dasd: optimize cpu usage in goodcase

remove unnecessary dbf call, remove string operations for magic
Signed-off-by: default avatarStefan Haberland <stefan.haberland@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 97f604b0
...@@ -669,14 +669,14 @@ static void dasd_profile_end(struct dasd_block *block, ...@@ -669,14 +669,14 @@ static void dasd_profile_end(struct dasd_block *block,
* memory and 2) dasd_smalloc_request uses the static ccw memory * memory and 2) dasd_smalloc_request uses the static ccw memory
* that gets allocated for each device. * that gets allocated for each device.
*/ */
struct dasd_ccw_req *dasd_kmalloc_request(char *magic, int cplength, struct dasd_ccw_req *dasd_kmalloc_request(int magic, int cplength,
int datasize, int datasize,
struct dasd_device *device) struct dasd_device *device)
{ {
struct dasd_ccw_req *cqr; struct dasd_ccw_req *cqr;
/* Sanity checks */ /* Sanity checks */
BUG_ON( magic == NULL || datasize > PAGE_SIZE || BUG_ON(datasize > PAGE_SIZE ||
(cplength*sizeof(struct ccw1)) > PAGE_SIZE); (cplength*sizeof(struct ccw1)) > PAGE_SIZE);
cqr = kzalloc(sizeof(struct dasd_ccw_req), GFP_ATOMIC); cqr = kzalloc(sizeof(struct dasd_ccw_req), GFP_ATOMIC);
...@@ -700,14 +700,13 @@ struct dasd_ccw_req *dasd_kmalloc_request(char *magic, int cplength, ...@@ -700,14 +700,13 @@ struct dasd_ccw_req *dasd_kmalloc_request(char *magic, int cplength,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
} }
strncpy((char *) &cqr->magic, magic, 4); cqr->magic = magic;
ASCEBC((char *) &cqr->magic, 4);
set_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); set_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
dasd_get_device(device); dasd_get_device(device);
return cqr; return cqr;
} }
struct dasd_ccw_req *dasd_smalloc_request(char *magic, int cplength, struct dasd_ccw_req *dasd_smalloc_request(int magic, int cplength,
int datasize, int datasize,
struct dasd_device *device) struct dasd_device *device)
{ {
...@@ -717,7 +716,7 @@ struct dasd_ccw_req *dasd_smalloc_request(char *magic, int cplength, ...@@ -717,7 +716,7 @@ struct dasd_ccw_req *dasd_smalloc_request(char *magic, int cplength,
int size; int size;
/* Sanity checks */ /* Sanity checks */
BUG_ON( magic == NULL || datasize > PAGE_SIZE || BUG_ON(datasize > PAGE_SIZE ||
(cplength*sizeof(struct ccw1)) > PAGE_SIZE); (cplength*sizeof(struct ccw1)) > PAGE_SIZE);
size = (sizeof(struct dasd_ccw_req) + 7L) & -8L; size = (sizeof(struct dasd_ccw_req) + 7L) & -8L;
...@@ -744,8 +743,7 @@ struct dasd_ccw_req *dasd_smalloc_request(char *magic, int cplength, ...@@ -744,8 +743,7 @@ struct dasd_ccw_req *dasd_smalloc_request(char *magic, int cplength,
cqr->data = data; cqr->data = data;
memset(cqr->data, 0, datasize); memset(cqr->data, 0, datasize);
} }
strncpy((char *) &cqr->magic, magic, 4); cqr->magic = magic;
ASCEBC((char *) &cqr->magic, 4);
set_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); set_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
dasd_get_device(device); dasd_get_device(device);
return cqr; return cqr;
...@@ -899,9 +897,6 @@ int dasd_start_IO(struct dasd_ccw_req *cqr) ...@@ -899,9 +897,6 @@ int dasd_start_IO(struct dasd_ccw_req *cqr)
switch (rc) { switch (rc) {
case 0: case 0:
cqr->status = DASD_CQR_IN_IO; cqr->status = DASD_CQR_IN_IO;
DBF_DEV_EVENT(DBF_DEBUG, device,
"start_IO: request %p started successful",
cqr);
break; break;
case -EBUSY: case -EBUSY:
DBF_DEV_EVENT(DBF_DEBUG, device, "%s", DBF_DEV_EVENT(DBF_DEBUG, device, "%s",
...@@ -2533,7 +2528,7 @@ EXPORT_SYMBOL_GPL(dasd_generic_restore_device); ...@@ -2533,7 +2528,7 @@ EXPORT_SYMBOL_GPL(dasd_generic_restore_device);
static struct dasd_ccw_req *dasd_generic_build_rdc(struct dasd_device *device, static struct dasd_ccw_req *dasd_generic_build_rdc(struct dasd_device *device,
void *rdc_buffer, void *rdc_buffer,
int rdc_buffer_size, int rdc_buffer_size,
char *magic) int magic)
{ {
struct dasd_ccw_req *cqr; struct dasd_ccw_req *cqr;
struct ccw1 *ccw; struct ccw1 *ccw;
...@@ -2564,7 +2559,7 @@ static struct dasd_ccw_req *dasd_generic_build_rdc(struct dasd_device *device, ...@@ -2564,7 +2559,7 @@ static struct dasd_ccw_req *dasd_generic_build_rdc(struct dasd_device *device,
} }
int dasd_generic_read_dev_chars(struct dasd_device *device, char *magic, int dasd_generic_read_dev_chars(struct dasd_device *device, int magic,
void *rdc_buffer, int rdc_buffer_size) void *rdc_buffer, int rdc_buffer_size)
{ {
int ret; int ret;
......
...@@ -379,8 +379,7 @@ static int read_unit_address_configuration(struct dasd_device *device, ...@@ -379,8 +379,7 @@ static int read_unit_address_configuration(struct dasd_device *device,
int rc; int rc;
unsigned long flags; unsigned long flags;
cqr = dasd_kmalloc_request("ECKD", cqr = dasd_kmalloc_request(DASD_ECKD_MAGIC, 1 /* PSF */ + 1 /* RSSD */,
1 /* PSF */ + 1 /* RSSD */ ,
(sizeof(struct dasd_psf_prssd_data)), (sizeof(struct dasd_psf_prssd_data)),
device); device);
if (IS_ERR(cqr)) if (IS_ERR(cqr))
......
...@@ -523,8 +523,7 @@ static struct dasd_ccw_req *dasd_diag_build_cp(struct dasd_device *memdev, ...@@ -523,8 +523,7 @@ static struct dasd_ccw_req *dasd_diag_build_cp(struct dasd_device *memdev,
/* Build the request */ /* Build the request */
datasize = sizeof(struct dasd_diag_req) + datasize = sizeof(struct dasd_diag_req) +
count*sizeof(struct dasd_diag_bio); count*sizeof(struct dasd_diag_bio);
cqr = dasd_smalloc_request(dasd_diag_discipline.name, 0, cqr = dasd_smalloc_request(DASD_DIAG_MAGIC, 0, datasize, memdev);
datasize, memdev);
if (IS_ERR(cqr)) if (IS_ERR(cqr))
return cqr; return cqr;
......
...@@ -730,7 +730,8 @@ static struct dasd_ccw_req *dasd_eckd_build_rcd_lpm(struct dasd_device *device, ...@@ -730,7 +730,8 @@ static struct dasd_ccw_req *dasd_eckd_build_rcd_lpm(struct dasd_device *device,
struct dasd_ccw_req *cqr; struct dasd_ccw_req *cqr;
struct ccw1 *ccw; struct ccw1 *ccw;
cqr = dasd_smalloc_request("ECKD", 1 /* RCD */, ciw->count, device); cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1 /* RCD */, ciw->count,
device);
if (IS_ERR(cqr)) { if (IS_ERR(cqr)) {
DBF_DEV_EVENT(DBF_WARNING, device, "%s", DBF_DEV_EVENT(DBF_WARNING, device, "%s",
...@@ -934,8 +935,7 @@ static int dasd_eckd_read_features(struct dasd_device *device) ...@@ -934,8 +935,7 @@ static int dasd_eckd_read_features(struct dasd_device *device)
struct dasd_eckd_private *private; struct dasd_eckd_private *private;
private = (struct dasd_eckd_private *) device->private; private = (struct dasd_eckd_private *) device->private;
cqr = dasd_smalloc_request(dasd_eckd_discipline.name, cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1 /* PSF */ + 1 /* RSSD */,
1 /* PSF */ + 1 /* RSSD */ ,
(sizeof(struct dasd_psf_prssd_data) + (sizeof(struct dasd_psf_prssd_data) +
sizeof(struct dasd_rssd_features)), sizeof(struct dasd_rssd_features)),
device); device);
...@@ -998,7 +998,7 @@ static struct dasd_ccw_req *dasd_eckd_build_psf_ssc(struct dasd_device *device, ...@@ -998,7 +998,7 @@ static struct dasd_ccw_req *dasd_eckd_build_psf_ssc(struct dasd_device *device,
struct dasd_psf_ssc_data *psf_ssc_data; struct dasd_psf_ssc_data *psf_ssc_data;
struct ccw1 *ccw; struct ccw1 *ccw;
cqr = dasd_smalloc_request("ECKD", 1 /* PSF */ , cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1 /* PSF */ ,
sizeof(struct dasd_psf_ssc_data), sizeof(struct dasd_psf_ssc_data),
device); device);
...@@ -1149,8 +1149,8 @@ dasd_eckd_check_characteristics(struct dasd_device *device) ...@@ -1149,8 +1149,8 @@ dasd_eckd_check_characteristics(struct dasd_device *device)
goto out_err3; goto out_err3;
/* Read Device Characteristics */ /* Read Device Characteristics */
rc = dasd_generic_read_dev_chars(device, "ECKD", &private->rdc_data, rc = dasd_generic_read_dev_chars(device, DASD_ECKD_MAGIC,
64); &private->rdc_data, 64);
if (rc) { if (rc) {
DBF_EVENT(DBF_WARNING, DBF_EVENT(DBF_WARNING,
"Read device characteristics failed, rc=%d for " "Read device characteristics failed, rc=%d for "
...@@ -1217,8 +1217,7 @@ dasd_eckd_analysis_ccw(struct dasd_device *device) ...@@ -1217,8 +1217,7 @@ dasd_eckd_analysis_ccw(struct dasd_device *device)
cplength = 8; cplength = 8;
datasize = sizeof(struct DE_eckd_data) + 2*sizeof(struct LO_eckd_data); datasize = sizeof(struct DE_eckd_data) + 2*sizeof(struct LO_eckd_data);
cqr = dasd_smalloc_request(dasd_eckd_discipline.name, cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, cplength, datasize, device);
cplength, datasize, device);
if (IS_ERR(cqr)) if (IS_ERR(cqr))
return cqr; return cqr;
ccw = cqr->cpaddr; ccw = cqr->cpaddr;
...@@ -1499,8 +1498,7 @@ dasd_eckd_format_device(struct dasd_device * device, ...@@ -1499,8 +1498,7 @@ dasd_eckd_format_device(struct dasd_device * device,
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
/* Allocate the format ccw request. */ /* Allocate the format ccw request. */
fcp = dasd_smalloc_request(dasd_eckd_discipline.name, fcp = dasd_smalloc_request(DASD_ECKD_MAGIC, cplength, datasize, device);
cplength, datasize, device);
if (IS_ERR(fcp)) if (IS_ERR(fcp))
return fcp; return fcp;
...@@ -1783,8 +1781,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_single( ...@@ -1783,8 +1781,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_single(
datasize += count*sizeof(struct LO_eckd_data); datasize += count*sizeof(struct LO_eckd_data);
} }
/* Allocate the ccw request. */ /* Allocate the ccw request. */
cqr = dasd_smalloc_request(dasd_eckd_discipline.name, cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, cplength, datasize,
cplength, datasize, startdev); startdev);
if (IS_ERR(cqr)) if (IS_ERR(cqr))
return cqr; return cqr;
ccw = cqr->cpaddr; ccw = cqr->cpaddr;
...@@ -1948,8 +1946,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_track( ...@@ -1948,8 +1946,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_track(
cidaw * sizeof(unsigned long long); cidaw * sizeof(unsigned long long);
/* Allocate the ccw request. */ /* Allocate the ccw request. */
cqr = dasd_smalloc_request(dasd_eckd_discipline.name, cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, cplength, datasize,
cplength, datasize, startdev); startdev);
if (IS_ERR(cqr)) if (IS_ERR(cqr))
return cqr; return cqr;
ccw = cqr->cpaddr; ccw = cqr->cpaddr;
...@@ -2249,8 +2247,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( ...@@ -2249,8 +2247,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(
/* Allocate the ccw request. */ /* Allocate the ccw request. */
itcw_size = itcw_calc_size(0, ctidaw, 0); itcw_size = itcw_calc_size(0, ctidaw, 0);
cqr = dasd_smalloc_request(dasd_eckd_discipline.name, cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 0, itcw_size, startdev);
0, itcw_size, startdev);
if (IS_ERR(cqr)) if (IS_ERR(cqr))
return cqr; return cqr;
...@@ -2557,8 +2554,7 @@ dasd_eckd_release(struct dasd_device *device) ...@@ -2557,8 +2554,7 @@ dasd_eckd_release(struct dasd_device *device)
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
cqr = dasd_smalloc_request(dasd_eckd_discipline.name, cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1, 32, device);
1, 32, device);
if (IS_ERR(cqr)) { if (IS_ERR(cqr)) {
DBF_DEV_EVENT(DBF_WARNING, device, "%s", DBF_DEV_EVENT(DBF_WARNING, device, "%s",
"Could not allocate initialization request"); "Could not allocate initialization request");
...@@ -2600,8 +2596,7 @@ dasd_eckd_reserve(struct dasd_device *device) ...@@ -2600,8 +2596,7 @@ dasd_eckd_reserve(struct dasd_device *device)
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
cqr = dasd_smalloc_request(dasd_eckd_discipline.name, cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1, 32, device);
1, 32, device);
if (IS_ERR(cqr)) { if (IS_ERR(cqr)) {
DBF_DEV_EVENT(DBF_WARNING, device, "%s", DBF_DEV_EVENT(DBF_WARNING, device, "%s",
"Could not allocate initialization request"); "Could not allocate initialization request");
...@@ -2642,8 +2637,7 @@ dasd_eckd_steal_lock(struct dasd_device *device) ...@@ -2642,8 +2637,7 @@ dasd_eckd_steal_lock(struct dasd_device *device)
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
cqr = dasd_smalloc_request(dasd_eckd_discipline.name, cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1, 32, device);
1, 32, device);
if (IS_ERR(cqr)) { if (IS_ERR(cqr)) {
DBF_DEV_EVENT(DBF_WARNING, device, "%s", DBF_DEV_EVENT(DBF_WARNING, device, "%s",
"Could not allocate initialization request"); "Could not allocate initialization request");
...@@ -2681,8 +2675,7 @@ dasd_eckd_performance(struct dasd_device *device, void __user *argp) ...@@ -2681,8 +2675,7 @@ dasd_eckd_performance(struct dasd_device *device, void __user *argp)
struct ccw1 *ccw; struct ccw1 *ccw;
int rc; int rc;
cqr = dasd_smalloc_request(dasd_eckd_discipline.name, cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 1 /* PSF */ + 1 /* RSSD */,
1 /* PSF */ + 1 /* RSSD */ ,
(sizeof(struct dasd_psf_prssd_data) + (sizeof(struct dasd_psf_prssd_data) +
sizeof(struct dasd_rssd_perf_stats_t)), sizeof(struct dasd_rssd_perf_stats_t)),
device); device);
...@@ -2828,7 +2821,7 @@ static int dasd_symm_io(struct dasd_device *device, void __user *argp) ...@@ -2828,7 +2821,7 @@ static int dasd_symm_io(struct dasd_device *device, void __user *argp)
} }
/* setup CCWs for PSF + RSSD */ /* setup CCWs for PSF + RSSD */
cqr = dasd_smalloc_request("ECKD", 2 , 0, device); cqr = dasd_smalloc_request(DASD_ECKD_MAGIC, 2 , 0, device);
if (IS_ERR(cqr)) { if (IS_ERR(cqr)) {
DBF_DEV_EVENT(DBF_WARNING, device, "%s", DBF_DEV_EVENT(DBF_WARNING, device, "%s",
"Could not allocate initialization request"); "Could not allocate initialization request");
...@@ -3254,7 +3247,7 @@ int dasd_eckd_restore_device(struct dasd_device *device) ...@@ -3254,7 +3247,7 @@ int dasd_eckd_restore_device(struct dasd_device *device)
/* Read Device Characteristics */ /* Read Device Characteristics */
memset(&private->rdc_data, 0, sizeof(private->rdc_data)); memset(&private->rdc_data, 0, sizeof(private->rdc_data));
rc = dasd_generic_read_dev_chars(device, "ECKD", rc = dasd_generic_read_dev_chars(device, DASD_ECKD_MAGIC,
&private->rdc_data, 64); &private->rdc_data, 64);
if (rc) { if (rc) {
DBF_EVENT(DBF_WARNING, DBF_EVENT(DBF_WARNING,
......
...@@ -464,7 +464,7 @@ int dasd_eer_enable(struct dasd_device *device) ...@@ -464,7 +464,7 @@ int dasd_eer_enable(struct dasd_device *device)
if (!device->discipline || strcmp(device->discipline->name, "ECKD")) if (!device->discipline || strcmp(device->discipline->name, "ECKD"))
return -EPERM; /* FIXME: -EMEDIUMTYPE ? */ return -EPERM; /* FIXME: -EMEDIUMTYPE ? */
cqr = dasd_kmalloc_request("ECKD", 1 /* SNSS */, cqr = dasd_kmalloc_request(DASD_ECKD_MAGIC, 1 /* SNSS */,
SNSS_DATA_SIZE, device); SNSS_DATA_SIZE, device);
if (IS_ERR(cqr)) if (IS_ERR(cqr))
return -ENOMEM; return -ENOMEM;
......
...@@ -152,8 +152,8 @@ dasd_fba_check_characteristics(struct dasd_device *device) ...@@ -152,8 +152,8 @@ dasd_fba_check_characteristics(struct dasd_device *device)
block->base = device; block->base = device;
/* Read Device Characteristics */ /* Read Device Characteristics */
rc = dasd_generic_read_dev_chars(device, "FBA ", &private->rdc_data, rc = dasd_generic_read_dev_chars(device, DASD_FBA_MAGIC,
32); &private->rdc_data, 32);
if (rc) { if (rc) {
DBF_EVENT(DBF_WARNING, "Read device characteristics returned " DBF_EVENT(DBF_WARNING, "Read device characteristics returned "
"error %d for device: %s", "error %d for device: %s",
...@@ -305,8 +305,7 @@ static struct dasd_ccw_req *dasd_fba_build_cp(struct dasd_device * memdev, ...@@ -305,8 +305,7 @@ static struct dasd_ccw_req *dasd_fba_build_cp(struct dasd_device * memdev,
datasize += (count - 1)*sizeof(struct LO_fba_data); datasize += (count - 1)*sizeof(struct LO_fba_data);
} }
/* Allocate the ccw request. */ /* Allocate the ccw request. */
cqr = dasd_smalloc_request(dasd_fba_discipline.name, cqr = dasd_smalloc_request(DASD_FBA_MAGIC, cplength, datasize, memdev);
cplength, datasize, memdev);
if (IS_ERR(cqr)) if (IS_ERR(cqr))
return cqr; return cqr;
ccw = cqr->cpaddr; ccw = cqr->cpaddr;
......
...@@ -59,6 +59,11 @@ ...@@ -59,6 +59,11 @@
#include <asm/dasd.h> #include <asm/dasd.h>
#include <asm/idals.h> #include <asm/idals.h>
/* DASD discipline magic */
#define DASD_ECKD_MAGIC 0xC5C3D2C4
#define DASD_DIAG_MAGIC 0xC4C9C1C7
#define DASD_FBA_MAGIC 0xC6C2C140
/* /*
* SECTION: Type definitions * SECTION: Type definitions
*/ */
...@@ -540,9 +545,9 @@ extern struct block_device_operations dasd_device_operations; ...@@ -540,9 +545,9 @@ extern struct block_device_operations dasd_device_operations;
extern struct kmem_cache *dasd_page_cache; extern struct kmem_cache *dasd_page_cache;
struct dasd_ccw_req * struct dasd_ccw_req *
dasd_kmalloc_request(char *, int, int, struct dasd_device *); dasd_kmalloc_request(int , int, int, struct dasd_device *);
struct dasd_ccw_req * struct dasd_ccw_req *
dasd_smalloc_request(char *, int, int, struct dasd_device *); dasd_smalloc_request(int , int, int, struct dasd_device *);
void dasd_kfree_request(struct dasd_ccw_req *, struct dasd_device *); void dasd_kfree_request(struct dasd_ccw_req *, struct dasd_device *);
void dasd_sfree_request(struct dasd_ccw_req *, struct dasd_device *); void dasd_sfree_request(struct dasd_ccw_req *, struct dasd_device *);
...@@ -587,7 +592,7 @@ void dasd_generic_handle_state_change(struct dasd_device *); ...@@ -587,7 +592,7 @@ void dasd_generic_handle_state_change(struct dasd_device *);
int dasd_generic_pm_freeze(struct ccw_device *); int dasd_generic_pm_freeze(struct ccw_device *);
int dasd_generic_restore_device(struct ccw_device *); int dasd_generic_restore_device(struct ccw_device *);
int dasd_generic_read_dev_chars(struct dasd_device *, char *, void *, int); int dasd_generic_read_dev_chars(struct dasd_device *, int, void *, int);
char *dasd_get_sense(struct irb *); char *dasd_get_sense(struct irb *);
/* externals in dasd_devmap.c */ /* externals in dasd_devmap.c */
......
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