mirror of https://github.com/torvalds/linux.git
[S390] vmlogrdr: purge after recording is switched off
If automatic purge is enabled for a vmlogrdr device, old records are purged before an IUCV recording service is switched on or off. If z/VM generates a large number of records between purging and switching the recording service off, these records remain queued, and may have a negative performance impact on the z/VM system. To avoid this problem, we need to purge the records after recording is switched off. Signed-off-by: Stefan Weinhuber <wein@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
16d2ce271c
commit
ca768b6631
|
|
@ -249,27 +249,25 @@ static int vmlogrdr_recording(struct vmlogrdr_priv_t * logptr,
|
||||||
char cp_command[80];
|
char cp_command[80];
|
||||||
char cp_response[160];
|
char cp_response[160];
|
||||||
char *onoff, *qid_string;
|
char *onoff, *qid_string;
|
||||||
|
int rc;
|
||||||
|
|
||||||
memset(cp_command, 0x00, sizeof(cp_command));
|
onoff = ((action == 1) ? "ON" : "OFF");
|
||||||
memset(cp_response, 0x00, sizeof(cp_response));
|
|
||||||
|
|
||||||
onoff = ((action == 1) ? "ON" : "OFF");
|
|
||||||
qid_string = ((recording_class_AB == 1) ? " QID * " : "");
|
qid_string = ((recording_class_AB == 1) ? " QID * " : "");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The recording commands needs to be called with option QID
|
* The recording commands needs to be called with option QID
|
||||||
* for guests that have previlege classes A or B.
|
* for guests that have previlege classes A or B.
|
||||||
* Purging has to be done as separate step, because recording
|
* Purging has to be done as separate step, because recording
|
||||||
* can't be switched on as long as records are on the queue.
|
* can't be switched on as long as records are on the queue.
|
||||||
* Doing both at the same time doesn't work.
|
* Doing both at the same time doesn't work.
|
||||||
*/
|
*/
|
||||||
|
if (purge && (action == 1)) {
|
||||||
if (purge) {
|
memset(cp_command, 0x00, sizeof(cp_command));
|
||||||
|
memset(cp_response, 0x00, sizeof(cp_response));
|
||||||
snprintf(cp_command, sizeof(cp_command),
|
snprintf(cp_command, sizeof(cp_command),
|
||||||
"RECORDING %s PURGE %s",
|
"RECORDING %s PURGE %s",
|
||||||
logptr->recording_name,
|
logptr->recording_name,
|
||||||
qid_string);
|
qid_string);
|
||||||
|
|
||||||
cpcmd(cp_command, cp_response, sizeof(cp_response), NULL);
|
cpcmd(cp_command, cp_response, sizeof(cp_response), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -279,19 +277,33 @@ static int vmlogrdr_recording(struct vmlogrdr_priv_t * logptr,
|
||||||
logptr->recording_name,
|
logptr->recording_name,
|
||||||
onoff,
|
onoff,
|
||||||
qid_string);
|
qid_string);
|
||||||
|
|
||||||
cpcmd(cp_command, cp_response, sizeof(cp_response), NULL);
|
cpcmd(cp_command, cp_response, sizeof(cp_response), NULL);
|
||||||
/* The recording command will usually answer with 'Command complete'
|
/* The recording command will usually answer with 'Command complete'
|
||||||
* on success, but when the specific service was never connected
|
* on success, but when the specific service was never connected
|
||||||
* before then there might be an additional informational message
|
* before then there might be an additional informational message
|
||||||
* 'HCPCRC8072I Recording entry not found' before the
|
* 'HCPCRC8072I Recording entry not found' before the
|
||||||
* 'Command complete'. So I use strstr rather then the strncmp.
|
* 'Command complete'. So I use strstr rather then the strncmp.
|
||||||
*/
|
*/
|
||||||
if (strstr(cp_response,"Command complete"))
|
if (strstr(cp_response,"Command complete"))
|
||||||
return 0;
|
rc = 0;
|
||||||
else
|
else
|
||||||
return -EIO;
|
rc = -EIO;
|
||||||
|
/*
|
||||||
|
* If we turn recording off, we have to purge any remaining records
|
||||||
|
* afterwards, as a large number of queued records may impact z/VM
|
||||||
|
* performance.
|
||||||
|
*/
|
||||||
|
if (purge && (action == 0)) {
|
||||||
|
memset(cp_command, 0x00, sizeof(cp_command));
|
||||||
|
memset(cp_response, 0x00, sizeof(cp_response));
|
||||||
|
snprintf(cp_command, sizeof(cp_command),
|
||||||
|
"RECORDING %s PURGE %s",
|
||||||
|
logptr->recording_name,
|
||||||
|
qid_string);
|
||||||
|
cpcmd(cp_command, cp_response, sizeof(cp_response), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue