Sync cache will be enabled at startup for every vset.  This add this
configuration to iprinit flow.

There is an issue with kernels that don't enable vset cache by default
for supported adapters, in which the adapter and the kernel disagree on
the current state of the WCE bit.  This happens since, in these kernels,
we enable vcache too late in the boot process, tricking scsi stack into
thinking WCE bit is disabled.  Since WCE bit is cached in the adapter,
to make things correct, we always reconfigure vcache in iprinit, even
when it is disabled by default.  This will force Linux to reload the WCE
information, fixing the synchronization issue.

Signed-off-by: Gabriel Krisman Bertazi <kris...@linux.vnet.ibm.com>
---
 iprlib.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/iprlib.c b/iprlib.c
index 7875442..6c126ac 100644
--- a/iprlib.c
+++ b/iprlib.c
@@ -9289,6 +9289,7 @@ static void init_vset_dev(struct ipr_dev *dev)
        char q_depth[100];
        char cur_depth[100], saved_depth[100];
        int depth, rc;
+       char saved_cache[100];
 
        memset(&res_state, 0, sizeof(res_state));
 
@@ -9315,6 +9316,18 @@ static void init_vset_dev(struct ipr_dev *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);
+
+       }
 }
 
 /**
-- 
2.1.0


------------------------------------------------------------------------------
_______________________________________________
Iprdd-devel mailing list
Iprdd-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iprdd-devel

Reply via email to