pkoutoupis / rapiddisk

An Advanced Linux RAM Drive and Caching kernel modules. Dynamically allocate RAM as block devices. Use them as stand alone drives or even map them as caching nodes to slower local disk drives. Access those volumes locally or export them across an NVMe Target network. Manage it all from a web API.
http://www.rapiddisk.org
GNU General Public License v2.0
298 stars 49 forks source link

Disable writeback cache for rapiddisk RAM drives #147

Closed pkoutoupis closed 1 year ago

pkoutoupis commented 1 year ago
diff --git a/module/rapiddisk.c b/module/rapiddisk.c
index 735aeda..d570d00 100644
--- a/module/rapiddisk.c
+++ b/module/rapiddisk.c
@@ -819,9 +819,9 @@ static int attach_device(unsigned long num, unsigned long long size)
 #endif
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
-       blk_queue_write_cache(disk->queue, true, false);
+       blk_queue_write_cache(disk->queue, false, false);
 #else
-       blk_queue_write_cache(rdsk->rdsk_queue, true, false);
+       blk_queue_write_cache(rdsk->rdsk_queue, false, false);
 #endif
 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)
        blk_queue_flush(rdsk->rdsk_queue, REQ_FLUSH);

Avoid double writing data in memory.

pkoutoupis commented 1 year ago

This was merged in https://github.com/pkoutoupis/rapiddisk/pull/151

Augusto7743 commented 1 year ago

@pkoutoupis

All good with you ?

That PR disable creating wb caches or only remove code doing double writing data ?

pkoutoupis commented 1 year ago

@Augusto7743 Hello. All is good. You? The second scenario. It is just a one line change in the RAM drive module that does not affect the dm_writecache support. So, no worries there.

Augusto7743 commented 1 year ago

current master version working without issues in kernel 6.2.6. Have an nice week for you and the users too.