In case a JBOD device (seen as Physical Disk on iprconfig tool) has
no default cache set, we make it Write Back in order to increase
performance. If user sets the preferred cache type, iprinit will read
this custom value and use it instead of defaulting to Write Back.

Suggested-by: Brian King <brk...@linux.vnet.ibm.com>
Signed-off-by: Guilherme G. Piccoli <gpicc...@linux.vnet.ibm.com>
---
 iprlib.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/iprlib.c b/iprlib.c
index 18ec7a8..763a008 100644
--- a/iprlib.c
+++ b/iprlib.c
@@ -9694,7 +9694,8 @@ static void init_gpdd_dev(struct ipr_dev *dev)
 {
        struct ipr_disk_attr attr;
        struct sense_data_t sense_data;
-       int rc;
+       char saved_cache[100];
+       int policy, rc;
 
        if (polling_mode && !dev->should_init)
                return;
@@ -9721,6 +9722,12 @@ static void init_gpdd_dev(struct ipr_dev *dev)
 
        if (ipr_modify_dev_attr(dev, &attr))
                return;
+
+       rc = ipr_get_saved_dev_attr(dev, IPR_WRITE_CACHE_POLICY, saved_cache);
+       policy = (rc || strtoul (saved_cache, NULL, 10)) ?
+                       IPR_DEV_CACHE_WRITE_BACK : IPR_DEV_CACHE_WRITE_THROUGH;
+       ipr_set_dev_wcache_policy(dev, policy);
+
        if (ipr_set_dev_attr(dev, &attr, 0))
                return;
 }
-- 
2.12.0.rc0


------------------------------------------------------------------------------
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

Reply via email to