If a disk array has a saved queue depth, and the saved queue depth is equal to the max supported queue depth for that disk array, init_vset_dev will return early without changing the current queue depth and also without even attempting to enable the VSET cache, if it is supported. This was reported as an issue with the VSET cache not getting enabled by iprinit at boot time. This fixes the early exit in this case to make sure the queue depth gets set. It also moves the code in init_vset_dev around to setup the VSET cache first. And thirdly, this also changes ipr_set_ioa_attr to do the change cache parameters before setting the other attributes to ensure it gets set properly.
Signed-off-by: Brian King <brk...@linux.vnet.ibm.com> --- iprlib.c | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff -puN iprlib.c~iprutils_vset_wcache_fix iprlib.c --- iprutils.patched/iprlib.c~iprutils_vset_wcache_fix 2016-10-04 13:25:02.775125905 -0500 +++ iprutils.patched-bjking1/iprlib.c 2016-10-04 13:25:02.781125867 -0500 @@ -7759,6 +7759,14 @@ int ipr_set_ioa_attr(struct ipr_ioa *ioa if (ipr_get_ioa_attr(ioa, &old_attr)) return -EIO; + if (ioa->has_vset_write_cache && attr->vset_write_cache && + power_cur_mode != POWER_BAREMETAL) { + /* vset cache should not be disabled adapter-wide + for any reason. So we don't save the parameter here. */ + ipr_change_cache_parameters(ioa, + IPR_IOA_SET_VSET_CACHE_ENABLED); + } + /* FIXME - preferred_primary and active_active may change at the same * time. This code may need to change. */ @@ -7831,14 +7839,6 @@ int ipr_set_ioa_attr(struct ipr_ioa *ioa } } - if (ioa->has_vset_write_cache && attr->vset_write_cache && - power_cur_mode != POWER_BAREMETAL) { - /* vset cache should not be disabled adapter-wide - for any reason. So we don't save the parameter here. */ - ipr_change_cache_parameters(ioa, - IPR_IOA_SET_VSET_CACHE_ENABLED); - } - get_dual_ioa_state(ioa); /* for preferred_primary */ get_subsys_config(ioa); /* for gscsi_only_ha */ return 0; @@ -9604,6 +9604,17 @@ static void init_vset_dev(struct ipr_dev if (polling_mode && !dev->should_init) return; + if (dev->ioa->has_vset_write_cache) { + int pol; + rc = ipr_get_saved_dev_attr(dev, IPR_WRITE_CACHE_POLICY, + saved_cache); + + pol = (rc || strtoul (saved_cache, NULL, 10)) ? + IPR_DEV_CACHE_WRITE_BACK : IPR_DEV_CACHE_WRITE_THROUGH; + + ipr_set_dev_wcache_policy(dev, pol); + } + if (!ipr_query_resource_state(dev, &res_state)) { ipr_count_devices_in_vset(dev, &num_devs, &ssd_num_devs); depth = ipr_max_queue_depth(dev->ioa, num_devs, ssd_num_devs); @@ -9613,8 +9624,6 @@ static void init_vset_dev(struct ipr_dev return; rc = ipr_get_saved_dev_attr(dev, IPR_QUEUE_DEPTH, saved_depth); if (rc == RC_SUCCESS) { - if (!strcmp(saved_depth, q_depth)) - return; depth = strtoul(saved_depth, NULL, 10); if (depth && depth <= 255) strcpy(q_depth, saved_depth); @@ -9625,18 +9634,6 @@ static void init_vset_dev(struct ipr_dev if (ipr_write_dev_attr(dev, "queue_depth", q_depth)) return; } - - if (dev->ioa->has_vset_write_cache) { - int pol; - rc = ipr_get_saved_dev_attr(dev, IPR_WRITE_CACHE_POLICY, - saved_cache); - - pol = (rc || strtoul (saved_cache, NULL, 10)) ? - IPR_DEV_CACHE_WRITE_BACK : IPR_DEV_CACHE_WRITE_THROUGH; - - ipr_set_dev_wcache_policy(dev, pol); - - } } /** _ ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Iprdd-devel mailing list Iprdd-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iprdd-devel