On 10/26/2015 08:14 AM, Gabriel Krisman Bertazi wrote:
> Add new field in show-details to report Sync Write Cache support for a
> given IOA. This will only be displayed when passing an IOA to command
> 'show-details'.
>
> This field tells if the adapter has support to sync cache
> enabled/implemented. It does not mean that sync cache is enabled
> for a specific device. It has three states: Unsupported - in
> case adapter doesn't support it; Enabled - if Sync Cache is
> supported and is globally enabled for this adapter; Disabled - in case
> it is supported but was disabled for the whole adapter.
>
> The information is recovered from the device using the Query Cache
> Parameters command. It can return a new value now, indicating if Volume
> Set Caching Mode Page is enabled.
>
> Signed-off-by: Gabriel Krisman Bertazi <[email protected]>
> ---
> iprconfig.c | 27 +++++++++++++++++++++++++++
> iprlib.c | 8 +++++++-
> iprlib.h | 13 ++++++++++---
> 3 files changed, 44 insertions(+), 4 deletions(-)
>
> diff --git a/iprconfig.c b/iprconfig.c
> index 2ee1e5a..e591655 100644
> --- a/iprconfig.c
> +++ b/iprconfig.c
> @@ -2046,6 +2046,7 @@ static char *ioa_details(char *body, struct ipr_dev
> *dev)
> struct ipr_inquiry_page0 page0_inq;
> struct scsi_dev_data *scsi_dev_data = dev->scsi_dev_data;
> struct ipr_dual_ioa_entry *ioa_entry;
> + struct ipr_reclaim_query_data *reclaim_data = dev->ioa->reclaim_data;
I don't think there should be any cases where this is not NULL. Suggest we just
declare
the reclaim buffer here on the stack....
> int rc, i;
> char buffer[200];
> int cache_size, dram_size;
> @@ -2166,6 +2167,32 @@ static char *ioa_details(char *body, struct ipr_dev
> *dev)
> body = add_line_to_body(body,_("Current Requested
> Caching Mode"), _("Default"));
> }
>
> + if (dev->ioa->has_cache) {
> + if (dev->ioa->vset_write_cache) {
> + strcpy(buffer, "Synchronize Cache");
> + } else {
> + if (!reclaim_data) {
> + reclaim_data =
> + calloc(1, sizeof(struct
> ipr_reclaim_query_data));
> + rc = ipr_reclaim_cache_store(dev->ioa,
> + IPR_RECLAIM_QUERY,
> + reclaim_data);
> + if (rc) {
> + free(reclaim_data);
> + goto out;
> + }
> + dev->ioa->reclaim_data = reclaim_data;
... and then drop this line as well.
> + }
> +
> + if(reclaim_data->rechargeable_battery_type)
> + strcpy(buffer, "Battery Backed");
> + else
> + strcpy(buffer, "Supercap Protected");
> + }
> + body = add_line_to_body(body, _("Cache Protection"), buffer);
> + }
> +
> + out:
> return body;
> }
>
--
Brian King
Power Linux I/O
IBM Linux Technology Center
------------------------------------------------------------------------------
_______________________________________________
Iprdd-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iprdd-devel