Lately, we found the substantial delay of cache mode change from writeback to others when write operations are heavy.
The delay is caused by flushing dirty ssd blocks to hard disk, but there is no need to flush.
I think the dirty blocks on ssd does not affect to the writethrough and readonly mode. The cache consistency can be kept.
The related code lines are below.
eio_ttc.c
1092 /* Wait for nrdirty to drop to zero /
1093 if (dmc->mode == CACHE_MODE_WB && mode != CACHE_MODE_WB) {
1094 if (CACHE_FAILED_IS_SET(dmc)) {
1095 pr_err
1096 ("cache_edit: Can not proceed with edit for Failed cache \"%s\".",
1097 dmc->cache_name);
1098 error = -EINVAL;
1099 goto out;
1100 }
1101
1102 error = eio_finishnrdirty(dmc);
1103 / This error can mostly occur due to Device removal */
1104 if (unlikely(error)) {
1105 pr_err
1106 ("cache_edit: nr_dirty FAILED to finish for cache \"%s\".",
1107 dmc->cache_name);
1108 goto out;
1109 }
1110 EIO_ASSERT((dmc->sysctl_active.do_clean & EIO_CLEAN_KEEP) &&
1111 !(dmc->sysctl_active.do_clean & EIO_CLEAN_START));
1112 EIO_ASSERT(dmc->sysctl_active.fast_remove ||
1113 (atomic64_read(&dmc->nr_dirty) == 0));
1114 }
Lately, we found the substantial delay of cache mode change from writeback to others when write operations are heavy.
The delay is caused by flushing dirty ssd blocks to hard disk, but there is no need to flush. I think the dirty blocks on ssd does not affect to the writethrough and readonly mode. The cache consistency can be kept.
The related code lines are below. eio_ttc.c 1092 /* Wait for nrdirty to drop to zero / 1093 if (dmc->mode == CACHE_MODE_WB && mode != CACHE_MODE_WB) { 1094 if (CACHE_FAILED_IS_SET(dmc)) { 1095 pr_err 1096 ("cache_edit: Can not proceed with edit for Failed cache \"%s\".", 1097 dmc->cache_name); 1098 error = -EINVAL; 1099 goto out; 1100 } 1101 1102 error = eio_finishnrdirty(dmc); 1103 / This error can mostly occur due to Device removal */ 1104 if (unlikely(error)) { 1105 pr_err 1106 ("cache_edit: nr_dirty FAILED to finish for cache \"%s\".", 1107 dmc->cache_name); 1108 goto out; 1109 } 1110 EIO_ASSERT((dmc->sysctl_active.do_clean & EIO_CLEAN_KEEP) && 1111 !(dmc->sysctl_active.do_clean & EIO_CLEAN_START)); 1112 EIO_ASSERT(dmc->sysctl_active.fast_remove || 1113 (atomic64_read(&dmc->nr_dirty) == 0)); 1114 }
The lines between 1092-1114 should be removed.