├── .gitignore ├── Makefile ├── README.md ├── algorithm ├── Lsmtree │ ├── Makefile │ ├── bloomfilter.c │ ├── bloomfilter.h │ ├── cache.c │ ├── cache.h │ ├── compaction.c │ ├── compaction.h │ ├── compaction_assistant.c │ ├── compaction_io_module.c │ ├── data_simul.c │ ├── hw_compaction.c │ ├── level.h │ ├── level_target │ │ ├── array │ │ │ ├── Makefile │ │ │ ├── array.c │ │ │ ├── array.h │ │ │ ├── array_level.c │ │ │ ├── array_multi_lev.c │ │ │ ├── old_array_cache.c │ │ │ ├── pipe.c │ │ │ ├── pipe.h │ │ │ ├── pipe_merger.c │ │ │ └── test.c │ │ └── hash │ │ │ ├── Makefile │ │ │ ├── hash_level.c │ │ │ ├── hash_table.c │ │ │ └── hash_table.h │ ├── lops_default.c │ ├── lsmtree.c │ ├── lsmtree.h │ ├── lsmtree_multi.c │ ├── lsmtree_scheduling.c │ ├── lsmtree_scheduling.h │ ├── memory_manager.c │ ├── memory_manager.h │ ├── nocpy.c │ ├── nocpy.h │ ├── old │ │ ├── lsmtree_iter.c │ │ ├── lsmtree_iter.h │ │ ├── lsmtree_mop.c │ │ └── multiple_compaction.c │ ├── page.c │ ├── page.h │ ├── page_kv.c │ ├── page_kv_noinv.c │ ├── page_kv_org.c │ ├── pipeline_compaction2.c │ ├── skiplist.c │ ├── skiplist.h │ ├── variable.c │ └── variable.h ├── Page_ftl │ ├── Makefile │ ├── gc.c │ ├── gc.h │ ├── map.c │ ├── map.h │ ├── page.c │ └── page.h ├── ctoc │ ├── How_to_resize_cache.txt │ ├── Makefile │ ├── dftl.c │ ├── dftl.h │ ├── dftl_utils.c │ ├── garbage_collection.c │ ├── lru_list.c │ └── lru_list.h ├── ctoc_batch │ ├── How_to_resize_cache.txt │ ├── Makefile │ ├── dftl.c │ ├── dftl.h │ ├── dftl_utils.c │ ├── garbage_collection.c │ ├── lru_list.c │ └── lru_list.h ├── demand │ ├── Makefile │ ├── cache.c │ ├── cache.h │ ├── coarse.c │ ├── coarse.h │ ├── d_htable.c │ ├── d_htable.h │ ├── d_param.h │ ├── d_type.h │ ├── demand.c │ ├── demand.h │ ├── dvalue.c │ ├── dvalue_gc.c │ ├── fine.c │ ├── fine.h │ ├── old_dftl │ │ ├── demand_range.c │ │ ├── dftl.c │ │ ├── dftl_utils.c │ │ └── gc.c │ ├── page.c │ ├── page.h │ ├── range.c │ ├── rw.c │ ├── rw.c.old │ ├── utility.c │ └── utility.h ├── dftl │ ├── How_to_resize_cache.txt │ ├── Makefile │ ├── dftl.c │ ├── dftl.h │ ├── dftl_utils.c │ ├── garbage_collection.c │ ├── lru_list.c │ └── lru_list.h ├── dftl_test │ ├── How_to_resize_cache.txt │ ├── Makefile │ ├── dftl.c │ ├── dftl.h │ ├── dftl_utils.c │ ├── garbage_collection.c │ ├── lru_list.c │ └── lru_list.h ├── hash_dftl │ ├── Makefile │ ├── dftl.c │ ├── dftl.h │ ├── dftl_range.c │ ├── dftl_utils.c │ ├── garbage_collection.c │ ├── lru_list.c │ └── lru_list.h ├── normal │ ├── Makefile │ ├── normal.c │ └── normal.h ├── old │ ├── new_pftl │ │ ├── Makefile │ │ ├── page.c │ │ ├── page.h │ │ ├── page_gc.c │ │ └── page_utils.c │ ├── page │ │ ├── Makefile │ │ ├── PM_blockqueue.c │ │ ├── PM_blockqueue.h │ │ ├── PM_opeartion.c │ │ ├── PM_operation.h │ │ ├── page.c │ │ ├── page.h │ │ ├── page_0127.c │ │ ├── page_0130.c │ │ └── page_revised.c │ └── pftl │ │ ├── Makefile │ │ ├── PM_blockqueue.c │ │ ├── PM_blockqueue.h │ │ ├── PM_interface.c │ │ ├── PM_interface.h │ │ ├── opt_bdbm_page.c │ │ ├── page.c │ │ ├── page.h │ │ ├── page_aio.c │ │ ├── page_bdbm2.c │ │ ├── page_gc.c │ │ ├── page_gc.h │ │ ├── page_opt.c │ │ └── page_utils.c └── oldhash │ ├── How_to_resize_cache.txt │ ├── Makefile │ ├── dftl.c │ ├── dftl.h │ ├── dftl_utils.c │ ├── garbage_collection.c │ ├── lru_list.c │ ├── lru_list.h │ ├── sha256.c │ └── sha256.h ├── badblock.txt ├── bench ├── bench.c ├── bench.h ├── bench_demand.c ├── measurement.c └── measurement.h ├── blockmanager ├── base │ └── Makefile ├── base_block_manager.c ├── base_block_manager.h ├── bb_checker.c ├── bb_checker.h └── partition │ ├── Makefile │ ├── pt_block_manager.c │ └── pt_block_manager.h ├── include ├── FS.c ├── FS.h ├── container.h ├── data_struct │ ├── data_struct_test │ │ ├── Makefile │ │ ├── heap.c │ │ ├── heap.h │ │ ├── main.c │ │ └── test │ ├── hash.c │ ├── hash.h │ ├── hash_kv.c │ ├── hash_kv.h │ ├── heap.c │ ├── heap.h │ ├── list.c │ ├── list.h │ ├── lru_list.c │ ├── lru_list.h │ ├── redblack.c │ └── redblack.h ├── demand_settings.h ├── dftl_settings.h ├── dl_sync.c ├── dl_sync.h ├── flash_sock │ ├── Makefile │ ├── buffer_manager.c │ ├── buffer_manager.h │ ├── fd_sock.c │ ├── fd_sock.h │ └── main.c ├── lsm_settings.h ├── rwlock.c ├── rwlock.h ├── sem_lock.h ├── settings.h ├── sha256_arm.c ├── sha256_arm.h ├── slab.c ├── slab.h ├── types.h ├── utils.h └── utils │ ├── cond_lock.c │ ├── cond_lock.h │ ├── debug_tools.c │ ├── debug_tools.h │ ├── dl_sync.c │ ├── dl_sync.h │ ├── kvssd.c │ ├── kvssd.h │ ├── rwlock.c │ ├── rwlock.h │ ├── sha256.c │ ├── sha256.h │ ├── thpool.c │ └── thpool.h ├── interface ├── bb_checker.c ├── bb_checker.h ├── buse.c ├── buse.h ├── buse_old.c ├── busexmp.c ├── interface.c ├── interface.h ├── layer_info.h ├── lfqueue.c ├── lfqueue.h ├── main.c ├── mainfiles │ ├── B_main.c │ ├── KV_main.c │ ├── K_main.c │ ├── NET_main.c │ ├── Ytest_main.c │ ├── default_main.c │ ├── main.c │ ├── range_test_main.c │ ├── t_main.c │ └── testcase.c ├── network │ ├── epoll_main.c │ ├── network_main.c │ ├── origin_network_main.c │ └── temp_network_main.c ├── queue.c ├── queue.h ├── server.h └── threading.h ├── lower ├── bdbm_drv │ ├── LICENSE.txt │ ├── Makefile │ ├── README.md │ ├── bdbm_inf.c │ ├── bdbm_inf.h │ ├── common │ │ ├── 3rd │ │ │ ├── uatomic.h │ │ │ ├── uatomic64.h │ │ │ ├── uilog.c │ │ │ ├── uilog.h │ │ │ ├── ulist.h │ │ │ ├── utarray.h │ │ │ ├── uthash.h │ │ │ ├── utlist.h │ │ │ └── utstring.h │ │ ├── bdbm_main.c │ │ ├── bdbm_main.h │ │ └── utils │ │ │ ├── ufile.c │ │ │ ├── ufile.h │ │ │ ├── umemory.c │ │ │ ├── umemory.h │ │ │ ├── upage.c │ │ │ ├── upage.h │ │ │ ├── usync.h │ │ │ ├── uthread.c │ │ │ ├── uthread.h │ │ │ ├── utime.c │ │ │ └── utime.h │ ├── devices │ │ ├── Makefile │ │ ├── bluedbm │ │ │ ├── Makefile │ │ │ ├── dm_bluedbm.c │ │ │ └── dm_bluedbm.h │ │ ├── common │ │ │ ├── dev_main.c │ │ │ ├── dev_params.c │ │ │ ├── dev_params.h │ │ │ ├── dev_stub.c │ │ │ └── dev_stub.h │ │ ├── dragonfire │ │ │ ├── Makefile │ │ │ ├── dm_df.c │ │ │ └── dm_df.h │ │ ├── libdummy │ │ │ ├── Makefile │ │ │ ├── dm_dummy.c │ │ │ └── dm_dummy.h │ │ ├── libramdrive │ │ │ └── Makefile │ │ ├── nohost │ │ │ ├── Makefile │ │ │ ├── dm_nohost.cpp │ │ │ ├── dm_nohost.h │ │ │ ├── dm_nohost_org.cpp │ │ │ ├── dm_nohost_org.h │ │ │ ├── sw_poller.cpp │ │ │ └── sw_poller.h │ │ ├── ramdrive │ │ │ ├── Makefile │ │ │ ├── dev_ramssd.c │ │ │ ├── dev_ramssd.h │ │ │ ├── dm_ramdrive.c │ │ │ └── dm_ramdrive.h │ │ └── ramdrive_timing │ │ │ ├── Makefile │ │ │ ├── mount.sh │ │ │ └── umount.sh │ ├── examples │ │ ├── raw-flash │ │ │ ├── Makefile │ │ │ ├── kmain.c │ │ │ ├── mount.sh │ │ │ ├── raw-flash.c │ │ │ ├── raw-flash.h │ │ │ └── umount.sh │ │ ├── stringsearch │ │ │ ├── Makefile │ │ │ ├── count.sh │ │ │ ├── ss.c │ │ │ ├── ss_impl.h │ │ │ ├── ss_impl_hw.c │ │ │ └── ss_impl_sw.c │ │ └── stub_test │ │ │ ├── Makefile │ │ │ └── main.c │ ├── frontend │ │ ├── Makefile │ │ ├── hybrid │ │ │ ├── Makefile │ │ │ ├── Makefile.kernel │ │ │ ├── Makefile.user │ │ │ ├── blkio_proxy.c │ │ │ ├── blkio_proxy.h │ │ │ ├── blkio_proxy_ioctl.h │ │ │ ├── blkio_proxy_reqs_pool.c │ │ │ ├── blkio_proxy_reqs_pool.h │ │ │ ├── blkio_stub.c │ │ │ ├── blkio_stub.h │ │ │ ├── empty_cache.sh │ │ │ ├── kmain.c │ │ │ ├── mount_ext4.sh │ │ │ ├── umain.c │ │ │ └── umount.sh │ │ ├── kernel │ │ │ ├── Makefile │ │ │ ├── blkdev.c │ │ │ ├── blkdev.h │ │ │ ├── blkdev_ioctl.h │ │ │ ├── blkio.c │ │ │ ├── blkio.h │ │ │ ├── kmain.c │ │ │ ├── mount_ext4.sh │ │ │ └── umount.sh │ │ ├── libmemio │ │ │ ├── Makefile │ │ │ ├── connectal_zc706 │ │ │ │ ├── README │ │ │ │ ├── cpp │ │ │ │ │ ├── BsimDma.cpp │ │ │ │ │ ├── DmaBuffer.cpp │ │ │ │ │ ├── DmaBuffer.h │ │ │ │ │ ├── MMUServer.h │ │ │ │ │ ├── TlpReplay.cpp │ │ │ │ │ ├── XsimTop.cpp │ │ │ │ │ ├── XsimTop.h │ │ │ │ │ ├── bluesim_main.cxx │ │ │ │ │ ├── bsim_relay.c │ │ │ │ │ ├── dmaManager.c │ │ │ │ │ ├── dmaManager.h │ │ │ │ │ ├── dmaSendFd.h │ │ │ │ │ ├── kernel_module.c │ │ │ │ │ ├── manualMMUIndication.h │ │ │ │ │ ├── monkit.h │ │ │ │ │ ├── platformMemory.cpp │ │ │ │ │ ├── poller.cpp │ │ │ │ │ ├── portal.c │ │ │ │ │ ├── portal.h │ │ │ │ │ ├── portalJson.c │ │ │ │ │ ├── portalKernel.h │ │ │ │ │ ├── portalPrintf.c │ │ │ │ │ ├── portalPython.cpp │ │ │ │ │ ├── runpython.cpp │ │ │ │ │ ├── sock_utils.c │ │ │ │ │ ├── sock_utils.h │ │ │ │ │ ├── timer.c │ │ │ │ │ ├── transportHardware.c │ │ │ │ │ ├── transportSerial.c │ │ │ │ │ ├── transportShared.c │ │ │ │ │ ├── transportSocket.c │ │ │ │ │ ├── transportWebSocket.c │ │ │ │ │ ├── transportXsim.c │ │ │ │ │ └── verilatortop.cpp │ │ │ │ └── drivers │ │ │ │ │ ├── connectalsdhci │ │ │ │ │ ├── Makefile │ │ │ │ │ └── connectalsdhci.c │ │ │ │ │ ├── connectalspi │ │ │ │ │ ├── Makefile │ │ │ │ │ └── connectalspi.c │ │ │ │ │ ├── pcieportal │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── Makefile.dkms │ │ │ │ │ ├── dkms.conf │ │ │ │ │ ├── linux │ │ │ │ │ │ └── dma-buf.h │ │ │ │ │ ├── pcieportal.c │ │ │ │ │ └── pcieportal.h │ │ │ │ │ ├── portalmem │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── portalmem.c │ │ │ │ │ └── portalmem.h │ │ │ │ │ └── zynqportal │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── zynqportal.c │ │ │ │ │ └── zynqportal.h │ │ │ ├── connectal_zcu102 │ │ │ │ ├── README │ │ │ │ ├── cpp │ │ │ │ │ ├── BsimDma.cpp │ │ │ │ │ ├── DmaBuffer.cpp │ │ │ │ │ ├── DmaBuffer.h │ │ │ │ │ ├── MMUServer.h │ │ │ │ │ ├── TlpReplay.cpp │ │ │ │ │ ├── XsimTop.cpp │ │ │ │ │ ├── XsimTop.h │ │ │ │ │ ├── bluesim_main.cxx │ │ │ │ │ ├── bsim_relay.c │ │ │ │ │ ├── dmaManager.c │ │ │ │ │ ├── dmaManager.h │ │ │ │ │ ├── dmaSendFd.h │ │ │ │ │ ├── kernel_module.c │ │ │ │ │ ├── manualMMUIndication.h │ │ │ │ │ ├── monkit.h │ │ │ │ │ ├── platformMemory.cpp │ │ │ │ │ ├── poller.cpp │ │ │ │ │ ├── portal.c │ │ │ │ │ ├── portal.h │ │ │ │ │ ├── portalJson.c │ │ │ │ │ ├── portalKernel.h │ │ │ │ │ ├── portalPrintf.c │ │ │ │ │ ├── portalPython.cpp │ │ │ │ │ ├── runpython.cpp │ │ │ │ │ ├── sock_utils.c │ │ │ │ │ ├── sock_utils.h │ │ │ │ │ ├── timer.c │ │ │ │ │ ├── transportHardware.c │ │ │ │ │ ├── transportSerial.c │ │ │ │ │ ├── transportShared.c │ │ │ │ │ ├── transportSocket.c │ │ │ │ │ ├── transportWebSocket.c │ │ │ │ │ ├── transportXsim.c │ │ │ │ │ └── verilatortop.cpp │ │ │ │ └── drivers │ │ │ │ │ ├── connectalsdhci │ │ │ │ │ ├── Makefile │ │ │ │ │ └── connectalsdhci.c │ │ │ │ │ ├── connectalspi │ │ │ │ │ ├── Makefile │ │ │ │ │ └── connectalspi.c │ │ │ │ │ ├── pcieportal │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── Makefile.dkms │ │ │ │ │ ├── dkms.conf │ │ │ │ │ ├── linux │ │ │ │ │ │ └── dma-buf.h │ │ │ │ │ ├── pcieportal.c │ │ │ │ │ └── pcieportal.h │ │ │ │ │ ├── portalmem │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── portalmem.c │ │ │ │ │ └── portalmem.h │ │ │ │ │ └── zynqportal │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── zynqportal.c │ │ │ │ │ └── zynqportal.h │ │ │ ├── libmemio.cpp │ │ │ ├── libmemio.h │ │ │ ├── libmemio_org.cpp │ │ │ ├── libmemio_org.h │ │ │ ├── libmemio_priority.cpp │ │ │ ├── main.cpp │ │ │ ├── zc706_ubuntu │ │ │ │ ├── README │ │ │ │ └── jni │ │ │ │ │ ├── Android.mk │ │ │ │ │ ├── Application.mk │ │ │ │ │ ├── ConnectalProjectConfig.h │ │ │ │ │ ├── FlashIndication.c │ │ │ │ │ ├── FlashIndication.h │ │ │ │ │ ├── FlashIndicationJson.cpp │ │ │ │ │ ├── FlashRequest.c │ │ │ │ │ ├── FlashRequest.h │ │ │ │ │ ├── FlashRequestJson.cpp │ │ │ │ │ ├── GeneratedCppCallbacks.cpp │ │ │ │ │ ├── GeneratedTypes.h │ │ │ │ │ ├── MMUIndication.c │ │ │ │ │ ├── MMUIndication.h │ │ │ │ │ ├── MMUIndicationJson.cpp │ │ │ │ │ ├── MMURequest.c │ │ │ │ │ ├── MMURequest.h │ │ │ │ │ ├── MMURequestJson.cpp │ │ │ │ │ ├── Makefile.generated_files │ │ │ │ │ ├── MemServerIndication.c │ │ │ │ │ ├── MemServerIndication.h │ │ │ │ │ ├── MemServerIndicationJson.cpp │ │ │ │ │ ├── MemServerRequest.c │ │ │ │ │ ├── MemServerRequest.h │ │ │ │ │ ├── MemServerRequestJson.cpp │ │ │ │ │ ├── Ubuntu.mk │ │ │ │ │ ├── driver_signature_file.h │ │ │ │ │ └── topEnum.h │ │ │ └── zcu102 │ │ │ │ ├── jni.v3.2.tar.gz │ │ │ │ ├── jni.v4.0.tar.gz │ │ │ │ ├── jni │ │ │ │ ├── Android.mk │ │ │ │ ├── Application.mk │ │ │ │ ├── ConnectalProjectConfig.h │ │ │ │ ├── FlashIndication.c │ │ │ │ ├── FlashIndication.h │ │ │ │ ├── FlashIndicationJson.cpp │ │ │ │ ├── FlashRequest.c │ │ │ │ ├── FlashRequest.h │ │ │ │ ├── FlashRequestJson.cpp │ │ │ │ ├── GeneratedCppCallbacks.cpp │ │ │ │ ├── GeneratedTypes.h │ │ │ │ ├── MMUIndication.c │ │ │ │ ├── MMUIndication.h │ │ │ │ ├── MMUIndicationJson.cpp │ │ │ │ ├── MMURequest.c │ │ │ │ ├── MMURequest.h │ │ │ │ ├── MMURequestJson.cpp │ │ │ │ ├── Makefile.generated_files │ │ │ │ ├── MemServerIndication.c │ │ │ │ ├── MemServerIndication.h │ │ │ │ ├── MemServerIndicationJson.cpp │ │ │ │ ├── MemServerRequest.c │ │ │ │ ├── MemServerRequest.h │ │ │ │ ├── MemServerRequestJson.cpp │ │ │ │ ├── Ubuntu.mk │ │ │ │ ├── driver_signature_file.h │ │ │ │ ├── topEnum.h │ │ │ │ └── ubuntu.exe │ │ │ │ ├── jni_3.2 │ │ │ │ ├── Android.mk │ │ │ │ ├── Application.mk │ │ │ │ ├── ConnectalProjectConfig.h │ │ │ │ ├── FlashIndication.c │ │ │ │ ├── FlashIndication.h │ │ │ │ ├── FlashIndicationJson.cpp │ │ │ │ ├── FlashRequest.c │ │ │ │ ├── FlashRequest.h │ │ │ │ ├── FlashRequestJson.cpp │ │ │ │ ├── GeneratedCppCallbacks.cpp │ │ │ │ ├── GeneratedTypes.h │ │ │ │ ├── MMUIndication.c │ │ │ │ ├── MMUIndication.h │ │ │ │ ├── MMUIndicationJson.cpp │ │ │ │ ├── MMURequest.c │ │ │ │ ├── MMURequest.h │ │ │ │ ├── MMURequestJson.cpp │ │ │ │ ├── Makefile.generated_files │ │ │ │ ├── MemServerIndication.c │ │ │ │ ├── MemServerIndication.h │ │ │ │ ├── MemServerIndicationJson.cpp │ │ │ │ ├── MemServerRequest.c │ │ │ │ ├── MemServerRequest.h │ │ │ │ ├── MemServerRequestJson.cpp │ │ │ │ ├── Ubuntu.mk │ │ │ │ ├── driver_signature_file.h │ │ │ │ ├── topEnum.h │ │ │ │ └── ubuntu.exe │ │ │ │ └── jni_4.0 │ │ │ │ ├── Android.mk │ │ │ │ ├── Application.mk │ │ │ │ ├── ConnectalProjectConfig.h │ │ │ │ ├── FlashIndication.c │ │ │ │ ├── FlashIndication.h │ │ │ │ ├── FlashIndicationJson.cpp │ │ │ │ ├── FlashRequest.c │ │ │ │ ├── FlashRequest.h │ │ │ │ ├── FlashRequestJson.cpp │ │ │ │ ├── GeneratedCppCallbacks.cpp │ │ │ │ ├── GeneratedTypes.h │ │ │ │ ├── MMUIndication.c │ │ │ │ ├── MMUIndication.h │ │ │ │ ├── MMUIndicationJson.cpp │ │ │ │ ├── MMURequest.c │ │ │ │ ├── MMURequest.h │ │ │ │ ├── MMURequestJson.cpp │ │ │ │ ├── Makefile.generated_files │ │ │ │ ├── MemServerIndication.c │ │ │ │ ├── MemServerIndication.h │ │ │ │ ├── MemServerIndicationJson.cpp │ │ │ │ ├── MemServerRequest.c │ │ │ │ ├── MemServerRequest.h │ │ │ │ ├── MemServerRequestJson.cpp │ │ │ │ ├── Ubuntu.mk │ │ │ │ ├── driver_signature_file.h │ │ │ │ ├── topEnum.h │ │ │ │ └── ubuntu.exe │ │ ├── nvme │ │ │ ├── Makefile │ │ │ ├── dev_proxy.c │ │ │ ├── dev_proxy.h │ │ │ ├── df_umemory.c │ │ │ ├── libftl │ │ │ ├── main.c │ │ │ ├── userio.c │ │ │ └── userio.h │ │ └── user │ │ │ ├── Makefile │ │ │ ├── Makefile.library │ │ │ ├── down │ │ │ ├── main.c │ │ │ ├── userio.c │ │ │ └── userio.h │ ├── ftl │ │ ├── algo │ │ │ ├── abm.c │ │ │ ├── abm.h │ │ │ ├── block_ftl.c │ │ │ ├── block_ftl.h │ │ │ ├── dftl.c │ │ │ ├── dftl.h │ │ │ ├── dftl_map.c │ │ │ ├── dftl_map.h │ │ │ ├── no_ftl.c │ │ │ ├── no_ftl.h │ │ │ ├── page_ftl.c │ │ │ └── page_ftl.h │ │ ├── error_codes.h │ │ ├── ftl_params.c │ │ ├── ftl_params.h │ │ ├── hlm_buf.c │ │ ├── hlm_buf.h │ │ ├── hlm_dftl.c │ │ ├── hlm_dftl.h │ │ ├── hlm_nobuf.c │ │ ├── hlm_nobuf.h │ │ ├── hlm_reqs_pool.c │ │ ├── hlm_reqs_pool.h │ │ ├── hlm_rsd.c │ │ ├── hlm_rsd.h │ │ ├── llm_mq.c │ │ ├── llm_mq.h │ │ ├── llm_noq.c │ │ ├── llm_noq.h │ │ ├── llm_noq_lock.c │ │ ├── llm_noq_lock.h │ │ ├── llm_rmq.c │ │ ├── llm_rmq.h │ │ ├── pmu.c │ │ ├── pmu.h │ │ └── queue │ │ │ ├── prior_queue.c │ │ │ ├── prior_queue.h │ │ │ ├── queue.c │ │ │ ├── queue.h │ │ │ ├── rd_prior_queue.c │ │ │ └── rd_prior_queue.h │ ├── include │ │ ├── bdbm_drv.h │ │ ├── bdbm_drv_org.h │ │ ├── debug.h │ │ ├── devices.h │ │ └── params.h │ ├── run │ │ ├── bdbm_format │ │ ├── bonnie++ │ │ │ └── run_bonnie++.sh │ │ ├── empty_cache.sh │ │ ├── fio │ │ │ ├── run_fio_randr.sh │ │ │ ├── run_fio_rw.sh │ │ │ ├── run_fio_seqr.sh │ │ │ ├── run_fio_seqw.sh │ │ │ └── run_fio_seqw_sync.sh │ │ ├── mount_ext4.sh │ │ ├── mount_ext4_dftl.sh │ │ ├── mount_f2fs.sh │ │ ├── mount_f2fs_dftl.sh │ │ ├── mount_risa.sh │ │ ├── postmark │ │ │ ├── postmark-config-1.cfg │ │ │ ├── postmark-config-2.cfg │ │ │ ├── postmark-config-3.cfg │ │ │ ├── postmark-config-small-1.cfg │ │ │ ├── postmark-config-small-2.cfg │ │ │ ├── postmark-config-small-3.cfg │ │ │ ├── run_postmark.sh │ │ │ └── run_postmark_small.sh │ │ ├── rmlog.sh │ │ ├── tiobench │ │ │ └── run_tiobench.sh │ │ └── umount.sh │ ├── test │ ├── test.txt │ ├── test_main.c │ └── tools │ │ ├── Makefile │ │ ├── bdbm_format │ │ └── bdbm_format.c ├── linux_aio │ ├── Makefile │ ├── linux_aio.c │ └── linux_aio.h ├── network │ ├── Makefile │ ├── epoll_network.c │ ├── network.c │ └── network.h ├── no_dev │ ├── Makefile │ ├── linux_aio.c │ ├── no_dev.c │ └── no_dev.h ├── posix │ ├── Makefile │ ├── posix.c │ └── posix.h ├── posix_async │ ├── Makefile │ ├── posix.c │ └── posix.h └── posix_memory │ ├── Makefile │ ├── old │ ├── posix.c │ └── posix.h │ ├── pipe_lower.c │ ├── pipe_lower.h │ ├── posix.c │ └── posix.h └── setup_shell ├── D_set.sh ├── exp.sh ├── memorycheck.sh ├── mtu_up.sh ├── setup.sh ├── tcp_buffer_config.sh └── tcp_low_latency.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | *.out 4 | buse 5 | driver 6 | driver_memory_check 7 | server 8 | duma_* 9 | data/ 10 | object/ 11 | test_file/ 12 | bin/ 13 | data/ 14 | tags 15 | result/ 16 | robusta* 17 | *log 18 | . 19 | *log 20 | *trace* 21 | driver 22 | range_driver 23 | *driver 24 | *.swp 25 | ycsb* 26 | cscope* 27 | *.bin 28 | *test.sh 29 | bd_testcase 30 | testing/ 31 | test_sh/ 32 | -------------------------------------------------------------------------------- /algorithm/Lsmtree/bloomfilter.h: -------------------------------------------------------------------------------- 1 | #ifndef __BLOOM_H__ 2 | #define __BLOOM_H__ 3 | #include"../../include/settings.h" 4 | #include"../../include/lsm_settings.h" 5 | #include 6 | #include 7 | typedef struct{ 8 | int k; 9 | uint64_t m; 10 | uint32_t targetsize; 11 | int n; 12 | float p; 13 | char *body; 14 | }BF; 15 | 16 | BF* bf_init(int entry,float fpr); 17 | float bf_fpr_from_memory(int entry,uint32_t memory); 18 | void bf_free(BF *); 19 | uint64_t bf_bits(int entry, float fpr); 20 | void bf_set(BF *,KEYT); 21 | BF* bf_cpy(BF *src); 22 | bool bf_check(BF*,KEYT); 23 | void bf_save(BF*); 24 | BF* bf_load(); 25 | #endif 26 | -------------------------------------------------------------------------------- /algorithm/Lsmtree/cache.h: -------------------------------------------------------------------------------- 1 | #ifndef __CACHE_H__ 2 | #define __CACHE_H__ 3 | #include"skiplist.h" 4 | #include "level.h" 5 | #include 6 | typedef struct cache_entry{ 7 | struct run* entry; 8 | struct cache_entry *up; 9 | struct cache_entry *down; 10 | bool locked; 11 | int dmatag; 12 | }cache_entry; 13 | 14 | typedef struct cache{ 15 | int m_size; 16 | int n_size; 17 | int max_size; 18 | int locked_entry; 19 | cache_entry *top; 20 | cache_entry *bottom; 21 | pthread_mutex_t cache_lock; 22 | }cache; 23 | 24 | cache *cache_init(uint32_t); 25 | struct run* cache_get(cache *c); 26 | cache_entry* cache_insert(cache *, struct run *, int ); 27 | bool cache_insertable(cache *c); 28 | bool cache_delete(cache *, struct run *); 29 | bool cache_delete_entry_only(cache *c, struct run *ent); 30 | void cache_update(cache *, struct run *); 31 | void cache_evict(cache *); 32 | void cache_size_update(cache *c, int m_size); 33 | void cache_free(cache *); 34 | void cache_print(cache *); 35 | void cache_entry_lock(cache *,cache_entry *); 36 | void cache_entry_unlock(cache *,cache_entry *); 37 | #endif 38 | -------------------------------------------------------------------------------- /algorithm/Lsmtree/data_simul.c: -------------------------------------------------------------------------------- 1 | #include "lsmtree.h" 2 | #include "../../include/lsm_settings.h" 3 | #include "../../include/utils/kvssd.h" 4 | #include "../../include/data_struct/redblack.h" 5 | extern lsmtree LSM; 6 | #ifdef EMULATOR 7 | bool tester; 8 | uint32_t lsm_simul_put(ppa_t ppa, KEYT key){ 9 | KEYT* t_key=(KEYT*)malloc(sizeof(KEYT)); 10 | kvssd_cpy_key(t_key,&key); 11 | rb_insert_int(LSM.rb_ppa_key,ppa,t_key); 12 | return 1; 13 | } 14 | 15 | KEYT* lsm_simul_get(ppa_t ppa){ 16 | Redblack res; 17 | rb_find_int(LSM.rb_ppa_key,ppa,&res); 18 | return (KEYT*)res->item; 19 | } 20 | 21 | void lsm_simul_del(ppa_t ppa){ 22 | Redblack res; 23 | rb_find_int(LSM.rb_ppa_key,ppa,&res); 24 | rb_delete(res,true); 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /algorithm/Lsmtree/level_target/array/Makefile: -------------------------------------------------------------------------------- 1 | SRCS +=\ 2 | array.c\ 3 | pipe.c\ 4 | pipe_merger.c\ 5 | array_level.c\ 6 | 7 | OBJS :=\ 8 | $(patsubst %.c,%.o,$(SRCS))\ 9 | 10 | 11 | all:$(OBJS) 12 | mv *.o ../../../../object/ 13 | 14 | test: test.c 15 | gcc -g -o test test.c 16 | 17 | .c.o: 18 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 19 | -------------------------------------------------------------------------------- /algorithm/Lsmtree/level_target/array/array_multi_lev.c: -------------------------------------------------------------------------------- 1 | #include "array.h" 2 | void array_multi_merger(skiplist *skip,run_t *r,bool last){ 3 | uint16_t *bitmap; 4 | ppa_t *ppa_ptr; 5 | KEYT key; 6 | char* body; 7 | int idx; 8 | body=data_from_run(r); 9 | for_each_header_start(idx,key,ppa_ptr,bitmap,body) 10 | skiplist_insert_existIgnore(skip,key,*ppa_ptr,*ppa_ptr==UINT32_MAX?false:true); 11 | for_each_header_end 12 | } 13 | 14 | -------------------------------------------------------------------------------- /algorithm/Lsmtree/level_target/array/pipe.h: -------------------------------------------------------------------------------- 1 | #ifndef PIPE_HEADER 2 | #define PIPE_HEADER 3 | 4 | 5 | #include 6 | #include 7 | #include "../../../../include/sem_lock.h" 8 | #include "../../../../include/settings.h" 9 | #include "../../bloomfilter.h" 10 | #include "../../level.h" 11 | 12 | typedef struct pipe_body{ 13 | uint32_t max_page; 14 | uint32_t pidx; 15 | char **data_ptr; 16 | #ifdef BLOOM 17 | BF *filter; 18 | #endif 19 | pl_run *pl_datas; 20 | 21 | char *now_page; 22 | uint16_t *bitmap_ptr; 23 | uint32_t length; 24 | uint32_t max_key; 25 | uint32_t kidx; 26 | bool read_from_run; 27 | }p_body; 28 | 29 | p_body *pbody_init(char** data, uint32_t list_size, pl_run *pl_datas, bool read_from_run,BF *filter); 30 | KEYT pbody_get_next_key(p_body *p, uint32_t *r_ppa); 31 | 32 | char* pbody_insert_new_key(p_body *p,KEYT key, uint32_t ppa,bool f); 33 | char *pbody_get_data(p_body *p, bool init); 34 | char *pbody_new_data_insert(p_body *p, char **new_data, int new_data_size); 35 | char *pbody_clear(p_body *p); 36 | //void pbody_data_print(char *data); 37 | #endif 38 | -------------------------------------------------------------------------------- /algorithm/Lsmtree/level_target/array/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define for_each_header_start(idx,key,ppa_ptr,bitmap,body)\ 7 | for(idx=0; bitmap[idx]!=UINT16_MAX && idx<2048; idx++){\ 8 | ppa_ptr=(uint32_t*)&body[bitmap[idx]];\ 9 | key.key=(char*)&body[bitmap[idx]+sizeof(uint32_t)];\ 10 | key.len=bitmap[idx+1]-bitmap[idx]-sizeof(uint32_t);\ 11 | 12 | #define for_each_header_end } 13 | 14 | typedef struct KEYT{ 15 | char *key; 16 | uint16_t len; 17 | }KEYT; 18 | 19 | int main(){ 20 | uint32_t idx; 21 | uint32_t *ppa_ptr; 22 | KEYT key; 23 | char body[8192]={0,}; 24 | char *bitmap=&body[0]; 25 | 26 | for(int j=0; bitmap[j]!=UINT16_MAX && j<2048; j++){ 27 | 28 | } 29 | 30 | 31 | for_each_header_start(idx,key,ppa_ptr,bitmap,body) 32 | printf("[%u]%s:%d\n",idx,key.key,key.len); 33 | for_each_header_end 34 | 35 | } 36 | -------------------------------------------------------------------------------- /algorithm/Lsmtree/level_target/hash/Makefile: -------------------------------------------------------------------------------- 1 | SRCS +=\ 2 | hash_level.c\ 3 | hash_table.c\ 4 | 5 | OBJS :=\ 6 | $(patsubst %.c,%.o,$(SRCS))\ 7 | 8 | 9 | all:$(OBJS) 10 | mv *.o ../../../../object/ 11 | 12 | .c.o: 13 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 14 | -------------------------------------------------------------------------------- /algorithm/Lsmtree/lsmtree_scheduling.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "../../include/settings.h" 4 | #include "../../include/container.h" 5 | #include "../../interface/queue.h" 6 | #include "lsmtree.h" 7 | 8 | #define SCHED_FLUSH 0 9 | #define SCHED_HWRITE 1 10 | #define SCHED_HREAD 2 11 | 12 | typedef struct sched_node{ 13 | uint8_t type; 14 | void *param; 15 | }sched_node; 16 | 17 | typedef struct lsm_io_sched{ 18 | pthread_mutex_t sched_lock; 19 | pthread_cond_t sched_cond; 20 | queue *q; 21 | volatile bool run_flag; 22 | }lsm_io_scheduler; 23 | 24 | void lsm_io_sched_init(); 25 | void lsm_io_sched_push(uint8_t type,void *req); 26 | void lsm_io_sched_flush(); 27 | void lsm_io_sched_finish(); 28 | -------------------------------------------------------------------------------- /algorithm/Lsmtree/memory_manager.h: -------------------------------------------------------------------------------- 1 | #ifndef __MM_H_ 2 | #define __MM_H_ 3 | #include "lsmtree.h" 4 | struct lsmtree; 5 | typedef struct memory_manager{ 6 | int max_memory; 7 | int usable_memory; 8 | int lev_least_memory; 9 | int lev_cache_memory; 10 | int read_least_memory; 11 | int read_cache_memory; 12 | }mm_t; 13 | 14 | mm_t* mem_init(int um,int lc_min,int r_min); 15 | void mem_free(mm_t*); 16 | bool mem_update(mm_t*,struct lsmtree *lsm,bool); 17 | void mem_trim_lc(mm_t *,struct lsmtree *lsm, uint32_t); 18 | void mem_print(); 19 | #endif 20 | -------------------------------------------------------------------------------- /algorithm/Lsmtree/nocpy.h: -------------------------------------------------------------------------------- 1 | #ifndef H_NOCPY_ 2 | #define H_NOCPY_ 3 | #include "lsmtree.h" 4 | #include "../../include/lsm_settings.h" 5 | #include 6 | #include 7 | void nocpy_init(); 8 | void nocpy_free(); 9 | 10 | void nocpy_copy_to(char *des, uint32_t ppa); 11 | void nocpy_free_page(uint32_t ppa); 12 | void nocpy_force_freepage(uint32_t ppa); 13 | void nocpy_free_block(uint32_t ppa); 14 | void nocpy_copy_from_change(char *src, uint32_t ppa); 15 | bool nocpy_ptr_check(char *data); 16 | void nocpy_trim_delay_enq(uint32_t ppa); 17 | void nocpy_trim_delay_flush(); 18 | 19 | char* nocpy_pick(uint32_t ppa); 20 | uint32_t nocpy_size(); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /algorithm/Lsmtree/old/lsmtree_iter.h: -------------------------------------------------------------------------------- 1 | #ifndef __LSM_ITER_H__ 2 | #define __LSM_ITER_H__ 3 | #include "../../include/data_struct/redblack.h" 4 | #include "../../include/settings.h" 5 | #include "../../include/sem_lock.h" 6 | #include "../../include/utils/cond_lock.h" 7 | #include "../../interface/queue.h" 8 | #include "lsmtree.h" 9 | #include "level.h" 10 | typedef struct lsmtree_iter_global{ 11 | Redblack rb; 12 | queue* q; 13 | }iter_master; 14 | 15 | typedef struct lsmtree_iterator{ 16 | skiplist *body; 17 | snode *last_node; 18 | 19 | KEYT *target_key; 20 | KEYT *last_key; 21 | char ***datas; //mappings 22 | int max_idx; 23 | int now_idx; 24 | int *iter_idx; 25 | //int datas_idx; 26 | int *run_ptr; 27 | //Redblack rb; 28 | 29 | cl_lock *conditional_lock; 30 | bool multi_handler_start_check; 31 | int target; 32 | int received; 33 | 34 | fdriver_lock_t initiated_lock; 35 | fdriver_lock_t use_lock; 36 | }lsm_iter; 37 | 38 | typedef struct lsmtree_iterator_params{ 39 | lsm_iter *target; 40 | uint8_t lsm_type; 41 | value_set *value; 42 | uint32_t ppa; 43 | 44 | int level; 45 | int idx; 46 | }lsmtree_iter_param; 47 | 48 | typedef struct lsmtree_iterator_req_param{ 49 | int now_level; 50 | lsm_iter *iter; 51 | int value_target; 52 | int value_received; 53 | }lsmtree_iter_req_param; 54 | 55 | void lsm_iter_global_init(); 56 | uint32_t lsm_iter_create(request *req); //making new iterator return iterator id 57 | uint32_t lsm_iter_release(request *req); 58 | uint32_t lsm_iter_next(request *req); 59 | uint32_t lsm_iter_next_with_value(request *req); 60 | uint32_t lsm_iter_read_data(KEYT iter_id,request *r, KEYT start, KEYT len); 61 | uint32_t lsm_iter_all_key(request *req); 62 | uint32_t lsm_iter_all_value(request *req); 63 | #endif 64 | -------------------------------------------------------------------------------- /algorithm/Lsmtree/variable.h: -------------------------------------------------------------------------------- 1 | #ifndef __H_VARIABLE__ 2 | #define __H_VARIABLE__ 3 | #include "../../include/container.h" 4 | #include "../../include/settings.h" 5 | #include "../../interface/interface.h" 6 | #include "skiplist.h" 7 | void *variable_value2Page(level *in,l_bucket *src, value_set ***target_valueset, int *target_valueset_from,bool isgc); 8 | void *variable_value2Page_hc(level *in,l_bucket *src, value_set ***target_valueset, int *target_valueset_from,bool isgc); 9 | #endif 10 | -------------------------------------------------------------------------------- /algorithm/Page_ftl/Makefile: -------------------------------------------------------------------------------- 1 | SRCS +=\ 2 | page.c\ 3 | map.c\ 4 | gc.c\ 5 | 6 | OBJS :=\ 7 | $(patsubst %.c,%.o,$(SRCS))\ 8 | 9 | TARGETOBJ:=\ 10 | $(addprefix ../../object/,$(OBJS))\ 11 | 12 | LEAK: all 13 | all: $(TARGETOBJ) 14 | 15 | libnom.a : $(TARGETOBJ) 16 | $(AR) r $(@) $(TARGETOBJ) 17 | 18 | .c.o : 19 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 20 | 21 | ../../object/%.o: %.c 22 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 23 | 24 | clean : 25 | @$(RM) libnom.a 26 | @$(RM) *.o 27 | -------------------------------------------------------------------------------- /algorithm/Page_ftl/gc.h: -------------------------------------------------------------------------------- 1 | #include "../../include/container.h" 2 | #include "../../interface/interface.h" 3 | 4 | typedef struct gc_value{ 5 | uint32_t ppa; 6 | value_set *value; 7 | bool isdone; 8 | }gc_value; 9 | 10 | void invalidate_ppa(uint32_t ppa); 11 | void validate_ppa(uint32_t ppa, uint32_t lba); 12 | void do_gc(); 13 | 14 | void *page_gc_end_req(algo_req *input); 15 | -------------------------------------------------------------------------------- /algorithm/Page_ftl/map.h: -------------------------------------------------------------------------------- 1 | #include "../../include/container.h" 2 | #include "../../interface/interface.h" 3 | 4 | typedef struct page_map_body{ 5 | uint32_t *mapping; 6 | bool isfull; 7 | uint32_t assign_page; 8 | 9 | /*segment is a kind of Physical Block*/ 10 | __segment *reserve; //for gc 11 | __segment *active; //for gc 12 | }pm_body; 13 | 14 | 15 | void page_map_create(); 16 | uint32_t page_map_assign(uint32_t lba); 17 | uint32_t page_map_pick(uint32_t lba); 18 | uint32_t page_map_gc_update(uint32_t lba, uint32_t ppa); 19 | void page_map_free(); 20 | -------------------------------------------------------------------------------- /algorithm/Page_ftl/page.h: -------------------------------------------------------------------------------- 1 | #include "../../include/container.h" 2 | typedef struct page_params{ 3 | request *parents; 4 | }page_params; 5 | 6 | uint32_t page_create (lower_info*,blockmanager *, algorithm *); 7 | void page_destroy (lower_info*, algorithm *); 8 | uint32_t page_read(request *const); 9 | uint32_t page_write(request *const); 10 | uint32_t page_remove(request *const); 11 | void *page_end_req(algo_req*); 12 | -------------------------------------------------------------------------------- /algorithm/ctoc/How_to_resize_cache.txt: -------------------------------------------------------------------------------- 1 | Go to ./algorithm/dftl_fm/dftl.c 2 | At 72th line, you can control maximum cache size 3 | Control maximum_cache_size by changing num_max_cache variable 4 | Ex) num_max_cache = max_cache_entry/4 means 1/4 cache 5 | -------------------------------------------------------------------------------- /algorithm/ctoc/Makefile: -------------------------------------------------------------------------------- 1 | CC = g++ 2 | 3 | CFLAGS_ALGO +=\ 4 | 5 | SRCS +=\ 6 | dftl.c\ 7 | garbage_collection.c\ 8 | dftl_utils.c\ 9 | lru_list.c\ 10 | 11 | OBJS :=\ 12 | $(patsubst %.c,%.o,$(SRCS))\ 13 | 14 | OBJS+=skiplist.o 15 | 16 | TARGETOBJ:=\ 17 | $(addprefix ../../object/,$(OBJS))\ 18 | 19 | LEAK: all 20 | all: $(TARGETOBJ) 21 | 22 | ../../object/skiplist.o: ../Lsmtree/skiplist.c 23 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 24 | 25 | libnom.a : $(TARGETOBJ) 26 | $(AR) r $(@) $(TARGETOBJ) 27 | 28 | .c.o : 29 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 30 | 31 | ../../object/%.o: %.c 32 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 33 | 34 | clean : 35 | @$(RM) libnom.a 36 | @$(RM) *.o 37 | -------------------------------------------------------------------------------- /algorithm/ctoc/lru_list.h: -------------------------------------------------------------------------------- 1 | #ifndef __DFTL_LRU_LIST__ 2 | #define __DFTL_LRU_LIST__ 3 | 4 | #include 5 | #include 6 | 7 | typedef struct __node{ 8 | void *DATA; 9 | struct __node *next; 10 | struct __node *prev; 11 | } NODE; 12 | 13 | typedef struct __lru{ 14 | int size; 15 | NODE *head; 16 | NODE *tail; 17 | } LRU; 18 | 19 | //lru 20 | void lru_init(LRU**); 21 | void lru_free(LRU*); 22 | NODE* lru_push(LRU*, void*); 23 | void* lru_pop(LRU*); 24 | void lru_update(LRU*, NODE*); 25 | void lru_delete(LRU*, NODE*); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /algorithm/ctoc_batch/How_to_resize_cache.txt: -------------------------------------------------------------------------------- 1 | Go to ./algorithm/dftl_fm/dftl.c 2 | At 72th line, you can control maximum cache size 3 | Control maximum_cache_size by changing num_max_cache variable 4 | Ex) num_max_cache = max_cache_entry/4 means 1/4 cache 5 | -------------------------------------------------------------------------------- /algorithm/ctoc_batch/Makefile: -------------------------------------------------------------------------------- 1 | CC = g++ 2 | 3 | CFLAGS_ALGO +=\ 4 | 5 | SRCS +=\ 6 | dftl.c\ 7 | garbage_collection.c\ 8 | dftl_utils.c\ 9 | lru_list.c\ 10 | 11 | OBJS :=\ 12 | $(patsubst %.c,%.o,$(SRCS))\ 13 | 14 | OBJS+=skiplist.o 15 | 16 | TARGETOBJ:=\ 17 | $(addprefix ../../object/,$(OBJS))\ 18 | 19 | LEAK: all 20 | all: $(TARGETOBJ) 21 | 22 | ../../object/skiplist.o: ../Lsmtree/skiplist.c 23 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 24 | 25 | libnom.a : $(TARGETOBJ) 26 | $(AR) r $(@) $(TARGETOBJ) 27 | 28 | .c.o : 29 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 30 | 31 | ../../object/%.o: %.c 32 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 33 | 34 | clean : 35 | @$(RM) libnom.a 36 | @$(RM) *.o 37 | -------------------------------------------------------------------------------- /algorithm/ctoc_batch/lru_list.h: -------------------------------------------------------------------------------- 1 | #ifndef __DFTL_LRU_LIST__ 2 | #define __DFTL_LRU_LIST__ 3 | 4 | #include 5 | #include 6 | 7 | typedef struct __node{ 8 | void *DATA; 9 | struct __node *next; 10 | struct __node *prev; 11 | } NODE; 12 | 13 | typedef struct __lru{ 14 | int size; 15 | NODE *head; 16 | NODE *tail; 17 | } LRU; 18 | 19 | //lru 20 | void lru_init(LRU**); 21 | void lru_free(LRU*); 22 | NODE* lru_push(LRU*, void*); 23 | void* lru_pop(LRU*); 24 | void lru_update(LRU*, NODE*); 25 | void lru_delete(LRU*, NODE*); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /algorithm/demand/Makefile: -------------------------------------------------------------------------------- 1 | 2 | CFLAGS_ALGO +=\ 3 | 4 | SRCS +=\ 5 | demand.c\ 6 | rw.c\ 7 | page.c\ 8 | range.c\ 9 | dvalue.c\ 10 | dvalue_gc.c\ 11 | utility.c\ 12 | cache.c\ 13 | fine.c\ 14 | coarse.c\ 15 | d_htable.c\ 16 | 17 | OBJS :=\ 18 | $(patsubst %.c,%.o,$(SRCS))\ 19 | 20 | OBJS+=skiplist.o 21 | 22 | TARGETOBJ:=\ 23 | $(addprefix ../../object/,$(OBJS))\ 24 | 25 | LEAK: all 26 | all: $(TARGETOBJ) 27 | 28 | ../../object/skiplist.o: ../Lsmtree/skiplist.c 29 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 30 | 31 | libnom.a : $(TARGETOBJ) 32 | $(AR) r $(@) $(TARGETOBJ) 33 | 34 | .c.o : 35 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 36 | 37 | ../../object/%.o: %.c 38 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 39 | 40 | clean : 41 | @$(RM) libnom.a 42 | @$(RM) *.o 43 | -------------------------------------------------------------------------------- /algorithm/demand/cache.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Demand-based FTL Cache 3 | */ 4 | 5 | #include "cache.h" 6 | 7 | /* Declare cache structure first */ 8 | extern struct demand_cache cg_cache; 9 | extern struct demand_cache fg_cache; 10 | //extern struct demand_cache pt_cache; 11 | 12 | struct demand_cache *select_cache(cache_t type) { 13 | /* 14 | * This Fucntion returns selected cache module pointer with create() it 15 | */ 16 | 17 | struct demand_cache *ret = NULL; 18 | 19 | switch (type) { 20 | case COARSE_GRAINED: 21 | ret = &cg_cache; 22 | break; 23 | case FINE_GRAINED: 24 | ret = &fg_cache; 25 | break; 26 | #if 0 27 | case PARTED: 28 | ret = &pt_cache; 29 | break; 30 | #endif 31 | 32 | /* if you implemented any other cache module, add here */ 33 | 34 | default: 35 | printf("[ERROR] No cache type found, at %s:%d\n", __FILE__, __LINE__); 36 | abort(); 37 | } 38 | 39 | if (ret) ret->create(type, ret); 40 | 41 | return ret; 42 | } 43 | 44 | void print_cache_stat(struct cache_stat *_stat) { 45 | puts("==================="); 46 | puts(" Cache Performance "); 47 | puts("==================="); 48 | 49 | printf("Cache_Hit:\t%ld\n", _stat->cache_hit); 50 | printf("Cache_Miss:\t%ld\n", _stat->cache_miss); 51 | printf("Hit ratio:\t%.2f%%\n", (float)(_stat->cache_hit)/(_stat->cache_hit+_stat->cache_miss)*100); 52 | puts(""); 53 | 54 | printf("Blocked miss:\t%ld\n", _stat->blocked_miss); 55 | puts(""); 56 | 57 | printf("Clean evict:\t%ld\n", _stat->clean_evict); 58 | printf("Dirty evict:\t%ld\n", _stat->dirty_evict); 59 | puts(""); 60 | } 61 | -------------------------------------------------------------------------------- /algorithm/demand/coarse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Header for coarse.c 3 | */ 4 | 5 | #ifndef __COARSE_H__ 6 | #define __COARSE_H__ 7 | 8 | #include "demand.h" 9 | 10 | int cg_create(cache_t, struct demand_cache *); 11 | int cg_destroy(); 12 | int cg_load(lpa_t, request *const, snode *wb_entry); 13 | int cg_list_up(lpa_t, request *const, snode *wb_entry); 14 | int cg_wait_if_flying(lpa_t, request *const, snode *wb_entry); 15 | int cg_touch(lpa_t); 16 | int cg_update(lpa_t, struct pt_struct pte); 17 | bool cg_is_hit(lpa_t); 18 | bool cg_is_full(); 19 | struct pt_struct cg_get_pte(lpa_t lpa); 20 | struct cmt_struct *cg_get_cmt(lpa_t lpa); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /algorithm/demand/d_htable.c: -------------------------------------------------------------------------------- 1 | #include "d_htable.h" 2 | #include 3 | 4 | struct d_htable *d_htable_init(int max) { 5 | struct d_htable *ht = (struct d_htable *)malloc(sizeof(struct d_htable)); 6 | ht->bucket = (struct d_hnode *)calloc(max, sizeof(struct d_hnode)); 7 | ht->max = max; 8 | return ht; 9 | } 10 | 11 | void d_htable_free(struct d_htable *ht) { 12 | for (int i = 0; i < ht->max; i++) { 13 | struct d_hnode *hn = &ht->bucket[i]; 14 | struct d_hnode *next = hn->next; 15 | 16 | while (next != NULL) { 17 | hn = next; 18 | next = hn->next; 19 | free(hn); 20 | } 21 | } 22 | free(ht->bucket); 23 | free(ht); 24 | } 25 | 26 | int d_htable_insert(struct d_htable *ht, ppa_t ppa, lpa_t lpa) { 27 | struct d_hnode *hn = &ht->bucket[ppa%ht->max]; 28 | while (hn->next != NULL) { 29 | hn = hn->next; 30 | } 31 | hn->next = (struct d_hnode *)malloc(sizeof(struct d_hnode)); 32 | hn->next->item = lpa; 33 | hn->next->next = NULL; 34 | return 0; 35 | } 36 | 37 | int d_htable_find(struct d_htable *ht, ppa_t ppa, lpa_t lpa) { 38 | struct d_hnode *hn = &ht->bucket[ppa%ht->max]; 39 | while (hn->next != NULL) { 40 | if (hn->next->item == lpa) { 41 | return 1; 42 | } 43 | hn = hn->next; 44 | } 45 | return 0; 46 | } 47 | 48 | -------------------------------------------------------------------------------- /algorithm/demand/d_htable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Simple hash table in Demand-based FTL 3 | */ 4 | 5 | #ifndef __DEMAND_HASH_TABLE_H__ 6 | #define __DEMAND_HASH_TABLE_H__ 7 | 8 | #include "demand.h" 9 | 10 | struct d_hnode { 11 | lpa_t item; 12 | struct d_hnode *next; 13 | }; 14 | struct d_htable { 15 | struct d_hnode *bucket; 16 | int max; 17 | }; 18 | 19 | struct d_htable *d_htable_init(int max); 20 | void d_htable_free(struct d_htable *ht); 21 | int d_htable_insert(struct d_htable *ht, ppa_t ppa, lpa_t lpa); 22 | int d_htable_find(struct d_htable *ht, ppa_t ppa, lpa_t lpa); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /algorithm/demand/d_param.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Demand-based FTL Parameters 3 | */ 4 | 5 | #ifndef __DEMAND_PARAM_H__ 6 | #define __DEMAND_PARAM_H__ 7 | 8 | #include "../../include/demand_settings.h" 9 | 10 | #ifdef STORE_KEY_FP 11 | #define ENTRY_SIZE (4+(FP_SIZE/8)) 12 | #else 13 | #define ENTRY_SIZE (4) 14 | #endif 15 | 16 | #define EPP (PAGESIZE / ENTRY_SIZE) // Entry Per Page 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /algorithm/demand/d_type.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Demand-based FTL Type definitions with including basic headers 3 | */ 4 | 5 | #ifndef __DEMAND_TYPE_H__ 6 | #define __DEMAND_TYPE_H__ 7 | 8 | #include "../../include/settings.h" 9 | #include "../../include/demand_settings.h" 10 | #include "../../include/types.h" 11 | 12 | typedef uint32_t lpa_t; 13 | typedef uint32_t ppa_t; 14 | typedef ppa_t pga_t; 15 | 16 | #if (FP_SIZE<=8) 17 | typedef uint8_t fp_t; 18 | #define FP_MAX UINT8_MAX 19 | 20 | #elif (FP_SIZE<=16) 21 | typedef uint16_t fp_t; 22 | #define FP_MAX UINT16_MAX 23 | 24 | #elif (FP_SIZE<=32) 25 | typedef uint32_t fp_t; 26 | #define FP_MAX UINT32_MAX 27 | 28 | #elif (FP_SIZE<=64) 29 | typedef uint64_t fp_t; 30 | #define FP_MAX UINT64_MAX 31 | #endif 32 | 33 | 34 | typedef enum { 35 | READ, WRITE 36 | } rw_t; 37 | 38 | typedef enum { 39 | HASH_KEY_INITIAL, 40 | HASH_KEY_NONE, 41 | HASH_KEY_SAME, 42 | HASH_KEY_DIFF, 43 | } hash_cmp_t; 44 | 45 | typedef enum { 46 | CLEAN, DIRTY 47 | } cmt_state_t; 48 | 49 | typedef enum { 50 | GOTO_LOAD, GOTO_LIST, GOTO_EVICT, 51 | GOTO_COMPLETE, GOTO_READ, GOTO_WRITE, 52 | GOTO_UPDATE, 53 | } jump_t; 54 | 55 | typedef enum { 56 | COARSE_GRAINED, 57 | FINE_GRAINED, 58 | PARTED 59 | } cache_t; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /algorithm/demand/dvalue.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Demand-based FTL Grain Implementation For Supporting Dynamic Value Size 3 | * 4 | * Note that, I use the term "grain" to substitute the term "piece" which represents dynamic value unit 5 | * 6 | */ 7 | 8 | #ifdef DVALUE 9 | 10 | #include "demand.h" 11 | 12 | extern struct demand_env d_env; 13 | extern struct demand_member d_member; 14 | extern struct demand_stat d_stat; 15 | 16 | static bool *grain_bitmap; // the grain is valid ? 1 : 0 17 | 18 | int grain_create() { 19 | grain_bitmap = (bool *)calloc(d_env.nr_grains, sizeof(bool)); 20 | if (!grain_bitmap) return 1; 21 | 22 | return 0; 23 | } 24 | 25 | int is_valid_grain(pga_t pga) { 26 | return grain_bitmap[pga]; 27 | } 28 | 29 | int contains_valid_grain(blockmanager *bm, ppa_t ppa) { 30 | pga_t pga = ppa * GRAIN_PER_PAGE; 31 | for (int i = 0; i < GRAIN_PER_PAGE; i++) { 32 | if (is_valid_grain(pga+i)) return 1; 33 | } 34 | 35 | /* no valid grain */ 36 | if (unlikely(bm->is_valid_page(bm, ppa))) abort(); 37 | 38 | return 0; 39 | } 40 | 41 | int validate_grain(blockmanager *bm, pga_t pga) { 42 | int rc = 0; 43 | 44 | if (grain_bitmap[pga] == 1) rc = 1; 45 | grain_bitmap[pga] = 1; 46 | 47 | return rc; 48 | } 49 | 50 | int invalidate_grain(blockmanager *bm, pga_t pga) { 51 | int rc = 0; 52 | 53 | if (grain_bitmap[pga] == 0) rc = 1; 54 | grain_bitmap[pga] = 0; 55 | 56 | return rc; 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /algorithm/demand/fine.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Header for find.c 3 | */ 4 | 5 | #ifndef __FINE_H__ 6 | #define __FINE_H__ 7 | 8 | #include "demand.h" 9 | 10 | int fg_create(cache_t, struct demand_cache *); 11 | int fg_destroy(); 12 | int fg_load(lpa_t, request *const, snode *wb_entry); 13 | int fg_list_up(lpa_t, request *const, snode *wb_entry); 14 | int fg_wait_if_flying(lpa_t, request *const, snode *wb_entry); 15 | int fg_touch(lpa_t); 16 | int fg_update(lpa_t, struct pt_struct pte); 17 | bool fg_is_hit(lpa_t); 18 | bool fg_is_full(); 19 | struct pt_struct fg_get_pte(lpa_t lpa); 20 | struct cmt_struct *fg_get_cmt(lpa_t lpa); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /algorithm/demand/page.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Header for Page Allocation 3 | */ 4 | 5 | #ifndef __DEMAND_PAGE_H__ 6 | #define __DEMAND_PAGE_H__ 7 | 8 | /* Defines */ 9 | typedef enum { 10 | DATA, MAP, 11 | } page_t; 12 | 13 | /* Structures */ 14 | struct gc_table_struct { 15 | value_set *origin; 16 | lpa_t *lpa_list; 17 | ppa_t ppa; 18 | }; 19 | 20 | /* page.c */ 21 | int page_create(blockmanager *bm); 22 | ppa_t get_dpage(blockmanager *bm); 23 | ppa_t get_tpage(blockmanager *bm); 24 | int dpage_gc(blockmanager *bm); 25 | int tpage_gc(blockmanager *bm); 26 | 27 | int validate_page(blockmanager *bm, ppa_t ppa, page_t type); 28 | int invalidate_page(blockmanager *bm, ppa_t ppa, page_t type); 29 | 30 | /* dvalue_gc.c */ 31 | #ifdef DVALUE 32 | int dpage_gc_dvalue(blockmanager *bm); 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /algorithm/dftl/How_to_resize_cache.txt: -------------------------------------------------------------------------------- 1 | Go to ./algorithm/dftl_fm/dftl.c 2 | At 72th line, you can control maximum cache size 3 | Control maximum_cache_size by changing num_max_cache variable 4 | Ex) num_max_cache = max_cache_entry/4 means 1/4 cache 5 | -------------------------------------------------------------------------------- /algorithm/dftl/Makefile: -------------------------------------------------------------------------------- 1 | CC = g++ 2 | 3 | CFLAGS_ALGO +=\ 4 | 5 | SRCS +=\ 6 | dftl.c\ 7 | garbage_collection.c\ 8 | dftl_utils.c\ 9 | lru_list.c\ 10 | 11 | OBJS :=\ 12 | $(patsubst %.c,%.o,$(SRCS))\ 13 | 14 | OBJS+=skiplist.o 15 | 16 | TARGETOBJ:=\ 17 | $(addprefix ../../object/,$(OBJS))\ 18 | 19 | LEAK: all 20 | all: $(TARGETOBJ) 21 | 22 | ../../object/skiplist.o: ../Lsmtree/skiplist.c 23 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 24 | 25 | libnom.a : $(TARGETOBJ) 26 | $(AR) r $(@) $(TARGETOBJ) 27 | 28 | .c.o : 29 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 30 | 31 | ../../object/%.o: %.c 32 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 33 | 34 | clean : 35 | @$(RM) libnom.a 36 | @$(RM) *.o 37 | -------------------------------------------------------------------------------- /algorithm/dftl/lru_list.h: -------------------------------------------------------------------------------- 1 | #ifndef __DFTL_LRU_LIST__ 2 | #define __DFTL_LRU_LIST__ 3 | 4 | #include 5 | #include 6 | 7 | typedef struct __node{ 8 | void *DATA; 9 | struct __node *next; 10 | struct __node *prev; 11 | } NODE; 12 | 13 | typedef struct __lru{ 14 | int size; 15 | NODE *head; 16 | NODE *tail; 17 | } LRU; 18 | 19 | //lru 20 | void lru_init(LRU**); 21 | void lru_free(LRU*); 22 | NODE* lru_push(LRU*, void*); 23 | void* lru_pop(LRU*); 24 | void lru_update(LRU*, NODE*); 25 | void lru_delete(LRU*, NODE*); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /algorithm/dftl_test/How_to_resize_cache.txt: -------------------------------------------------------------------------------- 1 | Go to ./algorithm/dftl_fm/dftl.c 2 | At 72th line, you can control maximum cache size 3 | Control maximum_cache_size by changing num_max_cache variable 4 | Ex) num_max_cache = max_cache_entry/4 means 1/4 cache 5 | -------------------------------------------------------------------------------- /algorithm/dftl_test/Makefile: -------------------------------------------------------------------------------- 1 | CC = g++ 2 | 3 | CFLAGS_ALGO +=\ 4 | 5 | SRCS +=\ 6 | dftl.c\ 7 | garbage_collection.c\ 8 | dftl_utils.c\ 9 | lru_list.c\ 10 | 11 | OBJS :=\ 12 | $(patsubst %.c,%.o,$(SRCS))\ 13 | 14 | OBJS+=skiplist.o 15 | 16 | TARGETOBJ:=\ 17 | $(addprefix ../../object/,$(OBJS))\ 18 | 19 | LEAK: all 20 | all: $(TARGETOBJ) 21 | 22 | ../../object/skiplist.o: ../Lsmtree/skiplist.c 23 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 24 | 25 | libnom.a : $(TARGETOBJ) 26 | $(AR) r $(@) $(TARGETOBJ) 27 | 28 | .c.o : 29 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 30 | 31 | ../../object/%.o: %.c 32 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 33 | 34 | clean : 35 | @$(RM) libnom.a 36 | @$(RM) *.o 37 | -------------------------------------------------------------------------------- /algorithm/dftl_test/lru_list.h: -------------------------------------------------------------------------------- 1 | #ifndef __DFTL_LRU_LIST__ 2 | #define __DFTL_LRU_LIST__ 3 | 4 | #include 5 | #include 6 | 7 | typedef struct __node{ 8 | void *DATA; 9 | struct __node *next; 10 | struct __node *prev; 11 | } NODE; 12 | 13 | typedef struct __lru{ 14 | int size; 15 | NODE *head; 16 | NODE *tail; 17 | } LRU; 18 | 19 | //lru 20 | void lru_init(LRU**); 21 | void lru_free(LRU*); 22 | NODE* lru_push(LRU*, void*); 23 | void* lru_pop(LRU*); 24 | void lru_update(LRU*, NODE*); 25 | void lru_delete(LRU*, NODE*); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /algorithm/hash_dftl/Makefile: -------------------------------------------------------------------------------- 1 | CC = g++ 2 | 3 | CFLAGS_ALGO +=\ 4 | 5 | SRCS +=\ 6 | dftl.c\ 7 | dftl_range.c\ 8 | garbage_collection.c\ 9 | dftl_utils.c\ 10 | lru_list.c\ 11 | 12 | OBJS :=\ 13 | $(patsubst %.c,%.o,$(SRCS))\ 14 | 15 | OBJS+=skiplist.o 16 | 17 | TARGETOBJ:=\ 18 | $(addprefix ../../object/,$(OBJS))\ 19 | 20 | LEAK: all 21 | all: $(TARGETOBJ) 22 | 23 | ../../object/skiplist.o: ../Lsmtree/skiplist.c 24 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 25 | 26 | libnom.a : $(TARGETOBJ) 27 | $(AR) r $(@) $(TARGETOBJ) 28 | 29 | .c.o : 30 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 31 | 32 | ../../object/%.o: %.c 33 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 34 | 35 | clean : 36 | @$(RM) libnom.a 37 | @$(RM) *.o 38 | -------------------------------------------------------------------------------- /algorithm/hash_dftl/lru_list.h: -------------------------------------------------------------------------------- 1 | #ifndef __DFTL_LRU_LIST__ 2 | #define __DFTL_LRU_LIST__ 3 | 4 | #include 5 | #include 6 | 7 | typedef struct __node{ 8 | void *DATA; 9 | struct __node *next; 10 | struct __node *prev; 11 | } NODE; 12 | 13 | typedef struct __lru{ 14 | int size; 15 | NODE *head; 16 | NODE *tail; 17 | } LRU; 18 | 19 | //lru 20 | void lru_init(LRU**); 21 | void lru_free(LRU*); 22 | NODE* lru_push(LRU*, void*); 23 | void* lru_pop(LRU*); 24 | void lru_update(LRU*, NODE*); 25 | void lru_delete(LRU*, NODE*); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /algorithm/normal/Makefile: -------------------------------------------------------------------------------- 1 | SRCS +=\ 2 | normal.c\ 3 | 4 | OBJS :=\ 5 | $(patsubst %.c,%.o,$(SRCS))\ 6 | 7 | TARGETOBJ:=\ 8 | $(addprefix ../../object/,$(OBJS))\ 9 | 10 | LEAK: all 11 | all: $(TARGETOBJ) 12 | 13 | libnom.a : $(TARGETOBJ) 14 | $(AR) r $(@) $(TARGETOBJ) 15 | 16 | .c.o : 17 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 18 | 19 | ../../object/%.o: %.c 20 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 21 | 22 | clean : 23 | @$(RM) libnom.a 24 | @$(RM) *.o 25 | -------------------------------------------------------------------------------- /algorithm/normal/normal.h: -------------------------------------------------------------------------------- 1 | #include "../../include/container.h" 2 | typedef struct normal_params{ 3 | request *parents; 4 | int test; 5 | }normal_params; 6 | 7 | typedef struct normal_cdf_struct{ 8 | uint64_t total_micro; 9 | uint64_t cnt; 10 | uint64_t max; 11 | uint64_t min; 12 | }n_cdf; 13 | 14 | uint32_t normal_create (lower_info*, blockmanager * d,algorithm *); 15 | void normal_destroy (lower_info*, algorithm *); 16 | uint32_t normal_get(request *const); 17 | uint32_t normal_set(request *const); 18 | uint32_t normal_remove(request *const); 19 | void *normal_end_req(algo_req*); 20 | -------------------------------------------------------------------------------- /algorithm/old/new_pftl/Makefile: -------------------------------------------------------------------------------- 1 | SRCS +=\ 2 | page.c\ 3 | page_utils.c\ 4 | page_gc.c\ 5 | 6 | OBJS :=\ 7 | $(patsubst %.c,%.o,$(SRCS))\ 8 | 9 | TARGETOBJ:=\ 10 | $(addprefix ../../object/,$(OBJS))\ 11 | 12 | 13 | all: $(TARGETOBJ) 14 | 15 | libnom.a : $(TARGETOBJ) 16 | $(AR) r $(@) $(TARGETOBJ) 17 | 18 | .c.o : 19 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 20 | 21 | ../../object/%.o: %.c 22 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 23 | 24 | clean : 25 | @$(RM) libnom.a 26 | @$(RM) *.o 27 | -------------------------------------------------------------------------------- /algorithm/old/page/Makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | 3 | CFLAGS +=\ 4 | -g\ 5 | -std=c99\ 6 | -Wno-discarded-qualifiers\ 7 | 8 | 9 | SRCS +=\ 10 | page_revised.c\ 11 | 12 | OBJS :=\ 13 | $(patsubst %.c,%.o,$(SRCS))\ 14 | 15 | TARGETOBJ:=\ 16 | $(addprefix ../../object/,$(OBJS))\ 17 | 18 | 19 | all: $(TARGETOBJ) 20 | 21 | libnom.a : $(TARGETOBJ) 22 | $(AR) r $(@) $(TARGETOBJ) 23 | 24 | .c.o : 25 | $(CC) $(CFLAGS) -c $< -o $@ 26 | 27 | ../../object/%.o: %.c 28 | $(CC) $(CFLAGS) -c $< -o $@ 29 | 30 | clean : 31 | @$(RM) libnom.a 32 | @$(RM) *.o 33 | -------------------------------------------------------------------------------- /algorithm/old/page/PM_blockqueue.c: -------------------------------------------------------------------------------- 1 | #include "PM_BlockQueue.h" 2 | 3 | void Init_Bqueue(B_queue *queue)//initialize queue for binfo. 4 | { 5 | queue->front = queue->rear = NULL; //single linked, no comp. so NULL 6 | queue->count = 0; //no comp now 7 | } 8 | 9 | int IsEmpty(B_queue *queue) 10 | { 11 | return queue->count == 0; 12 | } 13 | 14 | void Enqueue(B_queue *queue, BINFO* new_info) 15 | { 16 | node *now = (node *)malloc(sizeof(node)); 17 | now->BINFO_node = new_info; 18 | now->next = NULL; //make node and allocate information. 19 | 20 | if (IsEmpty(queue)) // if queue is empty 21 | queue->front = now; 22 | else //if queue is not empty 23 | { 24 | queue->rear->next = now; //set CURRENT rear comp's next as now. 25 | } 26 | queue->rear = now; //change rear pointaer to now. 27 | queue->count++; //component number inc. 28 | } 29 | 30 | BINFO* Dequeue(B_queue *queue) 31 | { 32 | BINFO* re = NULL; 33 | node* now; 34 | if (IsEmpty(queue)) 35 | { 36 | return re; 37 | } 38 | now = queue->front; 39 | re = now->BINFO_node; 40 | queue->front = now->next; 41 | free(now); 42 | queue->count--; 43 | printf("re? %d, %d\n", re->BAD, re->head_ppa); 44 | return re; 45 | 46 | } 47 | 48 | 49 | -------------------------------------------------------------------------------- /algorithm/old/page/PM_blockqueue.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "../../include/settings.h" 6 | 7 | #define OP_area 1 8 | 9 | //this would be the queue structure for Page_selector 10 | //use linked list to build queue. 11 | 12 | typedef struct block_info { 13 | uint64_t head_ppa; 14 | unsigned char BAD; 15 | }BINFO; 16 | 17 | //stores info about each block. 18 | //!!MUST BE MATCHED WITH BADBLOCK_MANAGER FORMAT.!! 19 | 20 | typedef struct node { 21 | BINFO* BINFO_node; 22 | struct node *next; 23 | }node; 24 | //each node has pointer for BINFO and another pointer to next node. 25 | 26 | typedef struct Block_queue 27 | { 28 | node *front; 29 | node *rear; 30 | int count; 31 | }B_queue; 32 | //structure for queue managing. 33 | 34 | void Init_Bqueue(B_queue *queue); 35 | int IsEmpty(B_queue *queue); 36 | void Enqueue(B_queue *queue, BINFO* new_node); 37 | BINFO* Dequeue(B_queue *queue); 38 | 39 | -------------------------------------------------------------------------------- /algorithm/old/page/PM_operation.h: -------------------------------------------------------------------------------- 1 | #include "PM_BlockQueue.h" 2 | 3 | void Selector_Init(BINFO** bp); //initialize selector. uses Block_Manager function. 4 | void Selector_Destroy(); // 5 | uint64_t Giveme_Page(int reserved); //uses Block_Manager function. 6 | uint64_t Set_Free(int block_number, int reserved); 7 | 8 | B_queue empty_queue; 9 | B_queue reserved_queue; 10 | 11 | 12 | -------------------------------------------------------------------------------- /algorithm/old/page/page.h: -------------------------------------------------------------------------------- 1 | #include "../../include/container.h" 2 | typedef struct pbase_params 3 | { 4 | request *parents; 5 | int test; 6 | }pbase_params; 7 | 8 | typedef struct mapping_table{ 9 | int32_t lpa_to_ppa; 10 | int32_t valid_checker; 11 | }TABLE; //table[lpa].lpa_to_ppa = ppa & table[ppa].valid_checker = 0 or 1. 12 | 13 | typedef struct virtual_OOB{ 14 | int32_t reverse_table; 15 | }OOB; //simulates OOB in real SSD. Now, there's info for reverse-mapping. 16 | 17 | typedef struct SRAM{ 18 | int32_t lpa_RAM; 19 | PTR VPTR_RAM; 20 | }SRAM; // use this RAM for Garbage collection. 21 | /* 22 | TABLE *page_TABLE; 23 | OOB *page_OOB; 24 | SRAM *page_SRAM; 25 | uint16_t *invalid_per_block; 26 | //actaul memory allcation & deallocation would be done in create, destroy function. 27 | */ 28 | 29 | uint32_t pbase_create(lower_info*,algorithm *); 30 | void pbase_destroy(lower_info*, algorithm *); 31 | uint32_t pbase_get(request* const); 32 | uint32_t pbase_set(request* const); 33 | uint32_t pbase_remove(request* const); 34 | void *pbase_end_req(algo_req*); 35 | uint32_t SRAM_load(int ppa, int a); // loads info on SRAM. 36 | uint32_t SRAM_unload(int ppa, int a); // unloads info from SRAM. 37 | uint32_t pbase_garbage_collection(); // page- GC function. NOT tested yet. 38 | 39 | -------------------------------------------------------------------------------- /algorithm/old/pftl/Makefile: -------------------------------------------------------------------------------- 1 | SRCS +=\ 2 | page.c\ 3 | page_utils.c\ 4 | page_gc.c\ 5 | 6 | OBJS :=\ 7 | $(patsubst %.c,%.o,$(SRCS))\ 8 | 9 | TARGETOBJ:=\ 10 | $(addprefix ../../object/,$(OBJS))\ 11 | 12 | 13 | all: $(TARGETOBJ) 14 | 15 | libnom.a : $(TARGETOBJ) 16 | $(AR) r $(@) $(TARGETOBJ) 17 | 18 | .c.o : 19 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 20 | 21 | ../../object/%.o: %.c 22 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 23 | 24 | clean : 25 | @$(RM) libnom.a 26 | @$(RM) *.o 27 | -------------------------------------------------------------------------------- /algorithm/old/pftl/PM_blockqueue.c: -------------------------------------------------------------------------------- 1 | #include "PM_blockqueue.h" 2 | 3 | void Init_Bqueue(B_queue *queue)//initialize queue for binfo. 4 | { 5 | queue->front = queue->rear = NULL; //single linked, no comp. so NULL 6 | queue->count = 0; //no comp now 7 | } 8 | 9 | int IsEmpty(B_queue *queue) 10 | { 11 | return queue->count == 0; 12 | } 13 | 14 | void Enqueue(B_queue *queue, int _idx) 15 | { 16 | node_bqueue *now = (node_bqueue *)malloc(sizeof(node_bqueue)); 17 | now->idx = _idx; 18 | now->next = NULL; //make node_bqueue and allocate information. 19 | 20 | if (IsEmpty(queue)) // if queue is empty 21 | queue->front = now; 22 | else //if queue is not empty 23 | { 24 | queue->rear->next = now; //set CURRENT rear comp's next as now. 25 | } 26 | queue->rear = now; //change rear pointaer to now. 27 | queue->count++; //component number inc. 28 | } 29 | 30 | int Dequeue(B_queue *queue) 31 | { 32 | int re = -1; 33 | node_bqueue* now; 34 | if (IsEmpty(queue)) 35 | { 36 | return re; 37 | } 38 | now = queue->front; 39 | re = now->idx; 40 | queue->front = now->next; 41 | free(now); 42 | queue->count--; 43 | return re; 44 | } 45 | 46 | 47 | -------------------------------------------------------------------------------- /algorithm/old/pftl/PM_blockqueue.h: -------------------------------------------------------------------------------- 1 | #ifndef _PM_BLOCKQUEUE_H_ 2 | #define _PM_BLOCKQUEUE_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "../../include/settings.h" 9 | #include "../../BM_Interface.h" 10 | 11 | //this would be the queue structure for Page_selector 12 | //use linked list to build queue. 13 | 14 | typedef struct node_bqueue { 15 | int idx; 16 | struct node_bqueue *next; 17 | }node_bqueue; 18 | //each node_bqueue has pointer for Block and another pointer to next node. 19 | 20 | typedef struct Block_queue 21 | { 22 | node_bqueue *front; 23 | node_bqueue *rear; 24 | int count; 25 | }B_queue; 26 | //structure for queue managing. 27 | 28 | void Init_Bqueue(B_queue *queue); 29 | int IsEmpty(B_queue *queue); 30 | void Enqueue(B_queue *queue, int _idx); 31 | int Dequeue(B_queue *queue); 32 | 33 | #endif // !_PM_BLOCKQUEUE_H_ 34 | -------------------------------------------------------------------------------- /algorithm/old/pftl/PM_interface.c: -------------------------------------------------------------------------------- 1 | #include "page.h" 2 | 3 | B_queue free_queue; 4 | B_queue reserved_queue; 5 | int local_count = 0; //idx of local page in blk. 6 | 7 | extern int64_t PPA_status; 8 | 9 | void PM_init(){ 10 | /*this function initializes blockinfo queue. 11 | allocate 1 block to reserved queue. 12 | allocate others to free queue. 13 | */ 14 | int op = 1; //num of overprovision block. 15 | Init_Bqueue(&free_queue); 16 | Init_Bqueue(&reserved_queue); 17 | 18 | for(int i=0;i<_NOB;i++){ 19 | if(op != 0){ 20 | Enqueue(&reserved_queue,i); 21 | op--; 22 | } 23 | else 24 | Enqueue(&free_queue,i); 25 | } 26 | } 27 | 28 | void PM_destroy(){ 29 | /*this function frees binfo blocks. 30 | finds current free & reserved binfo node. 31 | frees those nodes. 32 | */ 33 | int current_free = free_queue.count; 34 | int current_reserved = reserved_queue.count; 35 | 36 | for (int i=0;i 5 | #include 6 | 7 | typedef struct __node{ 8 | void *DATA; 9 | struct __node *next; 10 | struct __node *prev; 11 | } NODE; 12 | 13 | typedef struct __lru{ 14 | int size; 15 | NODE *head; 16 | NODE *tail; 17 | } LRU; 18 | 19 | //lru 20 | void lru_init(LRU**); 21 | void lru_free(LRU*); 22 | NODE* lru_push(LRU*, void*); 23 | void* lru_pop(LRU*); 24 | void lru_update(LRU*, NODE*); 25 | void lru_delete(LRU*, NODE*); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /badblock.txt: -------------------------------------------------------------------------------- 1 | 753664 2 | 1179648 3 | 1474560 4 | 1490944 5 | 1736704 6 | 1900544 7 | 2555904 8 | 4030464 9 | 4128768 10 | 4308992 11 | 4325376 12 | 4898816 13 | 5898240 14 | 6062080 15 | 6520832 16 | 6619136 17 | 7421952 18 | 7684096 19 | 7864320 20 | 8028160 21 | 8093696 22 | 8552448 23 | 9388032 24 | 11403264 25 | 12976128 26 | 13254656 27 | 13484032 28 | 14778368 29 | 18628608 30 | 18792448 31 | 22134784 32 | 22167552 33 | 22200320 34 | 22331392 35 | 22364160 36 | 22396928 37 | 22429696 38 | 22462464 39 | 22495232 40 | 22528000 41 | 22560768 42 | 22593536 43 | 22626304 44 | 23625728 45 | 23822336 46 | 24395776 47 | 24559616 48 | 24641536 49 | 24657920 50 | 26591232 51 | 27148288 52 | 27181056 53 | 27213824 54 | 27246592 55 | 27279360 56 | 28229632 57 | 28590080 58 | 29376512 59 | 29540352 60 | 30081024 61 | 30261248 62 | 31588352 63 | 33079296 64 | 33112064 65 | 33144832 66 | 33210368 67 | 33243136 68 | 33275904 69 | 34832384 70 | 34996224 71 | 37535744 72 | 38961152 73 | 39174144 74 | 39993344 75 | 40075264 76 | 40550400 77 | 40583168 78 | 42876928 79 | 43089920 80 | 44810240 81 | 45219840 82 | 46202880 83 | 46874624 84 | 48594944 85 | 49070080 86 | 49577984 87 | 50053120 88 | 51576832 89 | 51609600 90 | 51904512 91 | 92 | -------------------------------------------------------------------------------- /bench/measurement.h: -------------------------------------------------------------------------------- 1 | #ifndef __MEASURE_H__ 2 | #define __MEASURE_H__ 3 | #include 4 | #include "../include/settings.h" 5 | typedef struct linktime{ 6 | struct timeval start,end; 7 | struct linktime * next; 8 | }linktime; 9 | 10 | typedef struct MeasureTime{ 11 | linktime *header; 12 | struct timeval adding; 13 | uint64_t micro_time; 14 | uint64_t max; 15 | bool isused; 16 | int call; 17 | int cnt; 18 | }MeasureTime; 19 | 20 | 21 | void measure_init(MeasureTime *); 22 | void measure_start(MeasureTime *); 23 | void measure_pop(MeasureTime *); 24 | void measure_stamp(MeasureTime *); 25 | void measure_adding(MeasureTime *); 26 | void measure_calc_max(MeasureTime *); 27 | void measure_adding_print(MeasureTime *m); 28 | struct timeval measure_res(MeasureTime *); 29 | #ifdef DCPP 30 | #include 31 | void measure_end(MeasureTime *,std::string); 32 | #else 33 | void measure_end(MeasureTime *,const char *); 34 | #endif 35 | void measure_calc(MeasureTime *); 36 | void donothing(MeasureTime *t); 37 | void donothing2(MeasureTime *t,char *a); 38 | #endif 39 | -------------------------------------------------------------------------------- /blockmanager/base/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | echo nothing 3 | -------------------------------------------------------------------------------- /blockmanager/partition/Makefile: -------------------------------------------------------------------------------- 1 | SRCS +=\ 2 | pt_block_manager.c\ 3 | 4 | OBJS :=\ 5 | $(patsubst %.c,%.o,$(SRCS))\ 6 | 7 | TARGETOBJ:=\ 8 | $(addprefix ../../object/,$(OBJS))\ 9 | 10 | all: $(TARGETOBJ) 11 | 12 | .c.o : ../../include/settings.h 13 | $(CC) $(CFLAGS_ALGO) -c $< -o $@ 14 | 15 | ../../object/%.o: %.c ../../include/settings.h 16 | $(CC) $(CFLAGS) $(CFLAGS_ALGO) -c $< -o $@ 17 | 18 | 19 | clean : 20 | @$(RM) *.o 21 | -------------------------------------------------------------------------------- /blockmanager/partition/pt_block_manager.h: -------------------------------------------------------------------------------- 1 | #ifndef __P_BM_HEADER 2 | #define __P_BM_HEADER 3 | #include "../../include/settings.h" 4 | #include "../../include/container.h" 5 | #include "../../interface/queue.h" 6 | #include "../../include/data_struct/heap.h" 7 | #include "../base_block_manager.h" 8 | #include 9 | 10 | typedef struct part_info{ 11 | int pnum; 12 | int *now_assign; 13 | int *max_assign; 14 | int *from; 15 | int *to; 16 | channel **p_channel; 17 | }p_info; 18 | 19 | uint32_t pbm_create(blockmanager *bm, int pnum, int *epn, lower_info *li); 20 | uint32_t pbm_destroy(blockmanager *bm); 21 | __segment* pbm_pt_get_segment(blockmanager *bm, int pnum, bool isreserve); 22 | __segment* pbm_change_pt_reserve(blockmanager *bm, int pt_num, __segment* reserve); 23 | __gsegment* pbm_pt_get_gc_target(blockmanager* bm, int pnum); 24 | int pbm_pt_remain_page(blockmanager* bm, __segment *active, int pt_num); 25 | 26 | void pbm_pt_trim_segment(blockmanager* bm, int pt_num, __gsegment *target, lower_info *li); 27 | bool pbm_pt_isgc_needed(struct blockmanager* bm, int pt_num); 28 | uint32_t pbm_reserve_to_free(struct blockmanager *bm, int ptnum,__segment *reserve); 29 | #endif 30 | -------------------------------------------------------------------------------- /include/FS.c: -------------------------------------------------------------------------------- 1 | #include "FS.h" 2 | #include "container.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #ifdef bdbm_drv 9 | extern lower_info memio_info; 10 | #endif 11 | int F_malloc(void **ptr, int size,int rw){ 12 | int dmatag=0; 13 | if(rw!=FS_SET_T && rw!=FS_GET_T){ 14 | printf("type error! in F_MALLOC\n"); 15 | abort(); 16 | } 17 | #ifdef bdbm_drv 18 | dmatag=memio_info.lower_alloc(rw,(char**)ptr); 19 | #elif linux_aio 20 | if(size%(4*K)){ 21 | (*ptr)=malloc(size); 22 | }else{ 23 | int res; 24 | void *target; 25 | res=posix_memalign(&target,4*K,size); 26 | memset(target,0,size); 27 | 28 | if(res){ 29 | printf("failed to allocate memory:%d\n",errno); 30 | } 31 | *ptr=target; 32 | } 33 | #else 34 | (*ptr)=malloc(size); 35 | #endif 36 | if(rw==FS_MALLOC_R){ 37 | // printf("alloc tag:%d\n",dmatag); 38 | } 39 | return dmatag; 40 | } 41 | void F_free(void *ptr,int tag,int rw){ 42 | #ifdef bdbm_drv 43 | memio_info.lower_free(rw,tag); 44 | #else 45 | free(ptr); 46 | #endif 47 | return; 48 | } 49 | -------------------------------------------------------------------------------- /include/FS.h: -------------------------------------------------------------------------------- 1 | #ifndef __H_FS__ 2 | #define __H_FS__ 3 | #define DMARBUF 1 4 | #define DMAWBUF 2 5 | int F_malloc(void **,int size, int rw); 6 | void F_free(void *, int tag, int rw); 7 | #endif 8 | -------------------------------------------------------------------------------- /include/data_struct/data_struct_test/Makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | 3 | all: test 4 | 5 | CFLAGS+=\ 6 | -g\ 7 | # -fsanitize=address\ 8 | 9 | SRCS +=\ 10 | heap.c\ 11 | 12 | TARGETOBJ=\ 13 | $(patsubst %.c,%.o,$(SRCS))\ 14 | 15 | test:$(TARGETOBJ) main.c 16 | $(CC) $(CFLAGS) -o $@ $^ 17 | 18 | .c.o: 19 | $(CC) $(CFLAGS) -c $< -o $@ 20 | 21 | clean: 22 | @$(RM) *.o 23 | @$(RM) test 24 | -------------------------------------------------------------------------------- /include/data_struct/data_struct_test/heap.h: -------------------------------------------------------------------------------- 1 | #include "../../settings.h" 2 | #define MHPARENTPTR(mh,idx) &((mh->body)[idx/2]) 3 | #define MHL_CHIPTR(mh,idx) &((mh->body)[idx*2]) 4 | #define MHR_CHIPTR(mh,idx) &((mh->body)[idx*2+1]) 5 | 6 | typedef struct heap_node{ 7 | uint64_t cnt; 8 | void *data; 9 | }hn; 10 | 11 | typedef struct max_heap{ 12 | hn* body; 13 | int size; 14 | int max; 15 | void (*swap_hptr)(void * a, void *b); 16 | void (*assign_hptr)(void *a, void* mh); 17 | int (*get_cnt)(void *a); 18 | }mh; 19 | 20 | void mh_init(mh**, int bn, void (*swap_hptr)(void*,void*), void(*aassign_hptr)(void *, void *),int (*get_cnt)(void *a)); 21 | void mh_free(mh*); 22 | void mh_insert(mh*, void *data, int number); 23 | void mh_insert_append(mh *, void *data); 24 | void mh_construct(mh *); 25 | void* mh_get_max(mh*); 26 | void mh_update(mh*,int number, void *hptr); 27 | 28 | -------------------------------------------------------------------------------- /include/data_struct/data_struct_test/main.c: -------------------------------------------------------------------------------- 1 | #include "heap.h" 2 | #include 3 | #include 4 | #include 5 | 6 | typedef struct int_node{ 7 | int cnt; 8 | void *hptr; 9 | }inode; 10 | 11 | #define ALLNUM 1025 12 | 13 | void inode_swap_hptr( void *a, void *b){ 14 | inode *aa=(inode*)a; 15 | inode *bb=(inode*)b; 16 | 17 | void *temp=aa->hptr; 18 | aa->hptr=bb->hptr; 19 | bb->hptr=temp; 20 | } 21 | 22 | void inode_assign_ptr(void *a, void *mh){ 23 | inode *aa=(inode*)a; 24 | aa->hptr=mh; 25 | } 26 | 27 | int inode_get_cnt(void *a){ 28 | inode *aa=(inode*)a; 29 | return aa->cnt; 30 | } 31 | 32 | int main(){ 33 | mh *h; 34 | inode *t=(inode *)malloc(sizeof(inode)*ALLNUM); 35 | mh_init(&h,ALLNUM,inode_swap_hptr,inode_assign_ptr,inode_get_cnt); 36 | 37 | for(int i=0; icnt); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /include/data_struct/data_struct_test/test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgist-datalab/FlashFTLDriver/107d83b71ea29e25dbb57ab7b8ecc56f29589032/include/data_struct/data_struct_test/test -------------------------------------------------------------------------------- /include/data_struct/hash.h: -------------------------------------------------------------------------------- 1 | #ifndef _DATA_STRUCT_HASH_H__ 2 | #define _DATA_STRUCT_HASH_H__ 3 | #include 4 | #define MULTIFACTOR 5 5 | typedef struct __hash_node{ 6 | void *inter_ptr; 7 | void *data; 8 | uint32_t t_idx; 9 | uint32_t key; 10 | }__hash_node; 11 | 12 | typedef struct __hash{ 13 | __hash_node* table; 14 | int32_t n_size; 15 | int32_t m_size; 16 | int32_t table_size; 17 | }__hash; 18 | 19 | __hash* __hash_init(uint32_t size); 20 | int __hash_insert(__hash *h,uint32_t key,void *data, void* inter_ptr, void **updated); 21 | void* __hash_delete_by_key(__hash *h,uint32_t key); 22 | void* __hash_delete_by_idx(__hash *h,uint32_t idx); 23 | void* __hash_find_data(__hash *h, uint32_t key); 24 | __hash_node* __hash_find_node(__hash *h,uint32_t key); 25 | __hash_node* __hash_get_node(__hash *h,uint32_t idx); 26 | void __hash_free(__hash *h); 27 | #endif 28 | -------------------------------------------------------------------------------- /include/data_struct/hash_kv.h: -------------------------------------------------------------------------------- 1 | #ifndef _DATA_STRUCT_HASH_H__ 2 | #define _DATA_STRUCT_HASH_H__ 3 | #include 4 | #define MULTIFACTOR 5 5 | #include "../settings.h" 6 | 7 | typedef struct __hash_node{ 8 | void *inter_ptr; 9 | void *data; 10 | uint32_t t_idx; 11 | uint32_t key; 12 | KEYT kv_key; 13 | }__hash_node; 14 | 15 | typedef struct __hash{ 16 | __hash_node* table; 17 | int32_t n_size; 18 | int32_t m_size; 19 | int32_t table_size; 20 | }__hash; 21 | 22 | __hash* __hash_init(uint32_t size); 23 | int __hash_insert(__hash *h,KEYT key,void *data, void* inter_ptr, void **updated); 24 | void* __hash_delete_by_key(__hash *h,uint32_t key); 25 | void* __hash_delete_by_idx(__hash *h,uint32_t idx); 26 | void* __hash_find_data(__hash *h, KEYT key); 27 | __hash_node* __hash_find_node(__hash *h,KEYT key); 28 | __hash_node* __hash_get_node(__hash *h,uint32_t idx); 29 | void __hash_free(__hash *h); 30 | #endif 31 | -------------------------------------------------------------------------------- /include/data_struct/heap.h: -------------------------------------------------------------------------------- 1 | #ifndef __HEAP_HEADER 2 | #define __HEAP_HEADER 3 | #include "../settings.h" 4 | #define MHPARENTPTR(mh,idx) &((mh->body)[idx/2]) 5 | #define MHL_CHIPTR(mh,idx) &((mh->body)[idx*2]) 6 | #define MHR_CHIPTR(mh,idx) &((mh->body)[idx*2+1]) 7 | 8 | typedef struct heap_node{ 9 | uint64_t cnt; 10 | void *data; 11 | }hn; 12 | 13 | typedef struct max_heap{ 14 | hn* body; 15 | int size; 16 | int max; 17 | void (*swap_hptr)(void * a, void *b); 18 | void (*assign_hptr)(void *a, void* mh); 19 | int (*get_cnt)(void *a); 20 | }mh; 21 | 22 | void mh_init(mh**, int bn, void (*swap_hptr)(void*,void*), void(*aassign_hptr)(void *, void *),int (*get_cnt)(void *a)); 23 | void mh_free(mh*); 24 | void mh_insert(mh*, void *data, int number); 25 | void mh_insert_append(mh *, void *data); 26 | void mh_construct(mh *); 27 | void* mh_get_max(mh*); 28 | void mh_update(mh*,int number, void *hptr); 29 | #endif 30 | -------------------------------------------------------------------------------- /include/data_struct/list.c: -------------------------------------------------------------------------------- 1 | #include"list.h" 2 | #include 3 | 4 | list* list_init(){ 5 | list *res=(list*)malloc(sizeof(list)); 6 | 7 | res->size=0; 8 | res->head=res->tail=NULL; 9 | return res; 10 | } 11 | 12 | inline li_node *new_li_node(void *data){ 13 | li_node* res=(li_node*)malloc(sizeof(li_node)); 14 | res->data=data; 15 | res->prv=res->nxt=NULL; 16 | return res; 17 | } 18 | 19 | 20 | void list_insert(list *li, void *data){ 21 | li_node *t=new_li_node(data); 22 | li->size++; 23 | if(!li->head){ 24 | li->head=li->tail=t; 25 | return; 26 | } 27 | 28 | t->prv=li->tail; 29 | li->tail->nxt=t; 30 | li->tail=t; 31 | return; 32 | } 33 | 34 | void list_delete_node(list *li, li_node* t){ 35 | if(t==li->head){ 36 | li->head=li->head->nxt; 37 | if(li->head) 38 | li->head->prv=NULL; 39 | } 40 | else if(t==li->tail){ 41 | li->tail=li->tail->prv; 42 | if(li->tail) 43 | li->tail->nxt=NULL; 44 | } 45 | else{ 46 | li_node *prv=t->prv, *nxt=t->nxt; 47 | prv->nxt=nxt; 48 | nxt->prv=prv; 49 | } 50 | li->size--; 51 | free(t); 52 | } 53 | void list_free(list *li){ 54 | li_node *now, *nxt; 55 | if(li->size){ 56 | for_each_list_node_safe(li,now,nxt){ 57 | list_delete_node(li,now); 58 | } 59 | } 60 | free(li); 61 | } 62 | -------------------------------------------------------------------------------- /include/data_struct/list.h: -------------------------------------------------------------------------------- 1 | #ifndef __H_LIST_H 2 | #define __H_LIST_H 3 | typedef struct list_node{ 4 | void *data; 5 | struct list_node *prv; 6 | struct list_node *nxt; 7 | }li_node; 8 | 9 | typedef struct list{ 10 | int size; 11 | struct list_node *head; 12 | struct list_node *tail; 13 | }list; 14 | 15 | 16 | list* list_init(); 17 | void list_insert(list *, void *data); 18 | void list_delete_node(list *, li_node*); 19 | void list_free(list *li); 20 | 21 | #define for_each_list_node(li, ln)\ 22 | for(ln=li->head; ln!=NULL; ln=ln->nxt) 23 | 24 | 25 | #define for_each_list_node_safe(li, ln, lp)\ 26 | for(ln=li->head, lp=li->head->nxt; ln!=NULL; ln=lp, lp=ln?ln->nxt:NULL) 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /include/data_struct/lru_list.h: -------------------------------------------------------------------------------- 1 | #ifndef __DFTL_LRU_LIST__ 2 | #define __DFTL_LRU_LIST__ 3 | 4 | #include 5 | #include 6 | 7 | typedef struct __node{ 8 | void *DATA; 9 | struct __node *next; 10 | struct __node *prev; 11 | } NODE; 12 | 13 | typedef struct __lru{ 14 | int size; 15 | NODE *head; 16 | NODE *tail; 17 | } LRU; 18 | 19 | //lru 20 | void lru_init(LRU**); 21 | void lru_free(LRU*); 22 | NODE* lru_push(LRU*, void*); 23 | void* lru_pop(LRU*); 24 | void lru_update(LRU*, NODE*); 25 | void lru_delete(LRU*, NODE*); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /include/demand_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef __DEMAND_SETTINGS_H__ 2 | #define __DEMAND_SETTINGS_H__ 3 | 4 | #include "settings.h" 5 | 6 | #ifdef KVSSD 7 | #define HASH_KVSSD 8 | 9 | /* Storing the key(or fingerprint(hash) of the key) in the mapping entry */ 10 | #define FP_SIZE 0 11 | #if (FP_SIZE > 0) 12 | #define STORE_KEY_FP 13 | #endif 14 | 15 | 16 | /* Support variable-sized value. Grain entries of the mapping table as GRAINED_UNIT */ 17 | #define GRAINED_UNIT ( PIECE ) 18 | #define VAR_VALUE_MIN ( MINVALUE ) 19 | #define VAR_VALUE_MAX ( PAGESIZE ) 20 | #define GRAIN_PER_PAGE ( PAGESIZE / GRAINED_UNIT ) 21 | 22 | /* Max hash collision count to logging ( refer utility.c:hash_collision_logging() ) */ 23 | #define MAX_HASH_COLLISION 1024 24 | #endif 25 | 26 | 27 | #define DEMAND_WARNING 1 28 | 29 | #if DEMAND_WARNING 30 | /* Warning options here */ 31 | #define WARNING_NOTFOUND 32 | #endif 33 | 34 | 35 | #define PART_RATIO 0.5 36 | 37 | #define WRITE_BACK 38 | #define MAX_WRITE_BUF 256 39 | 40 | #define STRICT_CACHING 41 | 42 | #define PRINT_GC_STATUS 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /include/dftl_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef __H_SETDFTL__ 2 | #define __H_SETDFTL__ 3 | 4 | // clean cache flag 5 | #define C_CACHE 1 6 | 7 | // memcpy op gc flag 8 | #define MEMCPY_ON_GC 1 9 | 10 | // flying mapping page request waiting flag 11 | #define FLYING 0 12 | 13 | // write buffering flag 14 | #define W_BUFF 1 15 | 16 | // write buffering polling flag depend to W_BUFF 17 | #define W_BUFF_POLL 0 18 | 19 | // gc polling flag 20 | #define GC_POLL 0 21 | 22 | // eviction polling flag 23 | #define EVICT_POLL 0 24 | 25 | // max size of write buffer 26 | #define MAX_SL 1024 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /include/dl_sync.c: -------------------------------------------------------------------------------- 1 | #include "dl_sync.h" 2 | #include "settings.h" 3 | #include 4 | void dl_sync_init(dl_sync *s, uint64_t cnt){ 5 | #ifdef SPINSYNC 6 | s->target_cnt=cnt; 7 | s->now_cnt=0; 8 | #else 9 | pthread_mutex_init(&s->mutex_sync,NULL); 10 | pthread_mutex_lock(&s->mutex_sync); 11 | #endif 12 | } 13 | //static int max_cnt, cnt; 14 | void dl_sync_wait(dl_sync*s){ 15 | #ifdef SPINSYNC 16 | 17 | // cnt=0; 18 | while(s->target_cnt!=s->now_cnt){ 19 | //cnt++; 20 | } 21 | /* 22 | if(max_cntnow_cnt=0; 27 | #else 28 | pthread_mutex_lock(&s->mutex_sync); 29 | #endif 30 | } 31 | 32 | void dl_sync_arrive(dl_sync*s){ 33 | #ifdef SPINSYNC 34 | s->now_cnt++; 35 | #else 36 | pthread_mutex_unlock(&s->mutex_sync); 37 | #endif 38 | } 39 | 40 | void dl_syncM_init(dl_sync_m *s, uint64_t cnt){ 41 | s->target_cnt=cnt; 42 | s->now_cnt=0; 43 | pthread_mutex_init(&s->mutex_sync,NULL); 44 | pthread_mutex_lock(&s->mutex_sync); 45 | } 46 | 47 | void dl_syncM_wait(dl_sync_m* s){ 48 | #ifdef SPINSYNC 49 | while(s->target_cnt!=s->now_cnt){} 50 | s->now_cnt=0; 51 | #else 52 | pthread_mutex_lock(&s->mutex_sync); 53 | #endif 54 | } 55 | 56 | void dl_syncM_arrive(dl_sync_m* s){ 57 | s->now_cnt++; 58 | #ifdef SPINSYNC 59 | #else 60 | if(s->now_cnt==s->target_cnt){ 61 | pthread_mutex_unlock(&s->mutex_sync); 62 | s->now_cnt=0; 63 | } 64 | #endif 65 | } 66 | 67 | void dl_syncM_cnt_update(dl_sync_m *s, uint64_t cnt){ 68 | s->target_cnt=cnt; 69 | s->now_cnt=0; 70 | } 71 | -------------------------------------------------------------------------------- /include/dl_sync.h: -------------------------------------------------------------------------------- 1 | #ifndef __H_DL_SYNC 2 | #define __H_DL_SYNC 3 | #include 4 | #include 5 | #include "settings.h" 6 | typedef struct dl_syncronizer{ 7 | #ifdef SPINSYNC 8 | volatile uint64_t target_cnt; 9 | volatile uint64_t now_cnt; 10 | #else 11 | pthread_mutex_t mutex_sync; 12 | #endif 13 | }dl_sync; 14 | 15 | typedef struct dl_syncornizer_multi{ 16 | uint64_t target_cnt; 17 | uint64_t now_cnt; 18 | pthread_mutex_t mutex_sync; 19 | }dl_sync_m; 20 | 21 | void dl_sync_init(dl_sync *, uint64_t cnt); 22 | void dl_sync_wait(dl_sync*); 23 | void dl_sync_arrive(dl_sync*); 24 | 25 | void dl_syncM_init(dl_sync_m *, uint64_t cnt); 26 | void dl_syncM_wait(dl_sync_m*); 27 | void dl_syncM_arrive(dl_sync_m*); 28 | void dl_syncM_cnt_update(dl_sync_m *, uint64_t cnt); 29 | #endif 30 | -------------------------------------------------------------------------------- /include/flash_sock/Makefile: -------------------------------------------------------------------------------- 1 | 2 | CFLAGS=\ 3 | -g\ 4 | 5 | SRCS+=\ 6 | fd_sock.c\ 7 | buffer_manager.c\ 8 | 9 | 10 | TARGETOBJ =\ 11 | $(patsubst %.c,%.o,$(SRCS))\ 12 | 13 | socktest: main.c libfdsock.a 14 | $(CC) $(CFLAGS) -o $@ $^ 15 | 16 | libfdsock.a:$(TARGETOBJ) 17 | $(AR) r $(@) *.o; rm *.o 18 | 19 | 20 | .c.o : 21 | $(CC) $(COMMONFLAGS) -c $< -o $@ 22 | 23 | clean: 24 | @$(RM) *.o 25 | @$(RM) libfdsock.a 26 | @$(RM) socktest 27 | 28 | -------------------------------------------------------------------------------- /include/flash_sock/buffer_manager.h: -------------------------------------------------------------------------------- 1 | #ifndef BUF_MANAGER_H 2 | #define BUF_MANAGER_H 3 | #define MAXBUF 128 4 | 5 | typedef struct fd_sock_manager fd_sock_m; 6 | typedef struct buf_manager{ 7 | int fd; 8 | int idx; 9 | int remain; 10 | char start; 11 | char buf[MAXBUF]; 12 | char isfitbuffer; 13 | }mybuf; 14 | 15 | void buf_add_idx(mybuf*, int add); 16 | int buf_is_close_with_add(mybuf *,int add); 17 | int buf_strncmp(mybuf*, char *, int buf_len); 18 | void buf_cpy_len(char *des, mybuf *, int len); 19 | int buf_get_number(mybuf *); 20 | #endif 21 | -------------------------------------------------------------------------------- /include/flash_sock/main.c: -------------------------------------------------------------------------------- 1 | #include "fd_sock.h" 2 | 3 | int main(){ 4 | fd_sock_m *m=fd_sock_init("127.0.0.1",9999,REDIS); 5 | netdata temp; 6 | while(1){ 7 | fd_sock_read_redis(m,&temp); 8 | fd_sock_write_redis(m,&temp); 9 | } 10 | return 1; 11 | } 12 | -------------------------------------------------------------------------------- /include/lsm_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef __H_SETLSM__ 2 | #define __H_SETLSM__ 3 | #include "settings.h" 4 | 5 | /*lsmtree structure*/ 6 | #define FULLMAPNUM 1024 7 | #ifdef KVSSD 8 | #define KEYBITMAP 1024 9 | #endif 10 | 11 | #if LEVELN!=1 12 | #define BLOOM 13 | //#define MONKEY 14 | #endif 15 | 16 | 17 | //#define EMULATOR 18 | 19 | #define DEFKEYINHEADER ((PAGESIZE-KEYBITMAP)/DEFKEYLENGTH) 20 | //#define ONESEGMENT (DEFKEYINHEADER*DEFVALUESIZE) 21 | 22 | #define KEYLEN(a) (a.len+sizeof(ppa_t)) 23 | #define READCACHE 24 | #define RANGEGETNUM 2 25 | //#define USINGSLAB 26 | 27 | #define NOEXTENDPPA(ppa) (ppa/NPCINPAGE) 28 | /*lsmtree flash thread*/ 29 | #define KEYSETSIZE 8 30 | #define CTHREAD 1 31 | #define CQSIZE 128 32 | #define FTHREAD 1 33 | #define FQSIZE 2 34 | #define RQSIZE 1024 35 | #define WRITEWAIT 36 | #define MAXKEYSIZE 255 37 | 38 | /*compaction*/ 39 | #define MAXITER 16 40 | #define SPINLOCK 41 | #endif 42 | -------------------------------------------------------------------------------- /include/rwlock.c: -------------------------------------------------------------------------------- 1 | #include "rwlock.h" 2 | void rwlock_init(rwlock *rw){ 3 | pthread_mutex_init(&rw->lock,NULL); 4 | pthread_mutex_init(&rw->cnt_lock,NULL); 5 | rw->readcnt=0; 6 | } 7 | 8 | void rwlock_read_lock(rwlock* rw){ 9 | pthread_mutex_lock(&rw->cnt_lock); 10 | rw->readcnt++; 11 | if(rw->readcnt==1){ 12 | pthread_mutex_lock(&rw->lock); 13 | } 14 | pthread_mutex_unlock(&rw->cnt_lock); 15 | } 16 | 17 | void rwlock_read_unlock(rwlock *rw){ 18 | pthread_mutex_lock(&rw->cnt_lock); 19 | rw->readcnt--; 20 | if(rw->readcnt==0){ 21 | pthread_mutex_unlock(&rw->lock); 22 | } 23 | pthread_mutex_unlock(&rw->cnt_lock); 24 | } 25 | 26 | void rwlock_write_lock(rwlock *rw){ 27 | pthread_mutex_lock(&rw->lock); 28 | } 29 | 30 | void rwlock_write_unlock(rwlock *rw){ 31 | pthread_mutex_unlock(&rw->lock); 32 | } 33 | -------------------------------------------------------------------------------- /include/rwlock.h: -------------------------------------------------------------------------------- 1 | #ifndef RWLOCK_HEADER 2 | #define RWLOCK_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | typedef struct{ 9 | pthread_mutex_t lock; 10 | pthread_mutex_t cnt_lock; 11 | int readcnt; 12 | }rwlock; 13 | 14 | void rwlock_init(rwlock *); 15 | void rwlock_read_lock(rwlock*); 16 | void rwlock_read_unlock(rwlock*); 17 | void rwlock_write_lock(rwlock*); 18 | void rwlock_write_unlock(rwlock*); 19 | #endif 20 | -------------------------------------------------------------------------------- /include/sem_lock.h: -------------------------------------------------------------------------------- 1 | #ifndef __SEM_LOCK_H__ 2 | #define __SEM_LOCK_H__ 3 | #include 4 | #define fdriver_lock_t sem_t 5 | #define fdriver_mutex_init(val) sem_init(val,0,1) 6 | #define fdriver_lock_init(a,val) sem_init(a,0,val) 7 | #define fdriver_lock(a) sem_wait(a) 8 | #define fdriver_try_lock(a) sem_trywait(a) 9 | #define fdriver_unlock(a) sem_post(a) 10 | #define fdriver_destroy(a) sem_destroy(a) 11 | #endif 12 | -------------------------------------------------------------------------------- /include/types.h: -------------------------------------------------------------------------------- 1 | #ifndef __H_TYPES__ 2 | #define __H_TYPES__ 3 | 4 | #define FS_SET_T 1 5 | #define FS_GET_T 2 6 | #define FS_DELETE_T 3 7 | #define FS_AGAIN_R_T 4 8 | #define FS_NOTFOUND_T 5 9 | #define FS_CACHE_HIT_T 6 10 | #define FS_RMW_T 7 11 | #define FS_MSET_T 8 12 | #define FS_MGET_T 9 13 | #define FS_ITER_CRT_T 10 14 | #define FS_ITER_NXT_T 11 15 | #define FS_ITER_NXT_VALUE_T 12 16 | #define FS_ITER_ALL_T 13 17 | #define FS_ITER_ALL_VALUE_T 14 18 | #define FS_ITER_RLS_T 15 19 | #define FS_RANGEGET_T 16 20 | #define FS_BUSE_R 17 21 | #define FS_BUSE_W 18 22 | 23 | #define LREQ_TYPE_NUM 11 24 | #define TRIM 0 25 | #define MAPPINGR 1 26 | #define MAPPINGW 2 27 | #define GCMR 3 28 | #define GCMW 4 29 | #define DATAR 5 30 | #define DATAW 6 31 | #define GCDR 7 32 | #define GCDW 8 33 | #define GCMR_DGC 9 34 | #define GCMW_DGC 10 35 | 36 | #define FS_MALLOC_W 1 37 | #define FS_MALLOC_R 2 38 | typedef enum{ 39 | block_bad, 40 | block_full, 41 | block_empty, 42 | block_he 43 | }lower_status; 44 | 45 | 46 | typedef enum{ 47 | SEQGET,SEQSET,SEQRW, 48 | RANDGET,RANDSET, 49 | RANDRW,MIXED,SEQLATENCY,RANDLATENCY, 50 | NOR,FILLRAND 51 | }bench_type; 52 | 53 | typedef enum{ 54 | MASTER_SEGMENT,MASTER_BLOCK,MASTER_PAGE 55 | }layout_type; 56 | #endif 57 | -------------------------------------------------------------------------------- /include/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef __H_UTIL__ 2 | #define __H_UTIL__ 3 | 4 | #include "../bench/measurement.h" 5 | 6 | #ifndef NPRINTOPTION 7 | #define MT(t) measure_stamp((t)) 8 | #define MS(t) measure_start((t)) 9 | #define ME(t,s) measure_end((t),(s)) 10 | #define MP(t) measure_pop((t)) 11 | #define MC(t) measure_calc((t)) 12 | #define MR(t) measure_res((t)) 13 | #define MA(t) measure_adding((t)) 14 | #define MCM(t) measure_calc_max((t)) 15 | #else 16 | #define MS(t) donothing(t) 17 | #define ME(t,s) donothing2((t),(s)) 18 | #define MP(t) donothing((t)) 19 | #define MC(t) donothing((t)) 20 | #endif 21 | 22 | #define DEBUG_LOG(c) ({\ 23 | printf("[%s]:",c);\ 24 | printf("%s:%d\n",__FILE__,__LINE__);}) 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /include/utils/cond_lock.h: -------------------------------------------------------------------------------- 1 | #ifndef _CL_HEAD 2 | #define _CL_HEAD 3 | #include 4 | #include "../settings.h" 5 | typedef struct{ 6 | pthread_mutex_t mutex; 7 | pthread_cond_t cond; 8 | volatile int cnt; 9 | volatile int now; 10 | bool zero_lock; 11 | }cl_lock; 12 | 13 | cl_lock *cl_init(int cnt,bool); 14 | void cl_grap(cl_lock *); 15 | void cl_cond_grap(cl_lock *,bool); 16 | void cl_always_release(cl_lock*); 17 | void cl_now_update(cl_lock*, int); 18 | void cl_release(cl_lock *); 19 | void cl_free(cl_lock *); 20 | 21 | void cl_grep_with_f(cl_lock *, int s, int d, bool (*cmp)(int,int)); 22 | void cl_release_with_f(cl_lock *, int s, int d, bool (*cmp)(int,int)); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /include/utils/debug_tools.c: -------------------------------------------------------------------------------- 1 | #include "debug_tools.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | void print_trace_step(int a){ 7 | void **array=(void**)malloc(sizeof(void*)*a); 8 | size_t size; 9 | char **strings; 10 | size=backtrace(array,a); 11 | strings=backtrace_symbols(array,size); 12 | 13 | for(uint32_t i=0; i 4 | void dl_sync_init(dl_sync *s, uint64_t cnt){ 5 | #ifdef SPINSYNC 6 | s->target_cnt=cnt; 7 | s->now_cnt=0; 8 | #else 9 | pthread_mutex_init(&s->mutex_sync,NULL); 10 | pthread_mutex_lock(&s->mutex_sync); 11 | #endif 12 | } 13 | //static int max_cnt, cnt; 14 | void dl_sync_wait(dl_sync*s){ 15 | #ifdef SPINSYNC 16 | 17 | // cnt=0; 18 | while(s->target_cnt!=s->now_cnt){ 19 | //cnt++; 20 | } 21 | /* 22 | if(max_cntnow_cnt=0; 27 | #else 28 | pthread_mutex_lock(&s->mutex_sync); 29 | #endif 30 | } 31 | 32 | void dl_sync_arrive(dl_sync*s){ 33 | #ifdef SPINSYNC 34 | s->now_cnt++; 35 | #else 36 | pthread_mutex_unlock(&s->mutex_sync); 37 | #endif 38 | } 39 | 40 | void dl_syncM_init(dl_sync_m *s, uint64_t cnt){ 41 | s->target_cnt=cnt; 42 | s->now_cnt=0; 43 | pthread_mutex_init(&s->mutex_sync,NULL); 44 | pthread_mutex_lock(&s->mutex_sync); 45 | } 46 | 47 | void dl_syncM_wait(dl_sync_m* s){ 48 | #ifdef SPINSYNC 49 | while(s->target_cnt!=s->now_cnt){} 50 | s->now_cnt=0; 51 | #else 52 | pthread_mutex_lock(&s->mutex_sync); 53 | #endif 54 | } 55 | 56 | void dl_syncM_arrive(dl_sync_m* s){ 57 | s->now_cnt++; 58 | #ifdef SPINSYNC 59 | #else 60 | if(s->now_cnt==s->target_cnt){ 61 | pthread_mutex_unlock(&s->mutex_sync); 62 | s->now_cnt=0; 63 | } 64 | #endif 65 | } 66 | 67 | void dl_syncM_cnt_update(dl_sync_m *s, uint64_t cnt){ 68 | s->target_cnt=cnt; 69 | s->now_cnt=0; 70 | } 71 | -------------------------------------------------------------------------------- /include/utils/dl_sync.h: -------------------------------------------------------------------------------- 1 | #ifndef __H_DL_SYNC 2 | #define __H_DL_SYNC 3 | #include 4 | #include 5 | #include "../settings.h" 6 | typedef struct dl_syncronizer{ 7 | #ifdef SPINSYNC 8 | volatile uint64_t target_cnt; 9 | volatile uint64_t now_cnt; 10 | #else 11 | pthread_mutex_t mutex_sync; 12 | #endif 13 | }dl_sync; 14 | 15 | typedef struct dl_syncornizer_multi{ 16 | uint64_t target_cnt; 17 | uint64_t now_cnt; 18 | pthread_mutex_t mutex_sync; 19 | }dl_sync_m; 20 | 21 | void dl_sync_init(dl_sync *, uint64_t cnt); 22 | void dl_sync_wait(dl_sync*); 23 | void dl_sync_arrive(dl_sync*); 24 | 25 | void dl_syncM_init(dl_sync_m *, uint64_t cnt); 26 | void dl_syncM_wait(dl_sync_m*); 27 | void dl_syncM_arrive(dl_sync_m*); 28 | void dl_syncM_cnt_update(dl_sync_m *, uint64_t cnt); 29 | #endif 30 | -------------------------------------------------------------------------------- /include/utils/kvssd.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "../settings.h" 5 | #ifdef KVSSD 6 | char* kvssd_tostring(KEYT key){ 7 | /* 8 | char temp1[255]={0,}; 9 | memcpy(temp1,key.key,key.len);*/ 10 | return key.key; 11 | } 12 | 13 | void kvssd_cpy_key(KEYT *des, KEYT *key){ 14 | des->key=(char*)malloc(sizeof(char)*key->len); 15 | des->len=key->len; 16 | memcpy(des->key,key->key,key->len); 17 | } 18 | void kvssd_free_key(KEYT *des){ 19 | free(des->key); 20 | free(des); 21 | } 22 | #endif 23 | -------------------------------------------------------------------------------- /include/utils/kvssd.h: -------------------------------------------------------------------------------- 1 | #ifndef __H_KVSSD__ 2 | #define __H_KVSSD__ 3 | #include "../settings.h" 4 | 5 | char* kvssd_tostring(KEYT); 6 | void kvssd_cpy_key(KEYT *des,KEYT* src); 7 | void kvssd_free_key(KEYT *des); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /include/utils/rwlock.c: -------------------------------------------------------------------------------- 1 | #include "rwlock.h" 2 | void rwlock_init(rwlock *rw){ 3 | pthread_mutex_init(&rw->lock,NULL); 4 | pthread_mutex_init(&rw->cnt_lock,NULL); 5 | rw->readcnt=0; 6 | } 7 | 8 | void rwlock_read_lock(rwlock* rw){ 9 | pthread_mutex_lock(&rw->cnt_lock); 10 | rw->readcnt++; 11 | if(rw->readcnt==1){ 12 | pthread_mutex_lock(&rw->lock); 13 | } 14 | pthread_mutex_unlock(&rw->cnt_lock); 15 | } 16 | 17 | void rwlock_read_unlock(rwlock *rw){ 18 | pthread_mutex_lock(&rw->cnt_lock); 19 | rw->readcnt--; 20 | if(rw->readcnt==0){ 21 | pthread_mutex_unlock(&rw->lock); 22 | } 23 | pthread_mutex_unlock(&rw->cnt_lock); 24 | } 25 | 26 | void rwlock_write_lock(rwlock *rw){ 27 | pthread_mutex_lock(&rw->lock); 28 | } 29 | 30 | void rwlock_write_unlock(rwlock *rw){ 31 | pthread_mutex_unlock(&rw->lock); 32 | } 33 | -------------------------------------------------------------------------------- /include/utils/rwlock.h: -------------------------------------------------------------------------------- 1 | #ifndef RWLOCK_HEADER 2 | #define RWLOCK_HEADER 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | typedef struct{ 9 | pthread_mutex_t lock; 10 | pthread_mutex_t cnt_lock; 11 | int readcnt; 12 | }rwlock; 13 | 14 | void rwlock_init(rwlock *); 15 | void rwlock_read_lock(rwlock*); 16 | void rwlock_read_unlock(rwlock*); 17 | void rwlock_write_lock(rwlock*); 18 | void rwlock_write_unlock(rwlock*); 19 | #endif 20 | -------------------------------------------------------------------------------- /interface/bb_checker.h: -------------------------------------------------------------------------------- 1 | #ifndef __H_BBCHECKER_H 2 | #define __H_BBCHECKER_H 3 | #include "../include/settings.h" 4 | #include "../include/container.h" 5 | typedef struct badblock_checker_node{ 6 | uint8_t flag; //0 normal 1 badblock 7 | uint32_t origin_segnum; 8 | uint32_t fixed_segnum; 9 | }bb_node; 10 | 11 | typedef struct badblock_checker{ 12 | bb_node ent[_RNOS]; 13 | uint32_t back_index; 14 | }bb_checker; 15 | 16 | void bb_checker_start(lower_info*); 17 | void *bb_checker_process(uint64_t,uint8_t); 18 | void bb_checker_fixing(); 19 | uint32_t bb_checker_fix_ppa(uint32_t ppa); 20 | uint32_t bb_checker_fixed_segment(uint32_t ppa); 21 | uint32_t bb_checker_paired_segment(uint32_t ppa); 22 | #endif 23 | -------------------------------------------------------------------------------- /interface/buse.h: -------------------------------------------------------------------------------- 1 | #ifndef BUSE_H_INCLUDED 2 | #define BUSE_H_INCLUDED 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | #include "../include/types.h" 10 | #include "../include/settings.h" 11 | #include "interface.h" 12 | 13 | struct buse{ 14 | int sk; 15 | u_int32_t len; 16 | int i_len; 17 | int i_offset; 18 | int offset; 19 | u_int64_t log_offset; 20 | int type; 21 | void *chunk; 22 | value_set *value; 23 | void *reply; 24 | char handle[8]; 25 | bool write_check; 26 | }; 27 | 28 | struct buse_request { 29 | int type; 30 | u_int32_t len; 31 | void *buf; 32 | u_int64_t offset; 33 | char handle[8]; 34 | }; 35 | 36 | struct buse_operations { 37 | int (*read)(int sk,void *buf, u_int32_t len, u_int64_t offset, void *userdata); 38 | int (*write)(int sk,const void *buf, u_int32_t len, u_int64_t offset, void *userdata); 39 | void (*disc)(int sk,void *userdata); 40 | int (*flush)(int sk,void *userdata); 41 | int (*trim)(int sk,u_int64_t from, u_int32_t len, void *userdata); 42 | 43 | // either set size, OR set both blksize and size_blocks 44 | u_int64_t size; 45 | u_int32_t blksize; 46 | u_int64_t size_blocks; 47 | }; 48 | 49 | int buse_main(const char* dev_file, const struct buse_operations *bop, void *userdata); 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | int write_all(int fd, char* buf, size_t count); 56 | #endif /* BUSE_H_INCLUDED */ 57 | -------------------------------------------------------------------------------- /interface/lfqueue.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "lfqueue.c" 5 | void q_init(struct queue** q, int size){ 6 | (*q)=(queue*)malloc(sizeof(queue)); 7 | (*q)->head=(node*)malloc(sizeof(node)); 8 | (*q)->tail=(*q)->head; 9 | (*q)->head->n=NULL; 10 | (*q)->head->next=NULL; 11 | 12 | (*q)->size=0; 13 | (*q)->m_size=size; 14 | } 15 | 16 | bool q_enqueue(void *val,struct queue* q){ 17 | struct node *n; 18 | struct node *_node=(node*)malloc(sizeof(node)); 19 | _node->n=val; 20 | _node->next=NULL; 21 | 22 | while (1) { 23 | n = q->tail; 24 | if(__sync_bool_compare_and_swap((&q->size),q->m_size,q->m_size)){ 25 | free(_node); 26 | return false; 27 | } 28 | if (__sync_bool_compare_and_swap(&(n->next), NULL, _node)) { 29 | break; 30 | } else { 31 | __sync_bool_compare_and_swap(&(q->tail), n, n->next); 32 | } 33 | } 34 | __sync_bool_compare_and_swap(&(q->tail), n, _node); 35 | __sync_fetch_and_add(&q->size,1); 36 | return true; 37 | } 38 | 39 | void *q_dequeue(struct queue *q){ 40 | struct node* n; 41 | void *val; 42 | while(1){ 43 | n=q->head; 44 | if(n->next==NULL){ 45 | return NULL; 46 | } 47 | if(__sync_bool_compare_and_swap(&(q->head),n,n->next)){ 48 | break; 49 | } 50 | } 51 | 52 | val=(void*)n->next->n; 53 | free(n); 54 | __sync_fetch_and_sub(&q->size,1); 55 | return val; 56 | } 57 | 58 | void q_free(struct queue *q){ 59 | while(q_dequeue(q)){} 60 | free(q); 61 | } 62 | -------------------------------------------------------------------------------- /interface/lfqueue.h: -------------------------------------------------------------------------------- 1 | #ifndef __H_QUEUE_Q_ 2 | #define __H_QUEUE_Q_ 3 | #include "../include/settings.h" 4 | 5 | #include 6 | typedef struct node{ 7 | void *n; 8 | struct node *next; 9 | }node; 10 | typedef struct queue{ 11 | int size; 12 | int m_size; 13 | node *head; 14 | node *tail; 15 | }queue; 16 | void q_init(queue**,int); 17 | bool q_enqueue(void *,queue*); 18 | void *q_dequeue(queue*); 19 | void q_free(queue*); 20 | #endif 21 | -------------------------------------------------------------------------------- /interface/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "../include/FS.h" 7 | #include "../include/settings.h" 8 | #include "../include/types.h" 9 | #include "../bench/bench.h" 10 | #include "interface.h" 11 | #include "../include/utils/kvssd.h" 12 | 13 | int main(int argc,char* argv[]){ 14 | /* 15 | to use the custom benchmark setting the first parameter of 'inf_init' set false 16 | if not, set the parameter as true. 17 | the second parameter is not used in anycase. 18 | */ 19 | inf_init(0,0,0,NULL); 20 | 21 | /*initialize the cutom bench mark*/ 22 | bench_init(); 23 | 24 | /*adding benchmark type for testing*/ 25 | bench_add(RANDSET,0,RANGE,RANGE*2); 26 | 27 | bench_value *value; 28 | while((value=get_bench())){ 29 | if(value->type==FS_SET_T){ 30 | inf_make_req(value->type,value->key,NULL,value->length,value->mark); 31 | } 32 | else if(value->type==FS_GET_T){ 33 | inf_make_req(value->type,value->key,NULL,value->length,value->mark); 34 | } 35 | } 36 | 37 | inf_free(); 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /interface/mainfiles/default_main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "../../include/FS.h" 7 | #include "../../include/settings.h" 8 | #include "../../include/types.h" 9 | #include "../../bench/bench.h" 10 | #include "../interface.h" 11 | #include "../../include/utils/kvssd.h" 12 | 13 | int main(int argc,char* argv[]){ 14 | /* 15 | to use the custom benchmark setting the first parameter of 'inf_init' set false 16 | if not, set the parameter as true. 17 | the second parameter is not used in anycase. 18 | */ 19 | inf_init(0,0,0,NULL); 20 | 21 | /*initialize the cutom bench mark*/ 22 | bench_init(); 23 | 24 | /*adding benchmark type for testing*/ 25 | bench_add(RANDRW,0,RANGE,REQNUM*2); 26 | 27 | bench_value *value; 28 | while((value=get_bench())){ 29 | if(value->type==FS_SET_T){ 30 | inf_make_req(value->type,value->key,NULL,value->length,value->mark); 31 | } 32 | else if(value->type==FS_GET_T){ 33 | inf_make_req(value->type,value->key,NULL,value->length,value->mark); 34 | } 35 | } 36 | 37 | inf_free(); 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /interface/queue.h: -------------------------------------------------------------------------------- 1 | #ifndef __H_QUEUE_Q_ 2 | #define __H_QUEUE_Q_ 3 | #include "../include/settings.h" 4 | #include 5 | #define for_each_intqueue(q,a)\ 6 | for(a=q_dequeue_int(q);\ 7 | a!=-1;\ 8 | a=q_dequeue_int(q)) 9 | 10 | #define for_each_rqueue(q,a)\ 11 | for(a=q_dequeue(q);\ 12 | a!=NULL;\ 13 | a=q_dequeue(q)) 14 | 15 | #define for_each_rqueue_type(q,a,type)\ 16 | for(a=(type)q_dequeue(q);\ 17 | a!=NULL;\ 18 | a=(type)q_dequeue(q)) 19 | 20 | typedef struct node{ 21 | union{ 22 | void *req; 23 | int data; 24 | }d; 25 | struct node *prev; 26 | struct node *next; 27 | }node; 28 | 29 | typedef struct queue{ 30 | volatile int size; 31 | int m_size; 32 | pthread_mutex_t q_lock; 33 | bool firstFlag; 34 | node *head; 35 | node *tail; 36 | }queue; 37 | void q_init(queue**,int); 38 | bool q_enqueue(void *,queue*); 39 | bool q_enqueue_front(void *,queue*); 40 | void* q_pick(queue*); 41 | void q_lock(queue*); 42 | void q_unlock(queue*); 43 | void *q_dequeue(queue*); 44 | void q_free(queue*); 45 | 46 | bool q_enqueue_int(int, queue*); 47 | int q_dequeue_int(queue*); 48 | #endif 49 | -------------------------------------------------------------------------------- /interface/server.h: -------------------------------------------------------------------------------- 1 | #include "../include/settings.h" 2 | typedef struct network_data{ 3 | uint8_t type; 4 | uint64_t offset; 5 | uint64_t len; 6 | uint32_t seq; 7 | }net_data_t; 8 | -------------------------------------------------------------------------------- /interface/threading.h: -------------------------------------------------------------------------------- 1 | #ifndef __H_THREADING__ 2 | #define __H_THREADING__ 3 | #include"interface.h" 4 | #include"queue.h" 5 | #include"../include/data_struct/redblack.h" 6 | #include 7 | typedef struct master_processor master_processor; 8 | typedef struct processor{ 9 | pthread_t t_id; 10 | pthread_mutex_t flag; 11 | master_processor *master; 12 | queue *req_q; //for write req in priority 13 | queue *retry_q; 14 | #ifdef interface_pq 15 | queue *req_rq; //for read req 16 | Redblack qmanager; 17 | pthread_mutex_t qm_lock; 18 | #endif 19 | }processor; 20 | 21 | struct master_processor{ 22 | processor *processors; 23 | pthread_mutex_t flag; 24 | lower_info *li; 25 | algorithm *algo; 26 | blockmanager *bm; 27 | bool stopflag; 28 | }; 29 | #endif 30 | -------------------------------------------------------------------------------- /lower/bdbm_drv/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2015 CSAIL, MIT 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /lower/bdbm_drv/README.md: -------------------------------------------------------------------------------- 1 | A Device Driver for BlueDBM (BDBM_DRV) 2 | ==== 3 | 4 | BDBM_DRV is a device driver for BlueDBM hardware which is being developed by CSAIL MIT. 5 | In addition to its functionality as a device driver, BDBM_DRV supports various functions, 6 | including a flash translation layer, a block device emulation, an NAND flash emulation 7 | (with or without NAND timing modles), and so on. Even though its target hardware is BlueDBM, 8 | therefore, it can be used for various purposes to develop NAND flash software or firmware. 9 | 10 | 11 | Supported Platforms 12 | ------------------- 13 | 14 | The current version of BDBM_DRV supports Ubuntu Precise (12.04) with Linux kernel 3.13 (64-bit). 15 | Other Linux platforms will be supported soon. 16 | 17 | 18 | Installation 19 | ------------ 20 | 21 | 0. Checkout out the following from github: 22 | 23 | https://github.com/chamdoo/bdbm_drv 24 | 25 | 1. Compile BDBM_DRV: 26 | 27 | make 28 | 29 | 2. Install the kernel module and mount the EXT4 file system: 30 | 31 | cd run 32 | 33 | ./mount_ext4.sh 34 | 35 | 3. Run a test benchmark: 36 | 37 | ./run_bonnie++.sh 38 | 39 | Note that the Bonnie++ runs on top of a DRAM-based NAND Flash emulator. Thus, its runtime 40 | would be much shorter than running it on real devices (e.g., HDDs, SSDs, or BlueDBM Hardware). 41 | 42 | 4. Unmount the file system: 43 | 44 | ./umount.sh 45 | 46 | 47 | Note 48 | ------------ 49 | 50 | A more detailed description will be updated soon. 51 | 52 | -------------------------------------------------------------------------------- /lower/bdbm_drv/bdbm_inf.h: -------------------------------------------------------------------------------- 1 | #include "../../include/settings.h" 2 | #include "../../bench/bench.h" 3 | #include "../../bench/measurement.h" 4 | #include "../../include/container.h" 5 | #include "../../include/sem_lock.h" 6 | 7 | typedef struct merge_params{ 8 | fdriver_lock_t merge_lock; 9 | uint32_t *ktable_num; 10 | uint32_t invalidate_num; 11 | }merge_params; 12 | 13 | uint32_t memio_info_create(lower_info *li,blockmanager *bm); 14 | void *memio_info_destroy(lower_info *li); 15 | void *memio_info_push_data(uint32_t ppa, uint32_t size, value_set* value, bool async, algo_req *const req); 16 | void *memio_info_pull_data(uint32_t ppa, uint32_t size, value_set* value, bool async, algo_req *const req); 17 | void *memio_info_hw_read(uint32_t ppa, char* key, uint32_t key_len, value_set* value, bool async, algo_req *const req); 18 | void *memio_info_trim_block(uint32_t ppa, bool async); 19 | void *memio_info_trim_a_block(uint32_t ppa, bool async); 20 | void *memio_info_refresh(struct lower_info* li); 21 | void *memio_badblock_checker(uint32_t ppa, uint32_t size, void *(*process)(uint64_t,uint8_t)); 22 | void memio_flying_req_wait(); 23 | void memio_info_stop(); 24 | void memio_show_info_(); 25 | 26 | uint32_t memio_tag_num(); 27 | uint32_t memio_do_merge(uint32_t lp_num, ppa_t *lp_array, uint32_t hp_num,ppa_t *hp_array,ppa_t *tp_array, uint32_t* ktable_num, uint32_t *invliadate_num); 28 | char *memio_get_kt(); 29 | char *memio_get_inv(); 30 | -------------------------------------------------------------------------------- /lower/bdbm_drv/common/3rd/uilog.c: -------------------------------------------------------------------------------- 1 | #include "uilog.h" 2 | 3 | #if defined (USER_MODE) 4 | 5 | int ilog2 (int x) { 6 | int b1, b2, b3, b4, b5; 7 | 8 | /* pass the most significant 1 all the way down */ 9 | /* shamely steal from here: 10 | * * http://aggregate.org/MAGIC/#Most%20Significant%201%20Bit */ 11 | x = x | (x >> 1); 12 | x = x | (x >> 2); 13 | x = x | (x >> 4); 14 | x = x | (x >> 8); 15 | x = x | (x >> 16); 16 | 17 | /*count the 1s now */ 18 | 19 | /* b1 = 0x55555555 */ 20 | b1 = 0x55 | (0x55 << 8); 21 | b1 = b1 | (b1 << 16); 22 | 23 | /* b2 = 0x33333333 */ 24 | b2 = 0x33 | (0x33 << 8); 25 | b2 = b2 | (b2 << 16); 26 | 27 | /* b3 = 0x0f0f0f0f */ 28 | b3 = 0x0f | (0x0f << 8); 29 | b3 = b3 | (b3 << 16); 30 | 31 | /* b4 = 0x00ff00ff */ 32 | b4 = 0xff | (0xff << 16); 33 | 34 | /* b5 = 0x0000ffff */ 35 | b5 = 0xff | (0xff << 8); 36 | 37 | /*divide and conquer */ 38 | x = (x & b1) + ((x >> 1) & b1); 39 | x = (x & b2) + ((x >> 2) & b2); 40 | x = (x & b3) + ((x >> 4) & b3); 41 | x = (x & b4) + ((x >> 8) & b4); 42 | x = (x & b5) + ((x >> 16) & b5); 43 | 44 | x = x + ~0; 45 | return x; 46 | } 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /lower/bdbm_drv/common/3rd/uilog.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifndef __ILOG2_H 4 | #define __ILOG2_H 5 | 6 | /* Took from https://github.com/chuchao333/csapp-labs/blob/master/datalab-handout/bits.c */ 7 | 8 | int ilog2(int x); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /lower/bdbm_drv/common/bdbm_main.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | 26 | -------------------------------------------------------------------------------- /lower/bdbm_drv/common/utils/umemory.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #ifndef _BLUEDBM_MEMORY_H 26 | #define _BLUEDBM_MEMORY_H 27 | 28 | void* bdbm_malloc (size_t size); 29 | void* bdbm_malloc_phy (size_t size); 30 | void* bdbm_malloc_atomic (size_t size); 31 | void* bdbm_zmalloc (size_t size); 32 | void bdbm_free (void* addr); 33 | void bdbm_free_phy (void* addr); 34 | void bdbm_free_atomic (void* addr); 35 | void* bdbm_memcpy (void* dst, void* src, size_t size); 36 | void* bdbm_memset (void* addr, int c, size_t size); 37 | 38 | #endif /* _BLUEDBM_MEMORY_H */ 39 | -------------------------------------------------------------------------------- /lower/bdbm_drv/common/utils/upage.c: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #if defined (KERNEL_MODE) 26 | #error "upage.h is not intended for use with KERNEL_MODE" 27 | #endif 28 | 29 | #include 30 | #include 31 | 32 | unsigned long get_zeroed_page (int gfp_mask) { 33 | void* ptr_page = NULL; 34 | 35 | ptr_page = (void*)malloc (4096); 36 | if (ptr_page == NULL) { 37 | printf ("CRITICAL-ERROR: malloc failed at %d%s\n", __LINE__, __FILE__); 38 | } 39 | 40 | return (unsigned long)ptr_page; 41 | } 42 | 43 | void free_page (unsigned long addr) { 44 | void* ptr_page = (void*)addr; 45 | free (ptr_page); 46 | } 47 | -------------------------------------------------------------------------------- /lower/bdbm_drv/common/utils/upage.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #ifndef _UPAGE_H 26 | #define _UPAGE_H 27 | 28 | #if defined (KERNEL_MODE) 29 | #error "upage.h is not intended for use with KERNEL_MODE" 30 | #endif 31 | 32 | #define GFP_KERNEL 0 33 | 34 | unsigned long get_zeroed_page (int gfp_mask); 35 | void free_page (unsigned long addr); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /lower/bdbm_drv/devices/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all bluedbm ramdrive ramdrive_timing libdummy libramdrive #dragonfire 2 | all: all bluedbm ramdrive ramdrive_timing libdummy libramdrive #dragonfire 3 | 4 | bluedbm: 5 | cd bluedbm; $(MAKE) clean; $(MAKE) 6 | 7 | ramdrive: 8 | cd ramdrive; $(MAKE) clean; $(MAKE) 9 | 10 | ramdrive_timing: 11 | cd ramdrive_timing; $(MAKE) clean; $(MAKE) 12 | 13 | libdummy: 14 | cd libdummy; $(MAKE) clean; $(MAKE) 15 | 16 | libramdrive: 17 | cd libramdrive; $(MAKE) clean; $(MAKE) 18 | 19 | dragonfire: 20 | cd dragonfire; $(MAKE) clean; $(MAKE) 21 | 22 | .PHONY: clean 23 | clean: 24 | @cd bluedbm; $(MAKE) clean 25 | @cd ramdrive; $(MAKE) clean 26 | @cd ramdrive_timing; $(MAKE) clean 27 | @cd libdummy; $(MAKE) clean 28 | @cd libramdrive; $(MAKE) clean 29 | @cd ramdrive_dragonfire; $(MAKE) clean 30 | -------------------------------------------------------------------------------- /lower/bdbm_drv/devices/dragonfire/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for a RISA Device Driver 2 | # 3 | CC = gcc 4 | OUT = libdf.a 5 | INCLUDE = ../../include 6 | COMMON = ../../common 7 | DEV_COMMON = ../common 8 | 9 | INCLUDES := \ 10 | -I$(PWD)/$(INCLUDE) \ 11 | -I$(PWD)/$(COMMON)/utils \ 12 | -I$(PWD)/$(COMMON)/3rd \ 13 | -I$(PWD)/$(DEV_COMMON) 14 | 15 | CFLAGS := \ 16 | -g \ 17 | -static \ 18 | 19 | CFLAGS += \ 20 | -D HASH_BLOOM=20 \ 21 | -D CONFIG_ENABLE_MSG \ 22 | -D CONFIG_ENABLE_DEBUG \ 23 | -D CONFIG_DEVICE_TYPE_USER_DUMMY \ 24 | -D USE_PMU \ 25 | -D USE_KTIMER \ 26 | -D USER_MODE 27 | 28 | LIBSRC := \ 29 | dm_df.c \ 30 | $(DEV_COMMON)/dev_params.c \ 31 | 32 | LIBOBJ=$(LIBSRC:.c=.o) 33 | 34 | $(OUT): $(LIBOBJ) $(LIBSRC) 35 | $(AR) r $(OUT) $(LIBOBJ) 36 | 37 | .c.o: 38 | $(CC) $(INCLUDES) $(LIBS) $(CFLAGS) -c $< -o $@ 39 | 40 | clean: 41 | @$(RM) *.o core *~ libdf.a 42 | @cd $(DEV_COMMON); $(RM) *.o 43 | -------------------------------------------------------------------------------- /lower/bdbm_drv/devices/libdummy/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for a RISA Device Driver 2 | # 3 | CC = gcc 4 | OUT = libdummy.a 5 | INCLUDE = ../../include 6 | COMMON = ../../common 7 | DEV_COMMON = ../common 8 | 9 | INCLUDES := \ 10 | -I$(PWD)/$(INCLUDE) \ 11 | -I$(PWD)/$(COMMON)/utils \ 12 | -I$(PWD)/$(COMMON)/3rd \ 13 | -I$(PWD)/$(DEV_COMMON) 14 | 15 | CFLAGS := \ 16 | -g \ 17 | -static \ 18 | 19 | CFLAGS += \ 20 | -D HASH_BLOOM=20 \ 21 | -D CONFIG_ENABLE_MSG \ 22 | -D CONFIG_ENABLE_DEBUG \ 23 | -D CONFIG_DEVICE_TYPE_USER_DUMMY \ 24 | -D USE_PMU \ 25 | -D USE_KTIMER \ 26 | -D USER_MODE 27 | 28 | LIBSRC := \ 29 | dm_dummy.c \ 30 | $(DEV_COMMON)/dev_main.c \ 31 | $(DEV_COMMON)/dev_params.c \ 32 | 33 | LIBOBJ=$(LIBSRC:.c=.o) 34 | 35 | $(OUT): $(LIBOBJ) $(LIBSRC) 36 | $(AR) r $(OUT) $(LIBOBJ) 37 | 38 | .c.o: 39 | $(CC) $(INCLUDES) $(LIBS) $(CFLAGS) -c $< -o $@ 40 | 41 | clean: 42 | @$(RM) *.o core *~ libdummy.a 43 | @cd $(DEV_COMMON); $(RM) *.o 44 | -------------------------------------------------------------------------------- /lower/bdbm_drv/devices/libramdrive/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for a RISA Device Driver 2 | # 3 | CC = g++ 4 | #CC = arm-linux-gnueabihf-g++ 5 | OUT = libramdrive.a 6 | INCLUDE = ../../include 7 | COMMON = ../../common 8 | DM_COMMON = ../common 9 | 10 | INCLUDES := \ 11 | -I$(PWD)/$(INCLUDE) \ 12 | -I$(PWD)/$(COMMON)/utils \ 13 | -I$(PWD)/$(COMMON)/3rd \ 14 | -I$(PWD)/$(DM_COMMON) 15 | 16 | CFLAGS := \ 17 | -g \ 18 | -static \ 19 | 20 | CFLAGS += \ 21 | -D HASH_BLOOM=20 \ 22 | -D CONFIG_ENABLE_MSG \ 23 | -D CONFIG_ENABLE_DEBUG \ 24 | -D CONFIG_DEVICE_TYPE_USER_RAMDRIVE \ 25 | -D USE_PMU \ 26 | -D USE_KTIMER \ 27 | -D USER_MODE \ 28 | -D USE_NEW_RMW \ 29 | 30 | LIBSRC := \ 31 | $(DM_COMMON)/dev_main.c \ 32 | $(DM_COMMON)/dev_params.c \ 33 | ../ramdrive/dev_ramssd.c \ 34 | ../ramdrive/dm_ramdrive.c \ 35 | 36 | LIBOBJ=$(LIBSRC:.c=.o) 37 | 38 | $(OUT): $(LIBOBJ) 39 | $(AR) r $(OUT) $(LIBOBJ) 40 | 41 | .c.o: 42 | $(CC) $(INCLUDES) $(LIBS) $(CFLAGS) -c $< -o $@ 43 | 44 | clean: 45 | @$(RM) *.o core *~ libramdrive.a 46 | @cd $(DM_COMMON); $(RM) *.o 47 | @cd ../ramdrive; $(RM) *.o 48 | -------------------------------------------------------------------------------- /lower/bdbm_drv/devices/nohost/sw_poller.h: -------------------------------------------------------------------------------- 1 | #ifndef _SW_POLLER_HEADER_ 2 | #define _SW_POLLER_HEADER_ 3 | 4 | void sw_poller_init(); 5 | void sw_poller_enqueue(void *req); 6 | void* sw_poller_dequeue(); 7 | void sw_poller_destroy(); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /lower/bdbm_drv/devices/ramdrive/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for BlueDBM 2 | # 3 | 4 | INCLUDE = ../../include 5 | COMMON = ../../common 6 | DEV_COMMON = ../common 7 | 8 | EXTRA_CFLAGS := \ 9 | -I$(PWD)/$(INCLUDE) \ 10 | -I$(PWD)/$(COMMON)/utils \ 11 | -I$(PWD)/$(COMMON)/3rd \ 12 | -I$(PWD)/$(DEV_COMMON) \ 13 | 14 | EXTRA_CFLAGS += \ 15 | -D CONFIG_ENABLE_MSG \ 16 | -D CONFIG_ENABLE_DEBUG \ 17 | -D CONFIG_DEVICE_TYPE_RAMDRIVE \ 18 | -D KERNEL_MODE 19 | 20 | risa_dev_ramdrive-y := \ 21 | $(COMMON)/utils/ufile.o \ 22 | $(COMMON)/utils/utime.o \ 23 | $(COMMON)/utils/uthread.o \ 24 | $(COMMON)/utils/umemory.o \ 25 | $(DEV_COMMON)/dev_main.o \ 26 | $(DEV_COMMON)/dev_params.o \ 27 | $(DEV_COMMON)/dev_stub.o \ 28 | dev_ramssd.o \ 29 | dm_ramdrive.o \ 30 | 31 | obj-m := risa_dev_ramdrive.o 32 | 33 | export KROOT=/lib/modules/$(shell uname -r)/build 34 | 35 | .PHONY: default 36 | default: modules 37 | 38 | .PHONY: modules 39 | modules: 40 | @$(MAKE) -C $(KROOT) M=$(PWD) modules 41 | @chmod +x risa_dev_ramdrive.ko 42 | 43 | .PHONY: modules_check 44 | modules_check: 45 | @$(MAKE) -C $(KROOT) C=2 M=$(PWD) modules 46 | 47 | .PHONY: modules_install 48 | modules_install: 49 | @$(MAKE) -C $(KROOT) M=$(PWD) modules_install 50 | 51 | .PHONY: kernel_clean 52 | kernel_clean: 53 | @$(MAKE) -C $(KROOT) M=$(PWD) clean 54 | 55 | .PHONY: clean 56 | clean: kernel_clean 57 | @$(RM) -rf Module.markers modules.order 58 | @cd ../common; $(RM) *.o 59 | 60 | -------------------------------------------------------------------------------- /lower/bdbm_drv/devices/ramdrive_timing/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for BlueDBM 2 | # 3 | 4 | INCLUDE = ../../include 5 | COMMON = ../../common 6 | DEV_COMMON = ../common 7 | 8 | EXTRA_CFLAGS := \ 9 | -I$(PWD)/$(INCLUDE) \ 10 | -I$(PWD)/$(COMMON)/utils \ 11 | -I$(PWD)/$(COMMON)/3rd \ 12 | -I$(PWD)/$(DEV_COMMON) \ 13 | 14 | EXTRA_CFLAGS += \ 15 | -D CONFIG_ENABLE_MSG \ 16 | -D CONFIG_ENABLE_DEBUG \ 17 | -D CONFIG_DEVICE_TYPE_RAMDRIVE_TIMING \ 18 | -D KERNEL_MODE \ 19 | -D USE_NEW_RMW \ 20 | 21 | risa_dev_ramdrive_timing-y := \ 22 | $(COMMON)/utils/ufile.o \ 23 | $(COMMON)/utils/utime.o \ 24 | $(COMMON)/utils/uthread.o \ 25 | $(COMMON)/utils/umemory.o \ 26 | $(DEV_COMMON)/dev_main.o \ 27 | $(DEV_COMMON)/dev_params.o \ 28 | $(DEV_COMMON)/dev_stub.o \ 29 | ../ramdrive/dev_ramssd.o \ 30 | ../ramdrive/dm_ramdrive.o \ 31 | 32 | obj-m := risa_dev_ramdrive_timing.o 33 | 34 | export KROOT=/lib/modules/$(shell uname -r)/build 35 | 36 | .PHONY: default 37 | default: modules 38 | 39 | .PHONY: modules 40 | modules: 41 | @$(MAKE) -C $(KROOT) M=$(PWD) modules 42 | @chmod +x risa_dev_ramdrive_timing.ko 43 | 44 | .PHONY: modules_check 45 | modules_check: 46 | @$(MAKE) -C $(KROOT) C=2 M=$(PWD) modules 47 | 48 | .PHONY: modules_install 49 | modules_install: 50 | @$(MAKE) -C $(KROOT) M=$(PWD) modules_install 51 | 52 | .PHONY: kernel_clean 53 | kernel_clean: 54 | @$(MAKE) -C $(KROOT) M=$(PWD) clean 55 | 56 | .PHONY: clean 57 | clean: kernel_clean 58 | @$(RM) -rf Module.markers modules.order 59 | -------------------------------------------------------------------------------- /lower/bdbm_drv/devices/ramdrive_timing/mount.sh: -------------------------------------------------------------------------------- 1 | sudo insmod risa_dev_ramdrive_timing.ko 2 | -------------------------------------------------------------------------------- /lower/bdbm_drv/devices/ramdrive_timing/umount.sh: -------------------------------------------------------------------------------- 1 | sudo rmmod risa_dev_ramdrive_timing 2 | -------------------------------------------------------------------------------- /lower/bdbm_drv/examples/raw-flash/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for a RISA Device Driver 2 | # 3 | 4 | INCLUDE := ../../include 5 | COMMON := ../../common 6 | 7 | #KBUILD_EXTRA_SYMBOLS := $(PWD)/../../devices/ramdrive/Module.symvers 8 | KBUILD_EXTRA_SYMBOLS := $(PWD)/../../devices/bluedbm/Module.symvers 9 | 10 | EXTRA_CFLAGS := -I$(PWD)/../../include 11 | 12 | EXTRA_CFLAGS += \ 13 | -I$(PWD)/$(INCLUDE) \ 14 | -I$(PWD)/$(COMMON)/utils \ 15 | -I$(PWD)/$(COMMON)/3rd \ 16 | 17 | EXTRA_CFLAGS += -D KERNEL_MODE 18 | EXTRA_CFLAGS += -D CONFIG_ENABLE_MSG 19 | EXTRA_CFLAGS += -D CONFIG_ENABLE_DEBUG 20 | 21 | module_main-y := \ 22 | kmain.o \ 23 | raw-flash.o \ 24 | $(COMMON)/utils/utime.o \ 25 | $(COMMON)/utils/umemory.o 26 | 27 | obj-m := module_main.o 28 | 29 | ccflags-y := -I$(src) 30 | 31 | export KROOT=/lib/modules/$(shell uname -r)/build 32 | 33 | .PHONY: default 34 | default: modules 35 | 36 | .PHONY: modules 37 | modules: 38 | @$(MAKE) -C $(KROOT) M=$(PWD) modules 39 | @chmod +x module_main.ko 40 | 41 | .PHONY: modules_check 42 | modules_check: 43 | @$(MAKE) -C $(KROOT) C=2 M=$(PWD) modules 44 | 45 | .PHONY: modules_install 46 | modules_install: 47 | @$(MAKE) -C $(KROOT) M=$(PWD) modules_install 48 | 49 | .PHONY: kernel_clean 50 | kernel_clean: 51 | @$(MAKE) -C $(KROOT) M=$(PWD) clean 52 | 53 | .PHONY: clean 54 | clean: kernel_clean 55 | @rm -rf Module.markers modules.order 56 | @rm -rf *.o .*.cmd; rm -rf *.o .*.cmd; 57 | 58 | -------------------------------------------------------------------------------- /lower/bdbm_drv/examples/raw-flash/mount.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #sudo insmod risa_dev_ramdrive.ko 4 | sudo insmod risa_dev_ramdrive_timing.ko 5 | #sudo insmod risa_dev_bluedbm.ko 6 | sudo insmod module_main.ko 7 | -------------------------------------------------------------------------------- /lower/bdbm_drv/examples/raw-flash/umount.sh: -------------------------------------------------------------------------------- 1 | sudo rmmod module_main 2 | sudo rmmod risa_dev_ramdrive 3 | sudo rmmod risa_dev_ramdrive_timing 4 | sudo rmmod risa_dev_bluedbm 5 | -------------------------------------------------------------------------------- /lower/bdbm_drv/examples/stringsearch/Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | CXX = g++ 3 | CFLAGS = -Wall -g -O2 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 4 | CXXFLAGS = -Wall -g -O2 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 5 | LIBS = -lm -lblkid 6 | INCLUDES = 7 | OBJS = ss.o ss_impl_sw.o ss_impl_hw.o 8 | DEPS = ss_impl.h 9 | 10 | %.o: %.c %.cpp $(DEPS) 11 | $(CC) -c -o $@ $< $(CFLAGS) 12 | 13 | ss: $(OBJS) 14 | gcc -o $@ $^ $(CFLAGS) $(LIBS) 15 | 16 | clean: 17 | rm *.o core *~ ss_sw ss_hw 18 | -------------------------------------------------------------------------------- /lower/bdbm_drv/examples/stringsearch/count.sh: -------------------------------------------------------------------------------- 1 | grep -Ro $2 $2 | wc -w 2 | -------------------------------------------------------------------------------- /lower/bdbm_drv/examples/stringsearch/ss_impl.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #ifndef _SS_IMPL 26 | #define _SS_IMPL 27 | 28 | int sw_comp (const int fd_dev, const char* pattern, const int start_blk, const int blks); 29 | int hw_comp (const int fd_dev, const char* pattern, const int start_blk, const int blks); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /lower/bdbm_drv/examples/stringsearch/ss_impl_hw.c: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #include 26 | #include 27 | 28 | int hw_comp (const int fd_dev, const char* pattern, const int start_blk, const int blks) 29 | { 30 | return 0; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /lower/bdbm_drv/examples/stub_test/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for a RISA Device Driver 2 | # 3 | 4 | CC = gcc 5 | FTL := ../../ftl 6 | #CFLAGS := -Wall -g -O2 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 7 | CFLAGS := -Wall -g -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 8 | LIBS += -lm -lpthread -lrt 9 | 10 | INCLUDES = \ 11 | -I$(PWD)/../../include \ 12 | -I$(PWD)/../../include/utils \ 13 | -I$(PWD)/$(FTL) \ 14 | -I$(PWD)/../../devices/cpp \ 15 | 16 | CFLAGS += -D HASH_BLOOM=20 \ 17 | -D CONFIG_ENABLE_MSG \ 18 | -D CONFIG_ENABLE_DEBUG \ 19 | -D USE_PMU \ 20 | -D USE_KTIMER \ 21 | -D USER_MODE 22 | 23 | SRCS := \ 24 | main.c \ 25 | 26 | stub_test: $(SRCS) 27 | $(CC) $(INCLUDES) $(CFLAGS) -o $@ $(SRCS) $(LIBS) 28 | 29 | clean: 30 | @$(RM) *.o core *~ userapp 31 | #@cd ../../ftl; rm -rf *.o .*.cmd; rm -rf */*.o */.*.cmd; 32 | #@cd ../../include; rm -rf *.o .*.cmd; rm -rf */*.o */.*.cmd; 33 | #@cd ../../include/utils; rm -rf *.o .*.cmd; rm -rf */*.o */.*.cmd; 34 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all kernel user hybrid 2 | all: kernel user hybrid 3 | 4 | kernel: 5 | cd kernel; $(MAKE) 6 | 7 | user: 8 | cd user; $(MAKE) 9 | 10 | hybrid: 11 | cd hybrid; $(MAKE) 12 | 13 | .PHONY: clean clean-kernel clean-user clean-hybrid 14 | clean: clean-kernel clean-user clean-hybrid 15 | 16 | clean-kernel: 17 | @cd kernel; $(MAKE) clean 18 | 19 | clean-user: 20 | @cd user; $(MAKE) clean 21 | 22 | clean-hybrid: 23 | @cd hybrid; $(MAKE) clean 24 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/hybrid/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for a RISA Device Driver 2 | # 3 | 4 | FTL := ../../ftl 5 | INCLUDE := ../../include 6 | KERN := ../kernel 7 | COMMON := ../../common 8 | DM_COMMON := ../../devices/common 9 | 10 | EXTRA_CFLAGS := \ 11 | -I$(PWD)/$(INCLUDE) \ 12 | -I$(PWD)/$(COMMON)/utils \ 13 | -I$(PWD)/$(COMMON)/3rd \ 14 | -I$(PWD)/$(FTL) \ 15 | -I$(PWD)/$(KERN) \ 16 | -I$(PWD)/$(DM_COMMON) \ 17 | 18 | EXTRA_CFLAGS += -D HASH_BLOOM=20 # for HASH (8KB) 19 | EXTRA_CFLAGS += -D CONFIG_ENABLE_MSG 20 | EXTRA_CFLAGS += -D CONFIG_ENABLE_DEBUG 21 | EXTRA_CFLAGS += -D KERNEL_MODE 22 | EXTRA_CFLAGS += -D USE_PMU 23 | EXTRA_CFLAGS += -D USE_BLOCKIO_PROXY 24 | EXTRA_CFLAGS += -D USE_NEW_RMW 25 | 26 | bdbm_drv-y := \ 27 | kmain.o \ 28 | blkio_proxy.o \ 29 | blkio_proxy_reqs_pool.o \ 30 | $(FTL)/ftl_params.o \ 31 | $(FTL)/pmu.o \ 32 | $(DM_COMMON)/dev_params.o \ 33 | $(COMMON)/utils/utime.o \ 34 | $(COMMON)/utils/ufile.o \ 35 | $(COMMON)/utils/uthread.o \ 36 | $(COMMON)/utils/umemory.o \ 37 | $(COMMON)/bdbm_main.o \ 38 | $(KERN)/blkdev.o \ 39 | 40 | obj-m := bdbm_drv.o 41 | 42 | ccflags-y := -I$(src) 43 | 44 | export KROOT=/lib/modules/$(shell uname -r)/build 45 | 46 | .PHONY: default 47 | #default: kernel user 48 | default: user 49 | 50 | kernel: 51 | @$(MAKE) -f Makefile.kernel 52 | 53 | user: 54 | @cd ../../devices/libramdrive; $(MAKE) clean; $(MAKE) 55 | @$(MAKE) -f Makefile.user # build user 56 | 57 | .PHONY: clean 58 | clean: clean-kernel clean-user 59 | 60 | clean-kernel: 61 | @$(MAKE) -f Makefile.kernel clean 62 | 63 | clean-user: 64 | @$(MAKE) -f Makefile.user clean 65 | 66 | mount: 67 | sudo insmod bdbm_drv.ko 68 | 69 | umount: 70 | sudo rmmod bdbm_drv 71 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/hybrid/Makefile.kernel: -------------------------------------------------------------------------------- 1 | # Makefile for Kernel modules 2 | # 3 | 4 | obj-m := bdbm_drv.o 5 | 6 | export KROOT=/lib/modules/$(shell uname -r)/build 7 | 8 | default: 9 | @$(MAKE) -C $(KROOT) M=$(PWD) modules 10 | 11 | clean: 12 | @rm -rf *.o .*.cmd; rm -rf */*.o */.*.cmd Module.symvers modules.order bdbm_drv.ko bdbm_drv.mod.c 13 | @cd ../kernel; rm -rf *.o .*.cmd; rm -rf */*.o */.*.cmd Module.symvers modules.order bdbm_drv.ko bdbm_drv.mod.c 14 | @cd ../../ftl; rm -rf *.o .*.cmd; rm -rf */*.o */.*.cmd Module.symvers modules.order bdbm_drv.ko bdbm_drv.mod.c 15 | @cd ../../common; rm -rf *.o .*.cmd; rm -rf */*.o */.*.cmd Module.symvers modules.order bdbm_drv.ko bdbm_drv.mod.c 16 | @cd ../../devices/common; rm -rf *.o 17 | @cd ../../devices/ramdrive; rm -rf *.o 18 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/hybrid/blkio_stub.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #ifndef _BLUEDBM_BLOCKIO_PROXY_STUB_H 26 | #define _BLUEDBM_BLOCKIO_PROXY_STUB_H 27 | 28 | extern bdbm_host_inf_t _blkio_stub_inf; 29 | 30 | uint32_t blkio_stub_open (bdbm_drv_info_t* bdi); 31 | void blkio_stub_close (bdbm_drv_info_t* bdi); 32 | void blkio_stub_make_req (bdbm_drv_info_t* bdi, void* bio); 33 | void blkio_stub_end_req (bdbm_drv_info_t* bdi, bdbm_hlm_req_t* req); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/hybrid/empty_cache.sh: -------------------------------------------------------------------------------- 1 | sudo sh -c "echo 3 > /proc/sys/vm/drop_caches" 2 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/hybrid/mount_ext4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sudo mkdir -p /usr/share/bdbm_drv 4 | sudo touch /usr/share/bdbm_drv/ftl.dat 5 | sudo touch /usr/share/bdbm_drv/dm.dat 6 | 7 | sudo insmod bdbm_drv.ko 8 | sleep 1 9 | sudo ./libftl & 10 | sleep 4 11 | sudo mkfs -t ext4 -b 4096 /dev/blueDBM 12 | sudo mount \-t ext4 \-o discard /dev/blueDBM /media/blueDBM 13 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/hybrid/umount.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # umount the file-system 4 | sudo umount /media/blueDBM 5 | 6 | # kill libftl 7 | pid=`ps -ef | grep "sudo [.]/libftl" | awk '{print $2}'` 8 | if [ $pid > 0 ] 9 | then 10 | echo 'sudo kill -2 libftl ('$pid')' 11 | sudo kill -2 $pid 12 | sudo pkill -9 libftl 13 | sleep 1 14 | fi 15 | 16 | # rm the device 17 | sudo rmmod bdbm_drv 18 | sudo rmmod risa_dev_* 19 | sudo rmmod f2fs 20 | sudo rm 0 1 21 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/kernel/blkdev.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #ifndef _BLUEDBM_HOST_BLKDEV_H 26 | #define _BLUEDBM_HOST_BLKDEV_H 27 | 28 | uint32_t host_blkdev_register_device (bdbm_drv_info_t* bdi, make_request_fn* fn); 29 | void host_blkdev_unregister_block_device (bdbm_drv_info_t* bdi); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/kernel/blkio.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #ifndef _BLUEDBM_HOST_BLOCKIO_H 26 | #define _BLUEDBM_HOST_BLOCKIO_H 27 | 28 | extern bdbm_host_inf_t _blkio_inf; 29 | 30 | uint32_t blkio_open (bdbm_drv_info_t* bdi); 31 | void blkio_close (bdbm_drv_info_t* bdi); 32 | void blkio_make_req (bdbm_drv_info_t* bdi, void* req); 33 | void blkio_end_req (bdbm_drv_info_t* bdi, bdbm_hlm_req_t* req); 34 | 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/kernel/mount_ext4.sh: -------------------------------------------------------------------------------- 1 | sudo mkdir -p /usr/share/bdbm_drv 2 | sudo touch /usr/share/bdbm_drv/ftl.dat 3 | sudo touch /usr/share/bdbm_drv/dm.dat 4 | 5 | #sudo insmod risa_dev_ramdrive_timing.ko 6 | #sudo insmod risa_dev_ramdrive_intr.ko 7 | sudo insmod risa_dev_bluedbm.ko 8 | #sudo insmod bdbm_drv_page.ko 9 | sudo insmod bdbm_drv.ko 10 | sudo ./bdbm_format /dev/blueDBM 11 | sudo mkfs -t ext4 -b 4096 /dev/blueDBM 12 | sudo mount \-t ext4 \-o discard /dev/blueDBM /media/blueDBM 13 | #sudo mount \-t ext4 /dev/blueDBM /media/blueDBM 14 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/kernel/umount.sh: -------------------------------------------------------------------------------- 1 | sudo umount /media/blueDBM 2 | sudo rmmod bdbm_drv 3 | sudo rmmod risa_dev_* 4 | sudo rmmod f2fs 5 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zc706/README: -------------------------------------------------------------------------------- 1 | https://github.com/cambridgehackers/connectal.git 2 | 6ad07cf 3 | portal.h fixed in case defaultPoller == NULL 4 | 5 | only cpp & drivers directory needed 6 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zc706/cpp/XsimTop.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Connectal Project 2 | 3 | // Permission is hereby granted, free of charge, to any person 4 | // obtaining a copy of this software and associated documentation 5 | // files (the "Software"), to deal in the Software without 6 | // restriction, including without limitation the rights to use, copy, 7 | // modify, merge, publish, distribute, sublicense, and/or sell copies 8 | // of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | 11 | // The above copyright notice and this permission notice shall be 12 | // included in all copies or substantial portions of the Software. 13 | 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 18 | // BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #ifndef _XsimTop_h 24 | #define _XsimTop_h 25 | extern "C" void dpi_init(); 26 | extern "C" int dpi_cycle(); 27 | #endif 28 | 29 | 30 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zc706/cpp/portalPrintf.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2015 Quanta Research Cambridge, Inc. 2 | 3 | // Permission is hereby granted, free of charge, to any person 4 | // obtaining a copy of this software and associated documentation 5 | // files (the "Software"), to deal in the Software without 6 | // restriction, including without limitation the rights to use, copy, 7 | // modify, merge, publish, distribute, sublicense, and/or sell copies 8 | // of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | 11 | // The above copyright notice and this permission notice shall be 12 | // included in all copies or substantial portions of the Software. 13 | 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 18 | // BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #include 24 | #include 25 | 26 | #ifndef __KERNEL__ 27 | #ifdef __cplusplus 28 | extern "C" 29 | #endif 30 | int portal_printf(const char *format, ...) 31 | { 32 | va_list ap; 33 | va_start(ap, format); 34 | return vfprintf(stderr, format, ap); 35 | } 36 | #endif 37 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zc706/drivers/connectalsdhci/Makefile: -------------------------------------------------------------------------------- 1 | 2 | V?=0 3 | ifeq ($(V),0) 4 | Q=@ 5 | else 6 | Q= 7 | endif 8 | CONNECTALDIR ?= $(PWD)/../.. 9 | include $(CONNECTALDIR)/Makefile.version 10 | 11 | obj-m += connectalsdhci.o 12 | 13 | CROSS_COMPILE?=arm-linux-gnueabi- 14 | 15 | ccflags-y := -I$(src)/../portalmem -I$(src)/../../cpp -I$(PWD)/../.. -I$(src)/../../generated/cpp \ 16 | -DDRIVER_VERSION="KBUILD_STR($(VERSION))" 17 | 18 | connectalsdhci.ko: connectalsdhci.c 19 | @$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) xilinx_zynq_portal_defconfig 20 | @$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) oldconfig 21 | @$(MAKE) -j 8 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) zImage 22 | @$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) M=$(PWD) modules 23 | 24 | clean: 25 | @$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) M=$(PWD) clean 26 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zc706/drivers/connectalsdhci/connectalsdhci.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Based on sdhci-of-xilinx.c 3 | * 4 | * Copyright (c) 2015 Quanta Research Cambridge Inc. 5 | * 6 | * This file is licensed under the terms of the GNU General Public License 7 | * version 2. This program is licensed "as is" without any warranty of any 8 | * kind, whether express or implied. 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | // defined in drivers/mmc/host/sdhci-of-xilinxps.c 17 | extern int sdhci_zynq_remove(struct platform_device *pdev); 18 | extern int sdhci_zynq_probe(struct platform_device *pdev); 19 | extern int xsdhcips_suspend(struct device *dev); 20 | extern int xsdhcips_resume(struct device *dev); 21 | 22 | #ifdef CONFIG_PM_SLEEP 23 | static const struct dev_pm_ops xsdhcips_dev_pm_ops = { 24 | SET_SYSTEM_SLEEP_PM_OPS(xsdhcips_suspend, xsdhcips_resume) 25 | }; 26 | #define XSDHCIPS_PM (&xsdhcips_dev_pm_ops) 27 | #else /* ! CONFIG_PM_SLEEP */ 28 | #define XSDHCIPS_PM NULL 29 | #endif /* ! CONFIG_PM_SLEEP */ 30 | 31 | static const struct of_device_id sdhci_zynq_of_match[] = { 32 | { .compatible = "connectalsdhci" }, 33 | {}, 34 | }; 35 | MODULE_DEVICE_TABLE(of, sdhci_zynq_of_match); 36 | 37 | 38 | static struct platform_driver sdhci_zynq_driver = { 39 | .driver = { 40 | .name = "connectalsdhci-zynq", 41 | .owner = THIS_MODULE, 42 | .of_match_table = sdhci_zynq_of_match, 43 | .pm = XSDHCIPS_PM, 44 | }, 45 | .probe = local_zynq_probe, 46 | .remove = local_zynq_remove, 47 | }; 48 | 49 | module_platform_driver(sdhci_zynq_driver); 50 | MODULE_LICENSE("GPL v2"); 51 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zc706/drivers/connectalspi/Makefile: -------------------------------------------------------------------------------- 1 | 2 | V?=0 3 | ifeq ($(V),0) 4 | Q=@ 5 | else 6 | Q= 7 | endif 8 | CONNECTALDIR ?= $(PWD)/../.. 9 | include $(CONNECTALDIR)/Makefile.version 10 | 11 | obj-m += connectalspi.o 12 | 13 | CROSS_COMPILE?=arm-linux-gnueabi- 14 | 15 | ccflags-y := -I$(src)/../portalmem -I$(src)/../../cpp -I$(PWD)/../.. -I$(src)/../../generated/cpp \ 16 | -DDRIVER_VERSION="KBUILD_STR($(VERSION))" 17 | 18 | connectalspi.ko: connectalspi.c 19 | @$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) xilinx_zynq_portal_defconfig 20 | @$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) oldconfig 21 | @$(MAKE) -j 8 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) zImage 22 | @$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) M=$(PWD) modules 23 | 24 | clean: 25 | @$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) M=$(PWD) clean 26 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zc706/drivers/pcieportal/Makefile.dkms: -------------------------------------------------------------------------------- 1 | obj-m += pcieportal.o 2 | obj-m += portalmem.o 3 | EXTRA_CFLAGS = -DDRIVER_VERSION="KBUILD_STR(@VERSION@)" 4 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zc706/drivers/pcieportal/dkms.conf: -------------------------------------------------------------------------------- 1 | PACKAGE_NAME="@PKG_NAME@" 2 | PACKAGE_VERSION="@VERSION@" 3 | BUILT_MODULE_NAME[0]="pcieportal" 4 | DEST_MODULE_LOCATION[0]="/extra/fpga" 5 | BUILT_MODULE_NAME[1]="portalmem" 6 | DEST_MODULE_LOCATION[1]="/extra/fpga" 7 | AUTOINSTALL="yes" 8 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zc706/drivers/portalmem/Makefile: -------------------------------------------------------------------------------- 1 | 2 | V?=0 3 | ifeq ($(V),0) 4 | Q=@ 5 | else 6 | Q= 7 | endif 8 | DEFCONFIG ?= xilinx_zynq_portal_atheros_sdio_defconfig 9 | CONNECTALDIR ?= $(PWD)/../.. 10 | include $(CONNECTALDIR)/Makefile.version 11 | 12 | obj-m = portalmem.o 13 | 14 | ccflags-y := -I$(CONNECTALDIR) \ 15 | -DDRIVER_VERSION="KBUILD_STR($(VERSION))" 16 | 17 | ifeq ("$(KROOT)","") 18 | KVERSION=$(shell uname -r) 19 | export KROOT=/lib/modules/$(KVERSION)/build 20 | else 21 | CROSS_COMPILE?=arm-linux-gnueabi- 22 | PARAM=ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) 23 | endif 24 | 25 | .PHONY: portalmem_signature_file.h 26 | 27 | portalmem.ko: portalmem.h portalmem.c portalmem_signature_file.h 28 | ifneq ("$(PARAM)","") 29 | $(Q)$(MAKE) $(PARAM) -C $(KROOT) $(DEFCONFIG) 30 | $(Q)$(MAKE) $(PARAM) -C $(KROOT) -j8 zImage 31 | endif 32 | $(Q)$(MAKE) $(PARAM) -C $(KROOT) M=$(PWD) modules 33 | 34 | portalmem_signature_file.h: 35 | md5sum *.c | grep -v mod.c | sed -f ../../scripts/driver_signature.sed >portalmem_signature_file.h 36 | 37 | parallellaportalmem.ko: portalmem.h portalmem.c portalmem_signature_file.h 38 | $(Q)$(MAKE) $(PARAM) -C $(KROOT) parallella_defconfig 39 | $(Q)$(MAKE) $(PARAM) -C $(KROOT) -j8 LOADADDR=0x8000 uImage 40 | $(Q)$(MAKE) $(PARAM) -C $(KROOT) M=$(PWD) modules 41 | 42 | clean: 43 | $(Q)$(MAKE) $(PARAM) -C $(KROOT) M=$(PWD) clean 44 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zc706/drivers/zynqportal/Makefile: -------------------------------------------------------------------------------- 1 | 2 | V?=0 3 | ifeq ($(V),0) 4 | Q=@ 5 | else 6 | Q= 7 | endif 8 | CONNECTALDIR ?= $(PWD)/../.. 9 | include $(CONNECTALDIR)/Makefile.version 10 | 11 | obj-m += zynqportal.o 12 | 13 | DEFCONFIG?=xilinx_zynq_portal_atheros_sdio_defconfig 14 | CROSS_COMPILE?=arm-linux-gnueabi- 15 | KROOT?=$(CONNECTALDIR)/../linux-xlnx 16 | 17 | ccflags-y := -I$(src)/../portalmem -I$(src)/../../cpp -I$(PWD)/../.. -I$(src)/../../generated/cpp \ 18 | -DDRIVER_VERSION="KBUILD_STR($(VERSION))" 19 | 20 | zynqportal.ko: zynqportal.h zynqportal.c 21 | echo "$(VERSION)" 22 | $(Q)md5sum *.c ../../generated/cpp/*.c | grep -v mod.c | sed -f ../../scripts/driver_signature.sed >driver_signature_file.h 23 | $(Q)$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) $(DEFCONFIG) 24 | $(Q)$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) oldconfig 25 | $(Q)$(MAKE) -j 8 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) zImage 26 | $(Q)$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) M=$(PWD) modules 27 | 28 | parallellazynqportal.ko: zynqportal.h zynqportal.c 29 | echo "$(VERSION)" 30 | $(Q)md5sum *.c ../../generated/cpp/*.c | grep -v mod.c | sed -f ../../../scripts/driver_signature.sed >driver_signature_file.h 31 | $(Q)$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) parallella_defconfig 32 | $(Q)$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) oldconfig 33 | $(Q)$(MAKE) -j 8 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) LOADADDR=0x8000 uImage 34 | $(Q)$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) M=$(PWD) modules 35 | 36 | clean: 37 | $(Q)$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) M=$(PWD) clean 38 | rm -f driver_signature_file.h 39 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zc706/drivers/zynqportal/zynqportal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generic userspace hardware bridge 3 | * 4 | * Author: Jamey Hicks 5 | * 6 | * 2012 (c) Jamey Hicks 7 | * 8 | * This file is licensed under the terms of the GNU General Public License 9 | * version 2. This program is licensed "as is" without any warranty of any 10 | * kind, whether express or implied. 11 | */ 12 | 13 | #ifndef __PORTAL_H__ 14 | #define __PORTAL_H__ 15 | 16 | typedef struct { 17 | int clknum; 18 | long requested_rate; 19 | long actual_rate; 20 | } PortalClockRequest; 21 | 22 | typedef struct { 23 | int fd; 24 | int id; 25 | } PortalSendFd; 26 | 27 | typedef struct { 28 | uint32_t msb; 29 | uint32_t lsb; 30 | } PortalInterruptTime; 31 | 32 | typedef struct { 33 | int fd; 34 | void *base; 35 | size_t len; 36 | } PortalCacheRequest; 37 | 38 | typedef struct { 39 | int index; /* in param */ 40 | char md5[33]; /* out param -- asciz */ 41 | char filename[33]; /* out param -- asciz */ 42 | } PortalSignature; 43 | 44 | #define PORTAL_SET_FCLK_RATE _IOWR('B', 40, PortalClockRequest) 45 | #define PORTAL_SEND_FD _IOR('B', 42, PortalSendFd) 46 | #define PORTAL_DCACHE_FLUSH_INVAL _IOR('B', 43, PortalCacheRequest) 47 | #define PORTAL_DIRECTORY_READ _IOR('B', 44, unsigned long) 48 | #define PORTAL_INTERRUPT_TIME _IOR('B', 45, PortalInterruptTime) 49 | #define PORTAL_DCACHE_INVAL _IOR('B', 46, PortalCacheRequest) 50 | #define PORTAL_DEREFERENCE _IOR('B', 47, int) 51 | #define PORTAL_SIGNATURE _IOR('B', 47, PortalSignature) 52 | 53 | #endif /* __PORTAL_H__ */ 54 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zcu102/README: -------------------------------------------------------------------------------- 1 | https://github.com/cambridgehackers/connectal.git 2 | 49c4ebd 3 | portal.h fixed in case defaultPoller == NULL 4 | portal.c fixed (noprogram=1) 5 | 6 | only cpp & drivers directory needed 7 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zcu102/cpp/XsimTop.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Connectal Project 2 | 3 | // Permission is hereby granted, free of charge, to any person 4 | // obtaining a copy of this software and associated documentation 5 | // files (the "Software"), to deal in the Software without 6 | // restriction, including without limitation the rights to use, copy, 7 | // modify, merge, publish, distribute, sublicense, and/or sell copies 8 | // of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | 11 | // The above copyright notice and this permission notice shall be 12 | // included in all copies or substantial portions of the Software. 13 | 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 18 | // BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #ifndef _XsimTop_h 24 | #define _XsimTop_h 25 | extern "C" void dpi_init(); 26 | extern "C" int dpi_cycle(); 27 | #endif 28 | 29 | 30 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zcu102/cpp/portalPrintf.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2015 Quanta Research Cambridge, Inc. 2 | 3 | // Permission is hereby granted, free of charge, to any person 4 | // obtaining a copy of this software and associated documentation 5 | // files (the "Software"), to deal in the Software without 6 | // restriction, including without limitation the rights to use, copy, 7 | // modify, merge, publish, distribute, sublicense, and/or sell copies 8 | // of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | 11 | // The above copyright notice and this permission notice shall be 12 | // included in all copies or substantial portions of the Software. 13 | 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 18 | // BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 19 | // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | #include 24 | #include 25 | 26 | #ifndef __KERNEL__ 27 | #ifdef __cplusplus 28 | extern "C" 29 | #endif 30 | int portal_printf(const char *format, ...) 31 | { 32 | va_list ap; 33 | va_start(ap, format); 34 | return vfprintf(stderr, format, ap); 35 | } 36 | #endif 37 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zcu102/drivers/connectalsdhci/Makefile: -------------------------------------------------------------------------------- 1 | 2 | V?=0 3 | ifeq ($(V),0) 4 | Q=@ 5 | else 6 | Q= 7 | endif 8 | CONNECTALDIR ?= $(PWD)/../.. 9 | include $(CONNECTALDIR)/Makefile.version 10 | 11 | obj-m += connectalsdhci.o 12 | 13 | CROSS_COMPILE?=arm-linux-gnueabi- 14 | 15 | ccflags-y := -I$(src)/../portalmem -I$(src)/../../cpp -I$(PWD)/../.. -I$(src)/../../generated/cpp \ 16 | -DDRIVER_VERSION="KBUILD_STR($(VERSION))" 17 | 18 | connectalsdhci.ko: connectalsdhci.c 19 | @$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) xilinx_zynq_portal_defconfig 20 | @$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) oldconfig 21 | @$(MAKE) -j 8 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) zImage 22 | @$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) M=$(PWD) modules 23 | 24 | clean: 25 | @$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) M=$(PWD) clean 26 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zcu102/drivers/connectalsdhci/connectalsdhci.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Based on sdhci-of-xilinx.c 3 | * 4 | * Copyright (c) 2015 Quanta Research Cambridge Inc. 5 | * 6 | * This file is licensed under the terms of the GNU General Public License 7 | * version 2. This program is licensed "as is" without any warranty of any 8 | * kind, whether express or implied. 9 | */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | // defined in drivers/mmc/host/sdhci-of-xilinxps.c 17 | extern int sdhci_zynq_remove(struct platform_device *pdev); 18 | extern int sdhci_zynq_probe(struct platform_device *pdev); 19 | extern int xsdhcips_suspend(struct device *dev); 20 | extern int xsdhcips_resume(struct device *dev); 21 | 22 | #ifdef CONFIG_PM_SLEEP 23 | static const struct dev_pm_ops xsdhcips_dev_pm_ops = { 24 | SET_SYSTEM_SLEEP_PM_OPS(xsdhcips_suspend, xsdhcips_resume) 25 | }; 26 | #define XSDHCIPS_PM (&xsdhcips_dev_pm_ops) 27 | #else /* ! CONFIG_PM_SLEEP */ 28 | #define XSDHCIPS_PM NULL 29 | #endif /* ! CONFIG_PM_SLEEP */ 30 | 31 | static const struct of_device_id sdhci_zynq_of_match[] = { 32 | { .compatible = "connectalsdhci" }, 33 | {}, 34 | }; 35 | MODULE_DEVICE_TABLE(of, sdhci_zynq_of_match); 36 | 37 | 38 | static struct platform_driver sdhci_zynq_driver = { 39 | .driver = { 40 | .name = "connectalsdhci-zynq", 41 | .owner = THIS_MODULE, 42 | .of_match_table = sdhci_zynq_of_match, 43 | .pm = XSDHCIPS_PM, 44 | }, 45 | .probe = local_zynq_probe, 46 | .remove = local_zynq_remove, 47 | }; 48 | 49 | module_platform_driver(sdhci_zynq_driver); 50 | MODULE_LICENSE("GPL v2"); 51 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zcu102/drivers/connectalspi/Makefile: -------------------------------------------------------------------------------- 1 | 2 | V?=0 3 | ifeq ($(V),0) 4 | Q=@ 5 | else 6 | Q= 7 | endif 8 | CONNECTALDIR ?= $(PWD)/../.. 9 | include $(CONNECTALDIR)/Makefile.version 10 | 11 | obj-m += connectalspi.o 12 | 13 | CROSS_COMPILE?=arm-linux-gnueabi- 14 | 15 | ccflags-y := -I$(src)/../portalmem -I$(src)/../../cpp -I$(PWD)/../.. -I$(src)/../../generated/cpp \ 16 | -DDRIVER_VERSION="KBUILD_STR($(VERSION))" 17 | 18 | connectalspi.ko: connectalspi.c 19 | @$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) xilinx_zynq_portal_defconfig 20 | @$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) oldconfig 21 | @$(MAKE) -j 8 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) zImage 22 | @$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) M=$(PWD) modules 23 | 24 | clean: 25 | @$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) M=$(PWD) clean 26 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zcu102/drivers/pcieportal/Makefile.dkms: -------------------------------------------------------------------------------- 1 | obj-m += pcieportal.o 2 | obj-m += portalmem.o 3 | EXTRA_CFLAGS = -DDRIVER_VERSION="KBUILD_STR(@VERSION@)" 4 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zcu102/drivers/pcieportal/dkms.conf: -------------------------------------------------------------------------------- 1 | PACKAGE_NAME="@PKG_NAME@" 2 | PACKAGE_VERSION="@VERSION@" 3 | BUILT_MODULE_NAME[0]="pcieportal" 4 | DEST_MODULE_LOCATION[0]="/extra/fpga" 5 | BUILT_MODULE_NAME[1]="portalmem" 6 | DEST_MODULE_LOCATION[1]="/extra/fpga" 7 | AUTOINSTALL="yes" 8 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zcu102/drivers/portalmem/Makefile: -------------------------------------------------------------------------------- 1 | 2 | V?=0 3 | ifeq ($(V),0) 4 | Q=@ 5 | else 6 | Q= 7 | endif 8 | DEFCONFIG ?= xilinx_zynq_portal_atheros_sdio_defconfig 9 | CONNECTALDIR ?= $(PWD)/../.. 10 | include $(CONNECTALDIR)/Makefile.version 11 | 12 | obj-m = portalmem.o 13 | 14 | ccflags-y := -I$(CONNECTALDIR) \ 15 | -DDRIVER_VERSION="KBUILD_STR($(VERSION))" 16 | 17 | ifeq ("$(KROOT)","") 18 | KVERSION=$(shell uname -r) 19 | export KROOT=/lib/modules/$(KVERSION)/build 20 | else 21 | CROSS_COMPILE?=arm-linux-gnueabi- 22 | PARAM=ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) 23 | endif 24 | 25 | .PHONY: portalmem_signature_file.h 26 | 27 | portalmem.ko: portalmem.h portalmem.c portalmem_signature_file.h 28 | ifneq ("$(PARAM)","") 29 | $(Q)$(MAKE) $(PARAM) -C $(KROOT) $(DEFCONFIG) 30 | $(Q)$(MAKE) $(PARAM) -C $(KROOT) -j8 zImage 31 | endif 32 | $(Q)$(MAKE) $(PARAM) -C $(KROOT) M=$(PWD) modules 33 | 34 | portalmem_signature_file.h: 35 | md5sum *.c | grep -v mod.c | sed -f ../../scripts/driver_signature.sed >portalmem_signature_file.h 36 | 37 | parallellaportalmem.ko: portalmem.h portalmem.c portalmem_signature_file.h 38 | $(Q)$(MAKE) $(PARAM) -C $(KROOT) parallella_defconfig 39 | $(Q)$(MAKE) $(PARAM) -C $(KROOT) -j8 LOADADDR=0x8000 uImage 40 | $(Q)$(MAKE) $(PARAM) -C $(KROOT) M=$(PWD) modules 41 | 42 | clean: 43 | $(Q)$(MAKE) $(PARAM) -C $(KROOT) M=$(PWD) clean 44 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zcu102/drivers/zynqportal/Makefile: -------------------------------------------------------------------------------- 1 | 2 | V?=0 3 | ifeq ($(V),0) 4 | Q=@ 5 | else 6 | Q= 7 | endif 8 | CONNECTALDIR ?= $(PWD)/../.. 9 | include $(CONNECTALDIR)/Makefile.version 10 | 11 | obj-m += zynqportal.o 12 | 13 | DEFCONFIG?=xilinx_zynq_portal_atheros_sdio_defconfig 14 | CROSS_COMPILE?=arm-linux-gnueabi- 15 | KROOT?=$(CONNECTALDIR)/../linux-xlnx 16 | 17 | ccflags-y := -I$(src)/../portalmem -I$(src)/../../cpp -I$(PWD)/../.. -I$(src)/../../generated/cpp \ 18 | -DDRIVER_VERSION="KBUILD_STR($(VERSION))" 19 | 20 | zynqportal.ko: zynqportal.h zynqportal.c 21 | echo "$(VERSION)" 22 | $(Q)md5sum *.c ../../generated/cpp/*.c | grep -v mod.c | sed -f ../../scripts/driver_signature.sed >driver_signature_file.h 23 | $(Q)$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) $(DEFCONFIG) 24 | $(Q)$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) oldconfig 25 | $(Q)$(MAKE) -j 8 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) zImage 26 | $(Q)$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) M=$(PWD) modules 27 | 28 | parallellazynqportal.ko: zynqportal.h zynqportal.c 29 | echo "$(VERSION)" 30 | $(Q)md5sum *.c ../../generated/cpp/*.c | grep -v mod.c | sed -f ../../../scripts/driver_signature.sed >driver_signature_file.h 31 | $(Q)$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) parallella_defconfig 32 | $(Q)$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) oldconfig 33 | $(Q)$(MAKE) -j 8 ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) LOADADDR=0x8000 uImage 34 | $(Q)$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) M=$(PWD) modules 35 | 36 | clean: 37 | $(Q)$(MAKE) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) -C $(KROOT) M=$(PWD) clean 38 | rm -f driver_signature_file.h 39 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/connectal_zcu102/drivers/zynqportal/zynqportal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Generic userspace hardware bridge 3 | * 4 | * Author: Jamey Hicks 5 | * 6 | * 2012 (c) Jamey Hicks 7 | * 8 | * This file is licensed under the terms of the GNU General Public License 9 | * version 2. This program is licensed "as is" without any warranty of any 10 | * kind, whether express or implied. 11 | */ 12 | 13 | #ifndef __PORTAL_H__ 14 | #define __PORTAL_H__ 15 | 16 | typedef struct { 17 | int clknum; 18 | long requested_rate; 19 | long actual_rate; 20 | } PortalClockRequest; 21 | 22 | typedef struct { 23 | int fd; 24 | int id; 25 | } PortalSendFd; 26 | 27 | typedef struct { 28 | uint32_t msb; 29 | uint32_t lsb; 30 | } PortalInterruptTime; 31 | 32 | typedef struct { 33 | int fd; 34 | void *base; 35 | size_t len; 36 | } PortalCacheRequest; 37 | 38 | typedef struct { 39 | int index; /* in param */ 40 | char md5[33]; /* out param -- asciz */ 41 | char filename[33]; /* out param -- asciz */ 42 | } PortalSignature; 43 | 44 | #define PORTAL_SET_FCLK_RATE _IOWR('B', 40, PortalClockRequest) 45 | #define PORTAL_SEND_FD _IOR('B', 42, PortalSendFd) 46 | #define PORTAL_DCACHE_FLUSH_INVAL _IOR('B', 43, PortalCacheRequest) 47 | #define PORTAL_DIRECTORY_READ _IOR('B', 44, unsigned long) 48 | #define PORTAL_INTERRUPT_TIME _IOR('B', 45, PortalInterruptTime) 49 | #define PORTAL_DCACHE_INVAL _IOR('B', 46, PortalCacheRequest) 50 | #define PORTAL_DEREFERENCE _IOR('B', 47, int) 51 | #define PORTAL_SIGNATURE _IOR('B', 47, PortalSignature) 52 | 53 | #endif /* __PORTAL_H__ */ 54 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/libmemio_org.h: -------------------------------------------------------------------------------- 1 | #include "bdbm_drv.h" 2 | #include "umemory.h" /* bdbm_malloc */ 3 | #include "uthread.h" /* bdbm_thread_nanosleep */ 4 | #include "devices.h" /* bdbm_dm_get_inf */ 5 | #include "debug.h" /* bdbm_msg */ 6 | #include 7 | 8 | typedef struct memio { 9 | bdbm_drv_info_t bdi; 10 | bdbm_llm_req_t* rr; 11 | int nr_punits; 12 | int nr_tags; 13 | uint64_t io_size; /* bytes */ 14 | uint64_t trim_size; 15 | uint64_t trim_lbas; 16 | std::queue* tagQ; 17 | bdbm_mutex_t tagQMutex; 18 | bdbm_cond_t tagQCond; 19 | } memio_t; 20 | 21 | memio_t* memio_open (); 22 | void memio_wait (memio_t* mio); 23 | int memio_read (memio_t* mio, uint64_t lba, uint64_t len, uint8_t* data); 24 | int memio_write (memio_t* mio, uint64_t lba, uint64_t len, uint8_t* data); 25 | int memio_trim (memio_t* mio, uint64_t lba, uint64_t len); 26 | void memio_close (memio_t* mio); 27 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zc706_ubuntu/README: -------------------------------------------------------------------------------- 1 | git:cwchung90/bluedmb 91a34d3 2 | amf_8192_bram -> zc706_ubuntu 3 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zc706_ubuntu/jni/Android.mk: -------------------------------------------------------------------------------- 1 | 2 | include $(CLEAR_VARS) 3 | DTOP?=/home/cwchung/workspace/nohost/projects/amf_8192_bram/zc706_ubuntu 4 | CONNECTALDIR?=/home/cwchung/workspace/nohost/tools/connectal 5 | LOCAL_ARM_MODE := arm 6 | include $(CONNECTALDIR)/scripts/Makefile.connectal.application 7 | LOCAL_SRC_FILES := /home/cwchung/workspace/nohost/projects/amf_8192_bram/main_example.cpp /home/cwchung/workspace/nohost/tools/connectal/cpp/dmaManager.c /home/cwchung/workspace/nohost/tools/connectal/cpp/platformMemory.cpp $(PORTAL_SRC_FILES) 8 | 9 | LOCAL_PATH := 10 | LOCAL_MODULE := android.exe 11 | LOCAL_MODULE_TAGS := optional 12 | LOCAL_LDLIBS := -llog 13 | LOCAL_CPPFLAGS := "-march=armv7-a" 14 | LOCAL_CFLAGS := -I$(DTOP)/jni -I$(CONNECTALDIR) -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR)/lib/cpp -Werror 15 | LOCAL_CXXFLAGS := -I$(DTOP)/jni -I$(CONNECTALDIR) -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR)/lib/cpp -Werror 16 | LOCAL_CFLAGS2 := $(cdefines2)s 17 | 18 | include $(BUILD_EXECUTABLE) 19 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zc706_ubuntu/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_PLATFORM := android-16 2 | NDK_TOOLCHAIN_VERSION := 4.9 3 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zc706_ubuntu/jni/ConnectalProjectConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef _ConnectalProjectConfig_h 2 | #define _ConnectalProjectConfig_h 3 | 4 | #define DataBusWidth 64 5 | #define NumReadClients 9 6 | #define NumWriteClients 9 7 | #define IMPORT_HOST_CLOCKS "" 8 | #define ConnectalVersion "16.05.2" 9 | #define NumberOfMasters 4 10 | #define PinType "Top_Pins" 11 | #define PinTypeInclude "Top_Pins" 12 | #define NumberOfUserTiles 1 13 | #define SlaveDataBusWidth 32 14 | #define SlaveControlAddrWidth 5 15 | #define BurstLenSize 10 16 | #define project_dir "$(DTOP)" 17 | #define MainClockPeriod 6 18 | #define DerivedClockPeriod 5.000000 19 | #define XILINX 1 20 | #define ZYNQ "" 21 | #define ZynqHostInterface "" 22 | #define PhysAddrWidth 32 23 | #define NUMBER_OF_LEDS 4 24 | #define PcieLanes 4 25 | #define CONNECTAL_BITS_DEPENDENCES "hw/mkTop.bit" 26 | #define CONNECTAL_RUN_SCRIPT "$(CONNECTALDIR)/scripts/run.ubuntu" 27 | #define CONNECTAL_EXENAME "ubuntu.exe" 28 | #define CONNECTAL_EXENAME2 "ubuntu.exe2" 29 | #define BOARD_zc706_ubuntu "" 30 | 31 | #endif // _ConnectalProjectConfig_h 32 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zc706_ubuntu/jni/Makefile.generated_files: -------------------------------------------------------------------------------- 1 | 2 | GENERATED_CPP=GeneratedCppCallbacks.cpp MemServerRequest.c MemServerRequestJson.cpp MMURequest.c MMURequestJson.cpp MemServerIndication.c MemServerIndicationJson.cpp MMUIndication.c MMUIndicationJson.cpp FlashRequest.c FlashRequestJson.cpp FlashIndication.c FlashIndicationJson.cpp 3 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zc706_ubuntu/jni/Ubuntu.mk: -------------------------------------------------------------------------------- 1 | 2 | CONNECTALDIR?=/home/cwchung/workspace/nohost/tools/connectal 3 | DTOP?=/home/cwchung/workspace/nohost/projects/amf_8192_bram/zc706_ubuntu 4 | 5 | TOOLCHAIN?=arm-linux-gnueabihf- 6 | ifneq ($(TOOLCHAIN),) 7 | CC=$(TOOLCHAIN)gcc 8 | CXX=$(TOOLCHAIN)g++ 9 | endif 10 | CFLAGS_COMMON = -O -g -I$(DTOP)/jni -I$(CONNECTALDIR) -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR)/lib/cpp -Wall -Werror -I$(DTOP)/jni -I$(CONNECTALDIR) -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR)/lib/cpp 11 | CFLAGS = $(CFLAGS_COMMON) 12 | CFLAGS2 = 13 | 14 | include $(DTOP)/Makefile.autotop 15 | include $(CONNECTALDIR)/scripts/Makefile.connectal.application 16 | SOURCES = /home/cwchung/workspace/nohost/projects/amf_8192_bram/main_example.cpp /home/cwchung/workspace/nohost/tools/connectal/cpp/dmaManager.c /home/cwchung/workspace/nohost/tools/connectal/cpp/platformMemory.cpp $(PORTAL_SRC_FILES) 17 | SOURCES2 = $(PORTAL_SRC_FILES) 18 | XSOURCES = $(CONNECTALDIR)/cpp/XsimTop.cpp $(PORTAL_SRC_FILES) 19 | LDLIBS := -lpthread 20 | 21 | ubuntu.exe: $(SOURCES) 22 | $(Q)$(CXX) $(CFLAGS) -o ubuntu.exe $(SOURCES) $(LDLIBS) 23 | $(Q)[ ! -f ../bin/mkTop.bin.gz ] || $(TOOLCHAIN)objcopy --add-section fpgadata=../bin/mkTop.bin.gz ubuntu.exe 24 | 25 | connectal.so: $(SOURCES) 26 | $(Q)$(CXX) -shared -fpic $(CFLAGS) -o connectal.so $(SOURCES) $(LDLIBS) 27 | 28 | ubuntu.exe2: $(SOURCES2) 29 | $(Q)$(CXX) $(CFLAGS) $(CFLAGS2) -o ubuntu.exe2 $(SOURCES2) $(LDLIBS) 30 | 31 | xsim: $(XSOURCES) 32 | $(CXX) $(CFLAGS) -o xsim $(XSOURCES) 33 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zc706_ubuntu/jni/driver_signature_file.h: -------------------------------------------------------------------------------- 1 | {"21c2774a18d73b43c056d6be19659da5", "connectalsdhci.c"}, 2 | {"a4b8745fca79964a8b75d6cf068c78de", "connectalspi.c"}, 3 | {"1fd85ba2e41ceed310cebc3da4532aa5", "pcieportal.c"}, 4 | {"154481f2a0b17c40a36aaf79335cf360", "portalmem.c"}, 5 | {"013f7649aea694e2e88af14e9fdedd6a", "zynqportal.c"}, 6 | {"bd2e0500b4b4ff6fe2eaf90482e237c9", "MMURequest.c"}, 7 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zc706_ubuntu/jni/topEnum.h: -------------------------------------------------------------------------------- 1 | 2 | typedef enum {NoInterface, PlatformIfcNames_MemServerRequestS2H=1, 3 | PlatformIfcNames_MMURequestS2H=2, 4 | PlatformIfcNames_MemServerIndicationH2S=3, 5 | PlatformIfcNames_MMUIndicationH2S=4, 6 | IfcNames_FlashIndicationH2S=5, 7 | IfcNames_FlashRequestS2H=6} IfcNames; 8 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni.v3.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgist-datalab/FlashFTLDriver/107d83b71ea29e25dbb57ab7b8ecc56f29589032/lower/bdbm_drv/frontend/libmemio/zcu102/jni.v3.2.tar.gz -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni.v4.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgist-datalab/FlashFTLDriver/107d83b71ea29e25dbb57ab7b8ecc56f29589032/lower/bdbm_drv/frontend/libmemio/zcu102/jni.v4.0.tar.gz -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni/Android.mk: -------------------------------------------------------------------------------- 1 | 2 | include $(CLEAR_VARS) 3 | DTOP?=/home/cwchung/workspace/lightstore-test/projects/flash_kt/zcu102 4 | CONNECTALDIR?=/home/cwchung/workspace/lightstore-test/tools/connectal 5 | LOCAL_ARM_MODE := arm 6 | include $(CONNECTALDIR)/scripts/Makefile.connectal.application 7 | LOCAL_SRC_FILES := /home/cwchung/workspace/lightstore-test/projects/flash_kt/main.cpp /home/cwchung/workspace/lightstore-test/tools/connectal/cpp/dmaManager.c /home/cwchung/workspace/lightstore-test/tools/connectal/cpp/platformMemory.cpp $(PORTAL_SRC_FILES) 8 | 9 | LOCAL_PATH := 10 | LOCAL_MODULE := android.exe 11 | LOCAL_MODULE_TAGS := optional 12 | LOCAL_LDLIBS := -llog 13 | LOCAL_CPPFLAGS := "-march=armv7-a" 14 | LOCAL_CFLAGS := -I$(DTOP)/jni -I$(CONNECTALDIR) -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR)/lib/cpp -Werror 15 | LOCAL_CXXFLAGS := -I$(DTOP)/jni -I$(CONNECTALDIR) -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR)/lib/cpp -Werror 16 | LOCAL_CFLAGS2 := $(cdefines2)s 17 | 18 | include $(BUILD_EXECUTABLE) 19 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_PLATFORM := android-16 2 | NDK_TOOLCHAIN_VERSION := 4.9 3 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni/ConnectalProjectConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef _ConnectalProjectConfig_h 2 | #define _ConnectalProjectConfig_h 3 | 4 | #define DataBusWidth 128 5 | #define NumReadClients 3 6 | #define NumWriteClients 8 7 | #define NumReFlash 2 8 | #define NumWeFlash 4 9 | #define IMPORT_HOST_CLOCKS "" 10 | #define ZCU_AXI_SLAVE_START 2 11 | #define DEFAULT_NOPROGRAM 1 12 | #define MMU_INDEX_WIDTH 13 13 | #define ConnectalVersion "18.01.4" 14 | #define NumberOfMasters 2 15 | #define PinType "Top_Pins" 16 | #define PinTypeInclude "Top_Pins" 17 | #define NumberOfUserTiles 1 18 | #define SlaveDataBusWidth 32 19 | #define SlaveControlAddrWidth 5 20 | #define BurstLenSize 10 21 | #define project_dir "$(DTOP)" 22 | #define MainClockPeriod 5.000000 23 | #define DerivedClockPeriod 9.090000 24 | #define XILINX 1 25 | #define ZYNQ "" 26 | #define ZynqUltrascale "" 27 | #define ZynqHostInterface "" 28 | #define PhysAddrWidth 40 29 | #define CONNECTAL_BITS_DEPENDENCES "hw/mkTop.bit" 30 | #define CONNECTAL_RUN_SCRIPT "$(CONNECTALDIR)/scripts/run.ubuntu" 31 | #define CONNECTAL_EXENAME "ubuntu.exe" 32 | #define CONNECTAL_EXENAME2 "ubuntu.exe2" 33 | #define BOARD_zcu102 "" 34 | 35 | #endif // _ConnectalProjectConfig_h 36 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni/Makefile.generated_files: -------------------------------------------------------------------------------- 1 | 2 | GENERATED_CPP=GeneratedCppCallbacks.cpp MemServerRequest.c MemServerRequestJson.cpp MMURequest.c MMURequestJson.cpp MemServerIndication.c MemServerIndicationJson.cpp MMUIndication.c MMUIndicationJson.cpp FlashRequest.c FlashRequestJson.cpp FlashIndication.c FlashIndicationJson.cpp 3 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni/Ubuntu.mk: -------------------------------------------------------------------------------- 1 | 2 | CONNECTALDIR?=/home/cwchung/workspace/lightstore-test/tools/connectal 3 | DTOP?=/home/cwchung/workspace/lightstore-test/projects/flash_kt/zcu102 4 | 5 | TOOLCHAIN?=aarch64-linux-gnu- 6 | ifneq ($(TOOLCHAIN),) 7 | CC=$(TOOLCHAIN)gcc 8 | CXX=$(TOOLCHAIN)g++ 9 | endif 10 | CFLAGS_COMMON = -O -g -I$(DTOP)/jni -I$(CONNECTALDIR) -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR)/lib/cpp -Wall -Werror -I$(DTOP)/jni -I$(CONNECTALDIR) -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR)/lib/cpp 11 | CFLAGS = $(CFLAGS_COMMON) 12 | CFLAGS2 = 13 | 14 | include $(DTOP)/Makefile.autotop 15 | include $(CONNECTALDIR)/scripts/Makefile.connectal.application 16 | SOURCES = /home/cwchung/workspace/lightstore-test/projects/flash_kt/main.cpp /home/cwchung/workspace/lightstore-test/tools/connectal/cpp/dmaManager.c /home/cwchung/workspace/lightstore-test/tools/connectal/cpp/platformMemory.cpp $(PORTAL_SRC_FILES) 17 | SOURCES2 = $(PORTAL_SRC_FILES) 18 | XSOURCES = $(CONNECTALDIR)/cpp/XsimTop.cpp $(PORTAL_SRC_FILES) 19 | LDLIBS := -lpthread 20 | 21 | ubuntu.exe: $(SOURCES) 22 | $(Q)$(CXX) $(CFLAGS) -o ubuntu.exe $(SOURCES) $(LDLIBS) 23 | $(Q)[ ! -f ../bin/mkTop.bin.gz ] || $(TOOLCHAIN)objcopy --add-section fpgadata=../bin/mkTop.bin.gz ubuntu.exe 24 | 25 | connectal.so: $(SOURCES) 26 | $(Q)$(CXX) -shared -fpic $(CFLAGS) -o connectal.so $(SOURCES) $(LDLIBS) 27 | 28 | ubuntu.exe2: $(SOURCES2) 29 | $(Q)$(CXX) $(CFLAGS) $(CFLAGS2) -o ubuntu.exe2 $(SOURCES2) $(LDLIBS) 30 | 31 | xsim: $(XSOURCES) 32 | $(CXX) $(CFLAGS) -o xsim $(XSOURCES) 33 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni/driver_signature_file.h: -------------------------------------------------------------------------------- 1 | {"21c2774a18d73b43c056d6be19659da5", "connectalsdhci.c"}, 2 | {"a4b8745fca79964a8b75d6cf068c78de", "connectalspi.c"}, 3 | {"47e961a4b445762e6b6024086a3ff16b", "pcieportal.c"}, 4 | {"d96a232ecd122ef75110250e2d1d1ab4", "portalmem.c"}, 5 | {"e059016ac411386d6e2597d43bc49e15", "zynqportal.c"}, 6 | {"bd2e0500b4b4ff6fe2eaf90482e237c9", "MMURequest.c"}, 7 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni/topEnum.h: -------------------------------------------------------------------------------- 1 | 2 | typedef enum {NoInterface, PlatformIfcNames_MemServerRequestS2H=1, 3 | PlatformIfcNames_MMURequestS2H=2, 4 | PlatformIfcNames_MemServerIndicationH2S=3, 5 | PlatformIfcNames_MMUIndicationH2S=4, 6 | IfcNames_FlashIndicationH2S=5, 7 | IfcNames_FlashRequestS2H=6} IfcNames; 8 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni/ubuntu.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgist-datalab/FlashFTLDriver/107d83b71ea29e25dbb57ab7b8ecc56f29589032/lower/bdbm_drv/frontend/libmemio/zcu102/jni/ubuntu.exe -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni_3.2/Android.mk: -------------------------------------------------------------------------------- 1 | 2 | include $(CLEAR_VARS) 3 | DTOP?=/home/cwchung/workspace/lightstore-test/projects/flash_kt/zcu102 4 | CONNECTALDIR?=/home/cwchung/workspace/lightstore-test/tools/connectal 5 | LOCAL_ARM_MODE := arm 6 | include $(CONNECTALDIR)/scripts/Makefile.connectal.application 7 | LOCAL_SRC_FILES := /home/cwchung/workspace/lightstore-test/projects/flash_kt/main.cpp /home/cwchung/workspace/lightstore-test/tools/connectal/cpp/dmaManager.c /home/cwchung/workspace/lightstore-test/tools/connectal/cpp/platformMemory.cpp $(PORTAL_SRC_FILES) 8 | 9 | LOCAL_PATH := 10 | LOCAL_MODULE := android.exe 11 | LOCAL_MODULE_TAGS := optional 12 | LOCAL_LDLIBS := -llog 13 | LOCAL_CPPFLAGS := "-march=armv7-a" 14 | LOCAL_CFLAGS := -I$(DTOP)/jni -I$(CONNECTALDIR) -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR)/lib/cpp -Werror 15 | LOCAL_CXXFLAGS := -I$(DTOP)/jni -I$(CONNECTALDIR) -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR)/lib/cpp -Werror 16 | LOCAL_CFLAGS2 := $(cdefines2)s 17 | 18 | include $(BUILD_EXECUTABLE) 19 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni_3.2/Application.mk: -------------------------------------------------------------------------------- 1 | APP_PLATFORM := android-16 2 | NDK_TOOLCHAIN_VERSION := 4.9 3 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni_3.2/ConnectalProjectConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef _ConnectalProjectConfig_h 2 | #define _ConnectalProjectConfig_h 3 | 4 | #define DataBusWidth 128 5 | #define NumReadClients 3 6 | #define NumWriteClients 8 7 | #define NumReFlash 2 8 | #define NumWeFlash 4 9 | #define IMPORT_HOST_CLOCKS "" 10 | #define ZCU_AXI_SLAVE_START 2 11 | #define DEFAULT_NOPROGRAM 1 12 | #define MMU_INDEX_WIDTH 13 13 | #define ConnectalVersion "18.01.4" 14 | #define NumberOfMasters 2 15 | #define PinType "Top_Pins" 16 | #define PinTypeInclude "Top_Pins" 17 | #define NumberOfUserTiles 1 18 | #define SlaveDataBusWidth 32 19 | #define SlaveControlAddrWidth 5 20 | #define BurstLenSize 10 21 | #define project_dir "$(DTOP)" 22 | #define MainClockPeriod 5.000000 23 | #define DerivedClockPeriod 9.090000 24 | #define XILINX 1 25 | #define ZYNQ "" 26 | #define ZynqUltrascale "" 27 | #define ZynqHostInterface "" 28 | #define PhysAddrWidth 40 29 | #define CONNECTAL_BITS_DEPENDENCES "hw/mkTop.bit" 30 | #define CONNECTAL_RUN_SCRIPT "$(CONNECTALDIR)/scripts/run.ubuntu" 31 | #define CONNECTAL_EXENAME "ubuntu.exe" 32 | #define CONNECTAL_EXENAME2 "ubuntu.exe2" 33 | #define BOARD_zcu102 "" 34 | 35 | #endif // _ConnectalProjectConfig_h 36 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni_3.2/Makefile.generated_files: -------------------------------------------------------------------------------- 1 | 2 | GENERATED_CPP=GeneratedCppCallbacks.cpp MemServerRequest.c MemServerRequestJson.cpp MMURequest.c MMURequestJson.cpp MemServerIndication.c MemServerIndicationJson.cpp MMUIndication.c MMUIndicationJson.cpp FlashRequest.c FlashRequestJson.cpp FlashIndication.c FlashIndicationJson.cpp 3 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni_3.2/Ubuntu.mk: -------------------------------------------------------------------------------- 1 | 2 | CONNECTALDIR?=/home/cwchung/workspace/lightstore-test/tools/connectal 3 | DTOP?=/home/cwchung/workspace/lightstore-test/projects/flash_kt/zcu102 4 | 5 | TOOLCHAIN?=aarch64-linux-gnu- 6 | ifneq ($(TOOLCHAIN),) 7 | CC=$(TOOLCHAIN)gcc 8 | CXX=$(TOOLCHAIN)g++ 9 | endif 10 | CFLAGS_COMMON = -O -g -I$(DTOP)/jni -I$(CONNECTALDIR) -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR)/lib/cpp -Wall -Werror -I$(DTOP)/jni -I$(CONNECTALDIR) -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR)/lib/cpp 11 | CFLAGS = $(CFLAGS_COMMON) 12 | CFLAGS2 = 13 | 14 | include $(DTOP)/Makefile.autotop 15 | include $(CONNECTALDIR)/scripts/Makefile.connectal.application 16 | SOURCES = /home/cwchung/workspace/lightstore-test/projects/flash_kt/main.cpp /home/cwchung/workspace/lightstore-test/tools/connectal/cpp/dmaManager.c /home/cwchung/workspace/lightstore-test/tools/connectal/cpp/platformMemory.cpp $(PORTAL_SRC_FILES) 17 | SOURCES2 = $(PORTAL_SRC_FILES) 18 | XSOURCES = $(CONNECTALDIR)/cpp/XsimTop.cpp $(PORTAL_SRC_FILES) 19 | LDLIBS := -lpthread 20 | 21 | ubuntu.exe: $(SOURCES) 22 | $(Q)$(CXX) $(CFLAGS) -o ubuntu.exe $(SOURCES) $(LDLIBS) 23 | $(Q)[ ! -f ../bin/mkTop.bin.gz ] || $(TOOLCHAIN)objcopy --add-section fpgadata=../bin/mkTop.bin.gz ubuntu.exe 24 | 25 | connectal.so: $(SOURCES) 26 | $(Q)$(CXX) -shared -fpic $(CFLAGS) -o connectal.so $(SOURCES) $(LDLIBS) 27 | 28 | ubuntu.exe2: $(SOURCES2) 29 | $(Q)$(CXX) $(CFLAGS) $(CFLAGS2) -o ubuntu.exe2 $(SOURCES2) $(LDLIBS) 30 | 31 | xsim: $(XSOURCES) 32 | $(CXX) $(CFLAGS) -o xsim $(XSOURCES) 33 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni_3.2/driver_signature_file.h: -------------------------------------------------------------------------------- 1 | {"21c2774a18d73b43c056d6be19659da5", "connectalsdhci.c"}, 2 | {"a4b8745fca79964a8b75d6cf068c78de", "connectalspi.c"}, 3 | {"47e961a4b445762e6b6024086a3ff16b", "pcieportal.c"}, 4 | {"d96a232ecd122ef75110250e2d1d1ab4", "portalmem.c"}, 5 | {"e059016ac411386d6e2597d43bc49e15", "zynqportal.c"}, 6 | {"bd2e0500b4b4ff6fe2eaf90482e237c9", "MMURequest.c"}, 7 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni_3.2/topEnum.h: -------------------------------------------------------------------------------- 1 | 2 | typedef enum {NoInterface, PlatformIfcNames_MemServerRequestS2H=1, 3 | PlatformIfcNames_MMURequestS2H=2, 4 | PlatformIfcNames_MemServerIndicationH2S=3, 5 | PlatformIfcNames_MMUIndicationH2S=4, 6 | IfcNames_FlashIndicationH2S=5, 7 | IfcNames_FlashRequestS2H=6} IfcNames; 8 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni_3.2/ubuntu.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgist-datalab/FlashFTLDriver/107d83b71ea29e25dbb57ab7b8ecc56f29589032/lower/bdbm_drv/frontend/libmemio/zcu102/jni_3.2/ubuntu.exe -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni_4.0/Android.mk: -------------------------------------------------------------------------------- 1 | 2 | include $(CLEAR_VARS) 3 | DTOP?=/home/cwchung/workspace/lightstore/projects/flash_kt_wr/zcu102 4 | CONNECTALDIR?=/home/cwchung/workspace/lightstore/tools/connectal 5 | LOCAL_ARM_MODE := arm 6 | include $(CONNECTALDIR)/scripts/Makefile.connectal.application 7 | LOCAL_SRC_FILES := /home/cwchung/workspace/lightstore/projects/flash_kt_wr/main.cpp /home/cwchung/workspace/lightstore/tools/connectal/cpp/dmaManager.c /home/cwchung/workspace/lightstore/tools/connectal/cpp/platformMemory.cpp $(PORTAL_SRC_FILES) 8 | 9 | LOCAL_PATH := 10 | LOCAL_MODULE := android.exe 11 | LOCAL_MODULE_TAGS := optional 12 | LOCAL_LDLIBS := -llog 13 | LOCAL_CPPFLAGS := "-march=armv7-a" 14 | LOCAL_CFLAGS := -I$(DTOP)/jni -I$(CONNECTALDIR) -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR)/lib/cpp -Werror 15 | LOCAL_CXXFLAGS := -I$(DTOP)/jni -I$(CONNECTALDIR) -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR)/lib/cpp -Werror 16 | LOCAL_CFLAGS2 := $(cdefines2)s 17 | 18 | include $(BUILD_EXECUTABLE) 19 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni_4.0/Application.mk: -------------------------------------------------------------------------------- 1 | APP_PLATFORM := android-16 2 | NDK_TOOLCHAIN_VERSION := 4.9 3 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni_4.0/ConnectalProjectConfig.h: -------------------------------------------------------------------------------- 1 | #ifndef _ConnectalProjectConfig_h 2 | #define _ConnectalProjectConfig_h 3 | 4 | #define DataBusWidth 128 5 | #define NumReadClients 4 6 | #define NumWriteClients 8 7 | #define NumReFlash 2 8 | #define NumWeFlash 4 9 | #define IMPORT_HOST_CLOCKS "" 10 | #define ZCU_AXI_SLAVE_START 2 11 | #define DEFAULT_NOPROGRAM 1 12 | #define MMU_INDEX_WIDTH 13 13 | #define ConnectalVersion "18.01.4" 14 | #define NumberOfMasters 2 15 | #define PinType "Top_Pins" 16 | #define PinTypeInclude "Top_Pins" 17 | #define NumberOfUserTiles 1 18 | #define SlaveDataBusWidth 32 19 | #define SlaveControlAddrWidth 5 20 | #define BurstLenSize 10 21 | #define project_dir "$(DTOP)" 22 | #define MainClockPeriod 5.714000 23 | #define DerivedClockPeriod 9.090000 24 | #define XILINX 1 25 | #define ZYNQ "" 26 | #define ZynqUltrascale "" 27 | #define ZynqHostInterface "" 28 | #define PhysAddrWidth 40 29 | #define CONNECTAL_BITS_DEPENDENCES "hw/mkTop.bit" 30 | #define CONNECTAL_RUN_SCRIPT "$(CONNECTALDIR)/scripts/run.ubuntu" 31 | #define CONNECTAL_EXENAME "ubuntu.exe" 32 | #define CONNECTAL_EXENAME2 "ubuntu.exe2" 33 | #define BOARD_zcu102 "" 34 | 35 | #endif // _ConnectalProjectConfig_h 36 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni_4.0/Makefile.generated_files: -------------------------------------------------------------------------------- 1 | 2 | GENERATED_CPP=GeneratedCppCallbacks.cpp MemServerRequest.c MemServerRequestJson.cpp MMURequest.c MMURequestJson.cpp MemServerIndication.c MemServerIndicationJson.cpp MMUIndication.c MMUIndicationJson.cpp FlashRequest.c FlashRequestJson.cpp FlashIndication.c FlashIndicationJson.cpp 3 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni_4.0/Ubuntu.mk: -------------------------------------------------------------------------------- 1 | 2 | CONNECTALDIR?=/home/cwchung/workspace/lightstore/tools/connectal 3 | DTOP?=/home/cwchung/workspace/lightstore/projects/flash_kt_wr/zcu102 4 | 5 | TOOLCHAIN?=aarch64-linux-gnu- 6 | ifneq ($(TOOLCHAIN),) 7 | CC=$(TOOLCHAIN)gcc 8 | CXX=$(TOOLCHAIN)g++ 9 | endif 10 | CFLAGS_COMMON = -O -g -I$(DTOP)/jni -I$(CONNECTALDIR) -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR)/lib/cpp -Wall -Werror -I$(DTOP)/jni -I$(CONNECTALDIR) -I$(CONNECTALDIR)/cpp -I$(CONNECTALDIR)/lib/cpp 11 | CFLAGS = $(CFLAGS_COMMON) 12 | CFLAGS2 = 13 | 14 | include $(DTOP)/Makefile.autotop 15 | include $(CONNECTALDIR)/scripts/Makefile.connectal.application 16 | SOURCES = /home/cwchung/workspace/lightstore/projects/flash_kt_wr/main.cpp /home/cwchung/workspace/lightstore/tools/connectal/cpp/dmaManager.c /home/cwchung/workspace/lightstore/tools/connectal/cpp/platformMemory.cpp $(PORTAL_SRC_FILES) 17 | SOURCES2 = $(PORTAL_SRC_FILES) 18 | XSOURCES = $(CONNECTALDIR)/cpp/XsimTop.cpp $(PORTAL_SRC_FILES) 19 | LDLIBS := -lpthread 20 | 21 | ubuntu.exe: $(SOURCES) 22 | $(Q)$(CXX) $(CFLAGS) -o ubuntu.exe $(SOURCES) $(LDLIBS) 23 | $(Q)[ ! -f ../bin/mkTop.bin.gz ] || $(TOOLCHAIN)objcopy --add-section fpgadata=../bin/mkTop.bin.gz ubuntu.exe 24 | 25 | connectal.so: $(SOURCES) 26 | $(Q)$(CXX) -shared -fpic $(CFLAGS) -o connectal.so $(SOURCES) $(LDLIBS) 27 | 28 | ubuntu.exe2: $(SOURCES2) 29 | $(Q)$(CXX) $(CFLAGS) $(CFLAGS2) -o ubuntu.exe2 $(SOURCES2) $(LDLIBS) 30 | 31 | xsim: $(XSOURCES) 32 | $(CXX) $(CFLAGS) -o xsim $(XSOURCES) 33 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni_4.0/driver_signature_file.h: -------------------------------------------------------------------------------- 1 | {"21c2774a18d73b43c056d6be19659da5", "connectalsdhci.c"}, 2 | {"a4b8745fca79964a8b75d6cf068c78de", "connectalspi.c"}, 3 | {"47e961a4b445762e6b6024086a3ff16b", "pcieportal.c"}, 4 | {"d96a232ecd122ef75110250e2d1d1ab4", "portalmem.c"}, 5 | {"e059016ac411386d6e2597d43bc49e15", "zynqportal.c"}, 6 | {"bd2e0500b4b4ff6fe2eaf90482e237c9", "MMURequest.c"}, 7 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni_4.0/topEnum.h: -------------------------------------------------------------------------------- 1 | 2 | typedef enum {NoInterface, PlatformIfcNames_MemServerRequestS2H=1, 3 | PlatformIfcNames_MMURequestS2H=2, 4 | PlatformIfcNames_MemServerIndicationH2S=3, 5 | PlatformIfcNames_MMUIndicationH2S=4, 6 | IfcNames_FlashIndicationH2S=5, 7 | IfcNames_FlashRequestS2H=6} IfcNames; 8 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/libmemio/zcu102/jni_4.0/ubuntu.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgist-datalab/FlashFTLDriver/107d83b71ea29e25dbb57ab7b8ecc56f29589032/lower/bdbm_drv/frontend/libmemio/zcu102/jni_4.0/ubuntu.exe -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/nvme/dev_proxy.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | uint32_t dm_proxy_probe (bdbm_drv_info_t* bdi, bdbm_device_params_t* params); 26 | uint32_t dm_proxy_open (bdbm_drv_info_t* bdi); 27 | void dm_proxy_close (bdbm_drv_info_t* bdi); 28 | uint32_t dm_proxy_make_req (bdbm_drv_info_t* bdi, bdbm_llm_req_t* r); 29 | uint32_t dm_proxy_make_reqs (bdbm_drv_info_t* bdi, bdbm_hlm_req_t* r); 30 | void dm_proxy_end_req (bdbm_drv_info_t* bdi, bdbm_llm_req_t* r); 31 | uint32_t dm_proxy_load (bdbm_drv_info_t* bdi, const char* fn); 32 | uint32_t dm_proxy_store (bdbm_drv_info_t* bdi, const char* fn); 33 | 34 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/nvme/libftl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgist-datalab/FlashFTLDriver/107d83b71ea29e25dbb57ab7b8ecc56f29589032/lower/bdbm_drv/frontend/nvme/libftl -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/user/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for a RISA Device Driver 2 | # 3 | 4 | #CC = g++ 5 | CC = arm-linux-gnueabihf-g++ 6 | FTL := ../../ftl 7 | INCLUDE := ../../include 8 | COMMON := ../../common 9 | DM_COMMON := ../../devices/common 10 | 11 | CFLAGS := -Wall -g -D_LARGEFILE64_SOURCE -D_GNU_SOURCE 12 | LIBS += -lm -lpthread -lrt 13 | 14 | INCLUDES = -I$(PWD)/$(INCLUDE) \ 15 | -I$(PWD)/$(COMMON)/utils \ 16 | -I$(PWD)/$(COMMON)/3rd \ 17 | -I$(PWD)/$(FTL) \ 18 | -I$(PWD)/$(DM_COMMON) \ 19 | 20 | CFLAGS += -D HASH_BLOOM=20 \ 21 | -D CONFIG_ENABLE_MSG \ 22 | -D CONFIG_ENABLE_DEBUG \ 23 | -D USER_MODE \ 24 | -D USE_PMU \ 25 | # -D USE_NEW_RMW \ 26 | 27 | DMLIB := ../../devices/libramdrive/libramdrive.a 28 | #DMLIB := ../../devices/nohost/nohost.a 29 | LIBFTL := libftl.a 30 | 31 | SRCS := \ 32 | main.c \ 33 | 34 | libftl: $(SRCS) $(DMLIB) $(LIBFTL) 35 | $(CC) $(INCLUDES) $(CFLAGS) -o $@ $(SRCS) $(LIBS) $(LIBFTL) $(DMLIB) 36 | 37 | clean: 38 | @$(RM) *.o core *~ libftl 39 | @cd $(FTL); rm -rf *.o .*.cmd; rm -rf */*.o */.*.cmd; 40 | @cd $(COMMON)/utils; rm -rf *.o .*.cmd; rm -rf */*.o */.*.cmd; 41 | @cd $(COMMON)/3rd; rm -rf *.o .*.cmd; rm -rf */*.o */.*.cmd; 42 | @cd $(COMMON); rm -rf *.o .*.cmd; rm -rf */*.o */.*.cmd; 43 | -------------------------------------------------------------------------------- /lower/bdbm_drv/frontend/user/down: -------------------------------------------------------------------------------- 1 | scp libftl chamdoo@nohost00.csail.mit.edu:~/ 2 | -------------------------------------------------------------------------------- /lower/bdbm_drv/ftl/error_codes.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #ifndef _BLUEDBM_ERROR_CODES_H 26 | #define _BLUEDBM_ERROR_CODES_H 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /lower/bdbm_drv/ftl/ftl_params.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #ifndef __BLUEDBM_FTL_PARAM_H__ 26 | #define __BLUEDBM_FTL_PARAM_H__ 27 | 28 | extern int _param_kernel_sector_size; 29 | extern int _param_gc_policy; 30 | extern int _param_wl_policy; 31 | extern int _param_queuing_policy; 32 | extern int _param_trim; 33 | extern int _param_snapshot; 34 | extern int _param_mapping_type; 35 | extern int _param_llm_type; 36 | extern int _param_hlm_type; 37 | 38 | bdbm_ftl_params get_default_ftl_params (void); 39 | void display_ftl_params (bdbm_ftl_params* p); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /lower/bdbm_drv/ftl/hlm_nobuf.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #ifndef _BLUEDBM_HLM_NO_BUFFER_H 26 | #define _BLUEDBM_HLM_NO_BUFFER_H 27 | 28 | /* export hlm_nobuf interface */ 29 | extern bdbm_hlm_inf_t _hlm_nobuf_inf; 30 | 31 | /* functions */ 32 | uint32_t hlm_nobuf_create (bdbm_drv_info_t* bdi); 33 | void hlm_nobuf_destroy (bdbm_drv_info_t* bdi); 34 | uint32_t hlm_nobuf_make_req (bdbm_drv_info_t* bdi, bdbm_hlm_req_t* req); 35 | void hlm_nobuf_end_req (bdbm_drv_info_t* bdi, bdbm_llm_req_t* req); 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /lower/bdbm_drv/ftl/llm_mq.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #ifndef _BLUEDBM_LLM_MQ_H 26 | #define _BLUEDBM_LLM_MQ_H 27 | 28 | extern bdbm_llm_inf_t _llm_mq_inf; 29 | 30 | uint32_t llm_mq_create (bdbm_drv_info_t* bdi); 31 | void llm_mq_destroy (bdbm_drv_info_t* bdi); 32 | uint32_t llm_mq_make_req (bdbm_drv_info_t* bdi, bdbm_llm_req_t* req); 33 | void llm_mq_flush (bdbm_drv_info_t* bdi); 34 | void llm_mq_end_req (bdbm_drv_info_t* bdi, bdbm_llm_req_t* req); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /lower/bdbm_drv/ftl/llm_noq.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #ifndef _BLUEDBM_LLM_NT_H 26 | #define _BLUEDBM_LLM_NT_H 27 | 28 | extern bdbm_llm_inf_t _llm_noq_inf; 29 | 30 | uint32_t llm_noq_create (bdbm_drv_info_t* bdi); 31 | void llm_noq_destroy (bdbm_drv_info_t* bdi); 32 | uint32_t llm_noq_make_req (bdbm_drv_info_t* bdi, bdbm_llm_req_t* req); 33 | uint32_t llm_noq_make_reqs (bdbm_drv_info_t* bdi, bdbm_hlm_req_t* hr); // for Chetan :) 34 | void llm_noq_flush (bdbm_drv_info_t* bdi); 35 | void llm_noq_end_req (bdbm_drv_info_t* bdi, bdbm_llm_req_t* req); 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /lower/bdbm_drv/ftl/llm_noq_lock.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #ifndef _BLUEDBM_LLM_NOQ_LOCK_H 26 | #define _BLUEDBM_LLM_NOQ_LOCK_H 27 | 28 | extern bdbm_llm_inf_t _llm_noq_lock_inf; 29 | 30 | uint32_t llm_noq_lock_create (bdbm_drv_info_t* bdi); 31 | void llm_noq_lock_destroy (bdbm_drv_info_t* bdi); 32 | uint32_t llm_noq_lock_make_req (bdbm_drv_info_t* bdi, bdbm_llm_req_t* req); 33 | void llm_noq_lock_flush (bdbm_drv_info_t* bdi); 34 | void llm_noq_lock_end_req (bdbm_drv_info_t* bdi, bdbm_llm_req_t* req); 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /lower/bdbm_drv/ftl/llm_rmq.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #ifndef _BLUEDBM_LLM_RMQ_H 26 | #define _BLUEDBM_LLM_RMQ_H 27 | 28 | extern bdbm_llm_inf_t _llm_rmq_inf; 29 | 30 | uint32_t llm_rmq_create (bdbm_drv_info_t* bdi); 31 | void llm_rmq_destroy (bdbm_drv_info_t* bdi); 32 | uint32_t llm_rmq_make_req (bdbm_drv_info_t* bdi, bdbm_llm_req_t* req); 33 | void llm_rmq_flush (bdbm_drv_info_t* bdi); 34 | void llm_rmq_end_req (bdbm_drv_info_t* bdi, bdbm_llm_req_t* req); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /lower/bdbm_drv/include/devices.h: -------------------------------------------------------------------------------- 1 | /* 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014-2015 CSAIL, MIT 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | */ 24 | 25 | #ifndef __BDBM_DEVICES__ 26 | #define __BDBM_DEVICES__ 27 | 28 | #if defined (USER_MODE) 29 | #include 30 | #endif 31 | 32 | #include "bdbm_drv.h" 33 | 34 | int bdbm_dm_init (bdbm_drv_info_t* bdi); 35 | bdbm_dm_inf_t* bdbm_dm_get_inf (bdbm_drv_info_t* bdi); 36 | void bdbm_dm_exit (bdbm_drv_info_t* bdi); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/bdbm_format: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgist-datalab/FlashFTLDriver/107d83b71ea29e25dbb57ab7b8ecc56f29589032/lower/bdbm_drv/run/bdbm_format -------------------------------------------------------------------------------- /lower/bdbm_drv/run/bonnie++/run_bonnie++.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # for 2 GB 4 | sudo mkdir /media/blueDBM/1 5 | sudo bonnie++ -s 320:1024 -n 40 -x 1 -r 8 -z 1 -u root -d /media/blueDBM/1 & 6 | sudo mkdir /media/blueDBM/2 7 | sudo bonnie++ -s 320:1024 -n 40 -x 1 -r 8 -z 1 -u root -d /media/blueDBM/2 & 8 | sudo mkdir /media/blueDBM/3 9 | sudo bonnie++ -s 320:1024 -n 40 -x 1 -r 8 -z 1 -u root -d /media/blueDBM/3 & 10 | 11 | # for 16 GB 12 | #sudo mkdir /media/blueDBM/1 13 | #sudo bonnie++ -s 2500:1024 -n 40 -x 1 -r 8 -z 1 -u root -d /media/blueDBM/1 & 14 | #sudo mkdir /media/blueDBM/2 15 | #sudo bonnie++ -s 2500:1024 -n 40 -x 1 -r 8 -z 1 -u root -d /media/blueDBM/2 & 16 | #sudo mkdir /media/blueDBM/3 17 | #sudo bonnie++ -s 2500:1024 -n 40 -x 1 -r 8 -z 1 -u root -d /media/blueDBM/3 & 18 | #sudo mkdir /media/blueDBM/4 19 | #sudo bonnie++ -s 2500:1024 -n 40 -x 1 -r 8 -z 1 -u root -d /media/blueDBM/4 & 20 | 21 | for job in `jobs -p` 22 | do 23 | echo $job 24 | wait $job 25 | done 26 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/empty_cache.sh: -------------------------------------------------------------------------------- 1 | sudo sh -c "echo 3 > /proc/sys/vm/drop_caches" 2 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/fio/run_fio_randr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sudo fio --randrepeat=1 \ 4 | --name=libaio\ 5 | --filename=/media/blueDBM/fio \ 6 | --bs=4k \ 7 | --iodepth=128 \ 8 | --size=10000M \ 9 | --readwrite=randread \ 10 | --rwmixwrite=0 \ 11 | --rwmixread=100 \ 12 | --overwrite=1 \ 13 | --numjobs=8 \ 14 | --direct=0 \ 15 | --buffer=1 16 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/fio/run_fio_rw.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #sudo fio --randrepeat=1 \ 4 | #--ioengine=libaio \ 5 | #--buffered=1 \ 6 | #--name=fio\ 7 | #--filename=/media/blueDBM/fio \ 8 | #--bs=4k \ 9 | #--iodepth=128 \ 10 | #--size=1000M \ 11 | #--readwrite=randrw \ 12 | #--rwmixread=0 \ 13 | #--overwrite=1 \ 14 | #--numjobs=8 \ 15 | #--fsync=1000 16 | 17 | sudo rm /media/blueDBM/fio 18 | 19 | sudo fio --randrepeat=1 \ 20 | --ioengine=libaio \ 21 | --name=fio\ 22 | --filename=/media/blueDBM/fio \ 23 | --bs=4k \ 24 | --iodepth=128 \ 25 | --size=1000M \ 26 | --readwrite=randrw \ 27 | --rwmixread=0 \ 28 | --overwrite=0 \ 29 | --numjobs=8 \ 30 | --direct=0 \ 31 | --buffered=0 32 | 33 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/fio/run_fio_seqr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sudo fio --randrepeat=1 \ 4 | --ioengine=libaio \ 5 | --name=fio\ 6 | --filename=/media/blueDBM/fio \ 7 | --bs=4k \ 8 | --iodepth=128 \ 9 | --size=10000M \ 10 | --readwrite=read \ 11 | --rwmixwrite=0 \ 12 | --rwmixread=100 \ 13 | --overwrite=1 \ 14 | --numjobs=8 \ 15 | --direct=0 \ 16 | --buffer=1 17 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/fio/run_fio_seqw.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sudo fio --randrepeat=1 \ 4 | --ioengine=libaio \ 5 | --buffered=1 \ 6 | --name=fio\ 7 | --filename=/media/blueDBM/fio \ 8 | --bs=4k \ 9 | --iodepth=128 \ 10 | --size=1000M \ 11 | --readwrite=write \ 12 | --rwmixwrite=100 \ 13 | --overwrite=1 \ 14 | --numjobs=1 \ 15 | --direct=1 16 | #--end_fsync=1 \ 17 | #--fsync_on_close=1 \ 18 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/fio/run_fio_seqw_sync.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sudo fio --randrepeat=1 \ 4 | --ioengine=libaio \ 5 | --name=fio\ 6 | --filename=/media/blueDBM/fio \ 7 | --bs=4k \ 8 | --iodepth=128 \ 9 | --size=1000M \ 10 | --readwrite=write \ 11 | --rwmixread=100 \ 12 | --overwrite=1 \ 13 | --numjobs=1 \ 14 | --direct=0 \ 15 | --sync=1 16 | 17 | #--buffered=1 \ 18 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/mount_ext4.sh: -------------------------------------------------------------------------------- 1 | sudo mkdir -p /usr/share/bdbm_drv 2 | sudo touch /usr/share/bdbm_drv/ftl.dat 3 | sudo touch /usr/share/bdbm_drv/dm.dat 4 | 5 | sudo insmod risa_dev_ramdrive_timing.ko 6 | #sudo insmod risa_dev_ramdrive_intr.ko 7 | #sudo insmod risa_dev_bluedbm.ko 8 | #sudo insmod bdbm_drv_page.ko 9 | sudo insmod bdbm_drv.ko 10 | #sudo ./bdbm_format /dev/blueDBM 11 | sudo mkfs -t ext4 -b 4096 /dev/blueDBM 12 | sudo mount \-t ext4 \-o discard /dev/blueDBM /media/blueDBM 13 | #sudo mount \-t ext4 /dev/blueDBM /media/blueDBM 14 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/mount_ext4_dftl.sh: -------------------------------------------------------------------------------- 1 | sudo mkdir -p /usr/share/bdbm_drv 2 | sudo touch /usr/share/bdbm_drv/ftl.dat 3 | sudo touch /usr/share/bdbm_drv/dm.dat 4 | 5 | #sudo insmod risa_dev_ramdrive_intr.ko 6 | #sudo insmod risa_dev_bluedbm.ko 7 | sudo insmod risa_dev_ramdrive.ko 8 | sudo insmod bdbm_drv_dftl.ko 9 | sudo ./bdbm_format /dev/blueDBM 10 | sudo mkfs -t ext4 -b 4096 /dev/blueDBM 11 | sudo mount \-t ext4 \-o discard /dev/blueDBM /media/blueDBM 12 | #sudo mount \-t ext4 /dev/blueDBM /media/blueDBM 13 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/mount_f2fs.sh: -------------------------------------------------------------------------------- 1 | sudo mkdir -p /usr/share/bdbm_drv 2 | sudo touch /usr/share/bdbm_drv/ftl.dat 3 | sudo touch /usr/share/bdbm_drv/dm.dat 4 | 5 | # compile f2fs 6 | cd ../../f2fs_org/tools/ 7 | make 8 | sudo make install 9 | cd - 10 | 11 | #sudo insmod risa_dev_ramdrive_intr.ko 12 | sudo insmod risa_dev_bluedbm.ko 13 | sudo insmod bdbm_drv_page.ko 14 | sudo insmod f2fs.ko 15 | sudo ./bdbm_format /dev/blueDBM 16 | sudo mkfs.f2fs -a 0 -s 2 /dev/blueDBM 17 | sudo mount \-t f2fs \-o discard /dev/blueDBM /media/blueDBM 18 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/mount_f2fs_dftl.sh: -------------------------------------------------------------------------------- 1 | sudo mkdir -p /usr/share/bdbm_drv 2 | sudo touch /usr/share/bdbm_drv/ftl.dat 3 | sudo touch /usr/share/bdbm_drv/dm.dat 4 | 5 | # compile f2fs 6 | cd ../../f2fs_org/tools/ 7 | make 8 | sudo make install 9 | cd - 10 | 11 | #sudo insmod risa_dev_ramdrive_intr.ko 12 | #sudo insmod risa_dev_bluedbm.ko 13 | sudo insmod risa_dev_ramdrive.ko 14 | sudo insmod bdbm_drv_dftl.ko 15 | sudo insmod f2fs.ko 16 | sudo ./bdbm_format /dev/blueDBM 17 | sudo mkfs.f2fs -a 0 -s 2 /dev/blueDBM 18 | sudo mount \-t f2fs \-o discard /dev/blueDBM /media/blueDBM 19 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/mount_risa.sh: -------------------------------------------------------------------------------- 1 | sudo mkdir -p /usr/share/bdbm_drv 2 | sudo touch /usr/share/bdbm_drv/ftl.dat 3 | sudo touch /usr/share/bdbm_drv/dm.dat 4 | 5 | # compile risa 6 | cd ../../risa-f2fs/tools 7 | make 8 | sudo make install 9 | cd - 10 | 11 | #sudo insmod risa_dev_ramdrive_intr.ko 12 | sudo insmod risa_dev_bluedbm.ko 13 | sudo insmod bdbm_drv_risa.ko 14 | sudo insmod risa.ko 15 | sudo ./bdbm_format /dev/blueDBM 16 | sudo mkfs.f2fs -a 0 -s 8 /dev/blueDBM 17 | sudo mount \-t f2fs \-o discard /dev/blueDBM /media/blueDBM 18 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/postmark/postmark-config-1.cfg: -------------------------------------------------------------------------------- 1 | set transactions 20000 2 | set number 10000 3 | set location /media/blueDBM/1 4 | set buffering true 5 | set size 5120 524288 6 | set read 4096 7 | set write 4096 8 | show 9 | run 10 | quit 11 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/postmark/postmark-config-2.cfg: -------------------------------------------------------------------------------- 1 | set transactions 20000 2 | set number 10000 3 | set location /media/blueDBM/2 4 | set buffering true 5 | set size 5120 524288 6 | set read 4096 7 | set write 4096 8 | show 9 | run 10 | quit 11 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/postmark/postmark-config-3.cfg: -------------------------------------------------------------------------------- 1 | set transactions 20000 2 | set number 10000 3 | set location /media/blueDBM/3 4 | set buffering true 5 | set size 5120 524288 6 | set read 4096 7 | set write 4096 8 | show 9 | run 10 | quit 11 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/postmark/postmark-config-small-1.cfg: -------------------------------------------------------------------------------- 1 | set transactions 20000 2 | set number 5000 3 | set location /media/blueDBM/1 4 | set buffering true 5 | set size 5120 524288 6 | set read 4096 7 | set write 4096 8 | show 9 | run 10 | quit 11 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/postmark/postmark-config-small-2.cfg: -------------------------------------------------------------------------------- 1 | set transactions 20000 2 | set number 5000 3 | set location /media/blueDBM/2 4 | set buffering true 5 | set size 5120 524288 6 | set read 4096 7 | set write 4096 8 | show 9 | run 10 | quit 11 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/postmark/postmark-config-small-3.cfg: -------------------------------------------------------------------------------- 1 | set transactions 20000 2 | set number 5000 3 | set location /media/blueDBM/3 4 | set buffering true 5 | set size 5120 524288 6 | set read 4096 7 | set write 4096 8 | show 9 | run 10 | quit 11 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/postmark/run_postmark.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sudo mkdir /media/blueDBM/1 3 | sudo postmark < postmark-config-1.cfg & 4 | sudo mkdir /media/blueDBM/2 5 | sudo postmark < postmark-config-2.cfg & 6 | sudo mkdir /media/blueDBM/3 7 | sudo postmark < postmark-config-3.cfg & 8 | 9 | for job in `jobs -p` 10 | do 11 | echo $job 12 | wait $job 13 | done 14 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/postmark/run_postmark_small.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sudo mkdir /media/blueDBM/1 3 | sudo postmark < postmark-config-small-1.cfg & 4 | sudo mkdir /media/blueDBM/2 5 | sudo postmark < postmark-config-small-2.cfg & 6 | sudo mkdir /media/blueDBM/3 7 | sudo postmark < postmark-config-small-3.cfg & 8 | 9 | for job in `jobs -p` 10 | do 11 | echo $job 12 | wait $job 13 | done 14 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/rmlog.sh: -------------------------------------------------------------------------------- 1 | sudo service rsyslog stop 2 | sudo rm /var/log/messages* 3 | sudo rm /var/log/syslog* 4 | sudo rm /var/log/kern* 5 | sudo rm /var/log/auth* 6 | sudo rm /var/log/syslog 7 | sudo dmesg -C 8 | sudo service rsyslog start 9 | -------------------------------------------------------------------------------- /lower/bdbm_drv/run/umount.sh: -------------------------------------------------------------------------------- 1 | sudo umount /media/blueDBM 2 | sudo rmmod bdbm_drv 3 | sudo rmmod risa_dev_* 4 | sudo rmmod f2fs 5 | -------------------------------------------------------------------------------- /lower/bdbm_drv/test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgist-datalab/FlashFTLDriver/107d83b71ea29e25dbb57ab7b8ecc56f29589032/lower/bdbm_drv/test -------------------------------------------------------------------------------- /lower/bdbm_drv/tools/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-g -Wall 2 | CC=gcc 3 | LIBS=-lm -lpthread 4 | INCLUDES= 5 | OBJS_FORMAT=bdbm_format.o 6 | SRCS_FORMAT=bdbm_format.c 7 | 8 | #The variable $@ has the value of the target. In this case $@ = psort 9 | bdbm_format: ${OBJS_FORMAT} 10 | ${CC} ${CFLAGS} ${INCLUDES} -o $@ ${OBJS_FORMAT} ${LIBS} 11 | 12 | .c.o: 13 | ${CC} ${CFLAGS} ${INCLUDES} -c $< 14 | 15 | clean: 16 | rm *.o bdbm_format 17 | -------------------------------------------------------------------------------- /lower/bdbm_drv/tools/bdbm_format: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dgist-datalab/FlashFTLDriver/107d83b71ea29e25dbb57ab7b8ecc56f29589032/lower/bdbm_drv/tools/bdbm_format -------------------------------------------------------------------------------- /lower/linux_aio/Makefile: -------------------------------------------------------------------------------- 1 | 2 | SRCS +=\ 3 | linux_aio.c\ 4 | 5 | OBJS :=\ 6 | $(patsubst %.c,%.o,$(SRCS))\ 7 | 8 | TARGETOBJ:=\ 9 | $(addprefix ../../object/,$(OBJS))\ 10 | #$(patsubst %.c,%.o,$(SRCS))\ 11 | 12 | DEBUG : all 13 | all: $(TARGETOBJ) 14 | 15 | libpos.a : $(TARGETOBJ) 16 | $(AR) r $(@) $(TARGETOBJ) 17 | 18 | 19 | .c.o : 20 | $(CC) -laio $(CFLAGS_LOWER) -c $< -o $@ 21 | 22 | ../../object/%.o: %.c 23 | $(CC) $(CFLAGS_LOWER) -c $< -o $@ 24 | 25 | clean : 26 | @$(RM) libpos.a 27 | @$(RM) *.o 28 | -------------------------------------------------------------------------------- /lower/linux_aio/linux_aio.h: -------------------------------------------------------------------------------- 1 | #include "../../include/container.h" 2 | #include 3 | typedef struct iocb_container{ 4 | struct iocb cb; 5 | }iocb_container_t; 6 | 7 | uint32_t aio_create(lower_info*, blockmanager *bm); 8 | void *aio_destroy(lower_info*); 9 | void* aio_push_data(uint32_t ppa, uint32_t size, value_set *value,bool async, algo_req * const req); 10 | void* aio_pull_data(uint32_t ppa, uint32_t size, value_set* value,bool async,algo_req * const req); 11 | void* aio_trim_block(uint32_t ppa,bool async); 12 | void* aio_trim_a_block(uint32_t ppa,bool async); 13 | void *aio_refresh(lower_info*); 14 | void aio_stop(); 15 | void aio_flying_req_wait(); 16 | -------------------------------------------------------------------------------- /lower/network/Makefile: -------------------------------------------------------------------------------- 1 | SRCS +=\ 2 | epoll_network.c\ 3 | 4 | OBJS :=\ 5 | $(patsubst %.c,%.o,$(SRCS))\ 6 | 7 | TARGETOBJ:=\ 8 | $(addprefix ../../object/,$(OBJS))\ 9 | #$(patsubst %.c,%.o,$(SRCS))\ 10 | 11 | DEBUG : all 12 | all: $(TARGETOBJ) 13 | 14 | libpos.a : $(TARGETOBJ) 15 | $(AR) r $(@) $(TARGETOBJ) 16 | 17 | 18 | .c.o : 19 | $(CC) $(CFLAGS_LOWER) -c $< -o $@ 20 | 21 | ../../object/%.o: %.c 22 | $(CC) $(CFLAGS_LOWER) -c $< -o $@ 23 | 24 | clean : 25 | @$(RM) libpos.a 26 | @$(RM) *.o 27 | -------------------------------------------------------------------------------- /lower/network/network.h: -------------------------------------------------------------------------------- 1 | #include "../../include/container.h" 2 | #include "../../bench/measurement.h" 3 | #include "../../interface/queue.h" 4 | #include "../../include/settings.h" 5 | #include "../../include/utils/cond_lock.h" 6 | 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | 20 | #define RQ_TYPE_CREATE 6 21 | #define RQ_TYPE_DESTROY 0 22 | #define RQ_TYPE_PUSH 1 23 | #define RQ_TYPE_PULL 2 24 | #define RQ_TYPE_TRIM 4 25 | #define RQ_TYPE_FLYING 5 26 | 27 | struct net_data { 28 | int8_t type; 29 | KEYT ppa; 30 | int32_t idx; 31 | uint8_t req_type; 32 | uint8_t type_lower; 33 | }; 34 | 35 | struct mem_seg { 36 | PTR storage; 37 | bool alloc; 38 | }; 39 | 40 | 41 | uint32_t net_info_create(lower_info *li); 42 | void *net_info_destroy(lower_info *li); 43 | void *net_info_push_data(KEYT ppa, uint32_t size, value_set *value, bool async, algo_req *const req); 44 | void *net_info_pull_data(KEYT ppa, uint32_t size, value_set *value, bool async, algo_req *const req); 45 | void *net_info_trim_block(KEYT ppa, bool async); 46 | void net_info_flying_req_wait(); 47 | void *net_refresh(struct lower_info* li); 48 | void net_info_stop(); 49 | -------------------------------------------------------------------------------- /lower/no_dev/Makefile: -------------------------------------------------------------------------------- 1 | 2 | SRCS +=\ 3 | no_dev.c\ 4 | 5 | OBJS :=\ 6 | $(patsubst %.c,%.o,$(SRCS))\ 7 | 8 | TARGETOBJ:=\ 9 | $(addprefix ../../object/,$(OBJS))\ 10 | #$(patsubst %.c,%.o,$(SRCS))\ 11 | 12 | DEBUG : all 13 | all: $(TARGETOBJ) 14 | 15 | libpos.a : $(TARGETOBJ) 16 | $(AR) r $(@) $(TARGETOBJ) 17 | 18 | 19 | .c.o : 20 | $(CC) -laio $(CFLAGS_LOWER) -c $< -o $@ 21 | 22 | ../../object/%.o: %.c 23 | $(CC) $(CFLAGS_LOWER) -c $< -o $@ 24 | 25 | clean : 26 | @$(RM) libpos.a 27 | @$(RM) *.o 28 | -------------------------------------------------------------------------------- /lower/no_dev/no_dev.h: -------------------------------------------------------------------------------- 1 | #include "../../include/container.h" 2 | #include 3 | typedef struct iocb_container{ 4 | struct iocb cb; 5 | }iocb_container_t; 6 | 7 | uint32_t no_create(lower_info*, blockmanager *bm); 8 | void *no_destroy(lower_info*); 9 | void* no_push_data(uint32_t ppa, uint32_t size, value_set *value,bool async, algo_req * const req); 10 | void* no_pull_data(uint32_t ppa, uint32_t size, value_set* value,bool async,algo_req * const req); 11 | void* no_trim_block(uint32_t ppa,bool async); 12 | void *no_refresh(lower_info*); 13 | void no_stop(); 14 | void no_flying_req_wait(); 15 | -------------------------------------------------------------------------------- /lower/posix/Makefile: -------------------------------------------------------------------------------- 1 | 2 | SRCS +=\ 3 | posix.c\ 4 | 5 | OBJS :=\ 6 | $(patsubst %.c,%.o,$(SRCS))\ 7 | 8 | TARGETOBJ:=\ 9 | $(addprefix ../../object/,$(OBJS))\ 10 | #$(patsubst %.c,%.o,$(SRCS))\ 11 | 12 | DEBUG : all 13 | all: $(TARGETOBJ) 14 | 15 | libpos.a : $(TARGETOBJ) 16 | $(AR) r $(@) $(TARGETOBJ) 17 | 18 | 19 | .c.o : 20 | $(CC) $(CFLAGS_LOWER) -c $< -o $@ 21 | 22 | ../../object/%.o: %.c 23 | $(CC) $(CFLAGS_LOWER) -c $< -o $@ 24 | 25 | clean : 26 | @$(RM) libpos.a 27 | @$(RM) *.o 28 | -------------------------------------------------------------------------------- /lower/posix/posix.h: -------------------------------------------------------------------------------- 1 | #include "../../include/container.h" 2 | 3 | uint32_t posix_create(lower_info*); 4 | void *posix_destroy(lower_info*); 5 | void* posix_push_data(uint32_t ppa, uint32_t size, value_set *value,bool async, algo_req * const req); 6 | void* posix_pull_data(uint32_t ppa, uint32_t size, value_set* value,bool async,algo_req * const req); 7 | void* posix_trim_block(uint32_t ppa,bool async); 8 | void *posix_refresh(lower_info*); 9 | void posix_stop(); 10 | void posix_flying_req_wait(); 11 | -------------------------------------------------------------------------------- /lower/posix_async/Makefile: -------------------------------------------------------------------------------- 1 | 2 | SRCS +=\ 3 | posix.c\ 4 | 5 | OBJS :=\ 6 | $(patsubst %.c,%.o,$(SRCS))\ 7 | 8 | TARGETOBJ:=\ 9 | $(addprefix ../../object/,$(OBJS))\ 10 | #$(patsubst %.c,%.o,$(SRCS))\ 11 | 12 | DEBUG : all 13 | all: $(TARGETOBJ) 14 | 15 | libpos.a : $(TARGETOBJ) 16 | $(AR) r $(@) $(TARGETOBJ) 17 | 18 | 19 | .c.o : 20 | $(CC) $(CFLAGS_LOWER) -c $< -o $@ 21 | 22 | ../../object/%.o: %.c 23 | $(CC) $(CFLAGS_LOWER) -c $< -o $@ 24 | 25 | clean : 26 | @$(RM) libpos.a 27 | @$(RM) *.o 28 | -------------------------------------------------------------------------------- /lower/posix_async/posix.h: -------------------------------------------------------------------------------- 1 | #include "../../include/container.h" 2 | 3 | #define FS_LOWER_W 1 4 | #define FS_LOWER_R 2 5 | #define FS_LOWER_T 3 6 | 7 | uint32_t posix_create(lower_info*, blockmanager *); 8 | void *posix_destroy(lower_info*); 9 | void* posix_push_data(ppa_t ppa, uint32_t size, value_set *value,bool async, algo_req * const req); 10 | void* posix_pull_data(ppa_t ppa, uint32_t size, value_set* value,bool async,algo_req * const req); 11 | void* posix_make_push(ppa_t ppa, uint32_t size, value_set *value,bool async, algo_req * const req); 12 | void* posix_make_pull(ppa_t ppa, uint32_t size, value_set *value,bool async, algo_req * const req); 13 | void* posix_badblock_checker(ppa_t ppa, uint32_t size, void*(*process)(uint64_t,uint8_t)); 14 | void* posix_trim_block(ppa_t ppa,bool async); 15 | void *posix_make_trim(ppa_t ppa, bool async); 16 | void *posix_refresh(lower_info*); 17 | void posix_stop(); 18 | void posix_flying_req_wait(); 19 | void* posix_trim_a_block(uint32_t PPA, bool async); 20 | typedef struct posix_request { 21 | FSTYPE type; 22 | ppa_t key; 23 | value_set *value; 24 | algo_req *upper_req; 25 | bool isAsync; 26 | uint32_t size; 27 | }posix_request; 28 | -------------------------------------------------------------------------------- /lower/posix_memory/Makefile: -------------------------------------------------------------------------------- 1 | 2 | SRCS +=\ 3 | posix.c\ 4 | 5 | ifeq ($(TARGET_ALGO), Lsmtree) 6 | SRC+= pipe_lower.c 7 | endif 8 | 9 | OBJS :=\ 10 | $(patsubst %.c,%.o,$(SRCS))\ 11 | 12 | TARGETOBJ:=\ 13 | $(addprefix ../../object/,$(OBJS))\ 14 | #$(patsubst %.c,%.o,$(SRCS))\ 15 | 16 | DEBUG : all 17 | all: $(TARGETOBJ) 18 | 19 | libpos.a : $(TARGETOBJ) 20 | $(AR) r $(@) $(TARGETOBJ) 21 | 22 | 23 | .c.o : 24 | $(CC) $(CFLAGS_LOWER) -c $< -o $@ 25 | 26 | ../../object/%.o: %.c 27 | $(CC) $(CFLAGS_LOWER) -c $< -o $@ 28 | 29 | clean : 30 | @$(RM) libpos.a 31 | @$(RM) *.o 32 | -------------------------------------------------------------------------------- /lower/posix_memory/old/posix.h: -------------------------------------------------------------------------------- 1 | #include "../../include/container.h" 2 | 3 | #define FS_LOWER_W 1 4 | #define FS_LOWER_R 2 5 | #define FS_LOWER_T 3 6 | 7 | uint32_t posix_create(lower_info*,blockmanager *); 8 | void *posix_destroy(lower_info*); 9 | void* posix_push_data(uint32_t ppa, uint32_t size, value_set *value,bool async, algo_req * const req); 10 | void* posix_pull_data(uint32_t ppa, uint32_t size, value_set* value,bool async,algo_req * const req); 11 | void* posix_make_push(uint32_t ppa, uint32_t size, value_set *value,bool async, algo_req * const req); 12 | void* posix_make_pull(uint32_t ppa, uint32_t size, value_set *value,bool async, algo_req * const req); 13 | void* posix_badblock_checker(uint32_t ppa, uint32_t size, void*(*process)(uint64_t,uint8_t)); 14 | void* posix_trim_block(uint32_t ppa, bool async); 15 | void* posix_trim_a_block(uint32_t ppa, bool async); 16 | void *posix_make_trim(uint32_t ppa, bool async); 17 | void *posix_refresh(lower_info*); 18 | void posix_stop(); 19 | void posix_flying_req_wait(); 20 | 21 | typedef struct posix_request { 22 | FSTYPE type; 23 | uint32_t key; 24 | value_set *value; 25 | algo_req *upper_req; 26 | bool isAsync; 27 | uint32_t size; 28 | }posix_request; 29 | 30 | typedef struct mem_seg { 31 | PTR storage; 32 | uint8_t alloc; 33 | } mem_seg; 34 | -------------------------------------------------------------------------------- /lower/posix_memory/pipe_lower.h: -------------------------------------------------------------------------------- 1 | #ifndef PIPE_HEADER 2 | #define PIPE_HEADER 3 | 4 | 5 | #include 6 | #include 7 | #include "../../include/settings.h" 8 | #include "posix.h" 9 | 10 | #define for_each_header_start(idx,key,ppa_ptr,bitmap,body)\ 11 | for(idx=1; bitmap[idx]!=UINT16_MAX && idx<=bitmap[0]; idx++){\ 12 | ppa_ptr=(ppa_t*)&body[bitmap[idx]];\ 13 | key.key=(char*)&body[bitmap[idx]+sizeof(ppa_t)];\ 14 | key.len=bitmap[idx+1]-bitmap[idx]-sizeof(ppa_t);\ 15 | 16 | #define for_each_header_end } 17 | 18 | typedef struct pipe_lower_body{ 19 | uint32_t max_page; 20 | uint32_t pidx; 21 | uint32_t *map_ppa_list; 22 | mem_seg *data_ptr; 23 | 24 | char *now_page; 25 | uint16_t *bitmap_ptr; 26 | uint32_t length; 27 | uint32_t max_key; 28 | uint32_t kidx; 29 | }pl_body; 30 | 31 | pl_body *plbody_init(mem_seg *data, uint32_t *map_ppa_list, uint32_t list_size); 32 | KEYT plbody_get_next_key(pl_body *p, uint32_t *r_ppa); 33 | char *plbody_insert_new_key(pl_body *p,KEYT key, uint32_t ppa,bool f); 34 | 35 | void plbody_data_print(char *data); 36 | uint32_t find_ppa_from(char *body, char *key, uint32_t len); 37 | #endif 38 | -------------------------------------------------------------------------------- /lower/posix_memory/posix.h: -------------------------------------------------------------------------------- 1 | #ifndef POSIX_HEADER 2 | #define POSIX_HEADER 3 | #include "../../include/container.h" 4 | 5 | #define FS_LOWER_W 1 6 | #define FS_LOWER_R 2 7 | #define FS_LOWER_T 3 8 | 9 | uint32_t posix_create(lower_info*,blockmanager *); 10 | void *posix_destroy(lower_info*); 11 | void* posix_push_data(uint32_t ppa, uint32_t size, value_set *value,bool async, algo_req * const req); 12 | void* posix_pull_data(uint32_t ppa, uint32_t size, value_set* value,bool async,algo_req * const req); 13 | void* posix_make_push(uint32_t ppa, uint32_t size, value_set *value,bool async, algo_req * const req); 14 | void* posix_make_pull(uint32_t ppa, uint32_t size, value_set *value,bool async, algo_req * const req); 15 | void* posix_badblock_checker(uint32_t ppa, uint32_t size, void*(*process)(uint64_t,uint8_t)); 16 | void* posix_trim_block(uint32_t ppa, bool async); 17 | void* posix_trim_a_block(uint32_t ppa, bool async); 18 | void *posix_make_trim(uint32_t ppa, bool async); 19 | void *posix_refresh(lower_info*); 20 | void posix_stop(); 21 | void posix_flying_req_wait(); 22 | void* posix_read_hw(uint32_t ppa, char *key,uint32_t key_len, value_set *value,bool async,algo_req * const req); 23 | uint32_t posix_hw_do_merge(uint32_t lp_num, ppa_t *lp_array, uint32_t hp_num,ppa_t *hp_array,ppa_t *tp_array, uint32_t* ktable_num, uint32_t *invliadate_num); 24 | char * posix_hw_get_kt(); 25 | char *posix_hw_get_inv(); 26 | uint32_t convert_ppa(uint32_t); 27 | 28 | typedef struct posix_request { 29 | FSTYPE type; 30 | uint32_t key; 31 | value_set *value; 32 | algo_req *upper_req; 33 | bool isAsync; 34 | uint32_t size; 35 | }posix_request; 36 | 37 | typedef struct mem_seg { 38 | PTR storage; 39 | } mem_seg; 40 | #endif 41 | -------------------------------------------------------------------------------- /setup_shell/D_set.sh: -------------------------------------------------------------------------------- 1 | sudo sysctl -w vm.max_map_count=262144000 2 | -------------------------------------------------------------------------------- /setup_shell/exp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir -f ../result 3 | for entry in $1/* 4 | do 5 | name=$(basename $entry) 6 | ./$entry > ../result/$name.out 7 | done 8 | -------------------------------------------------------------------------------- /setup_shell/memorycheck.sh: -------------------------------------------------------------------------------- 1 | make clean 2 | make driver_memory_check 3 | if [ "$1" = "n" ] ;then 4 | echo "no show test" 5 | valgrind --leak-check=full ./driver_memory_check 2>log 1> /dev/null & 6 | elif [ "$1" = "b" ]; then 7 | echo "nohup no show test" 8 | nohup valgrind --leak-check=full ./driver_memory_check 2>../log 1> ../ttt & 9 | else 10 | echo "show test" 11 | valgrind --leak-check=full ./driver_memory_check 2>../log 12 | fi 13 | -------------------------------------------------------------------------------- /setup_shell/mtu_up.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | sudo ifconfig enp1s0 down 3 | sudo ifconfig enp1s0 mtu $1 4 | sudo ifconfig enp1s0 up 5 | -------------------------------------------------------------------------------- /setup_shell/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ "$1" = "c" ]; then 3 | make -j4 4 | elif [ "$1" = "s" ]; then 5 | make -f Net.Makefile -j4 6 | elif [ "$1" = "A" ]; then 7 | make -j4 8 | make -f Net.Makefile -j4 9 | ./mtu_up.sh 10 | elif [ "$1" = "r" ]; then 11 | make clean 12 | make -f Net.Makefile clean 13 | fi 14 | -------------------------------------------------------------------------------- /setup_shell/tcp_buffer_config.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | sysctl -w net.core.rmem_default="253952" 4 | sysctl -w net.core.wmem_default="253952" 5 | sysctl -w net.core.rmem_max="16777216" 6 | sysctl -w net.core.wmem_max="16777216" 7 | sysctl -w net.ipv4.tcp_rmem="253952 253952 16777216" 8 | sysctl -w net.ipv4.tcp_wmem="253952 253952 16777216" 9 | sysctl -w net.ipv4.tcp_rfc1337=1 10 | -------------------------------------------------------------------------------- /setup_shell/tcp_low_latency.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sysctl -w net.ipv4.tcp_low_latency=1 4 | sysctl -w net.ipv4.tcp_sack=0 5 | sysctl -w net.ipv4.tcp_timestamps=0 6 | --------------------------------------------------------------------------------