/images/head.jpg

Flush data to stable storage in C

When writing to a FILE object in C, it turns out there are multiple steps one needs to take in order to flush data from an application buffer to the stable storage (disk). Assume we have a FILE object pointer, called fp. After the fwrite(fp) call, one first needs to call fflush(fp), to flush the application buffer to the OS kernel page cache. Since the data still sits in the OS kernel space, it won’t survive on a power lose.

Notes for Myself

When substantial changes have been made to a software, review the changes once before running the code. In most cases, you will be able to identify simple bugs/errors/typos in your code by just reviewing your code once. Jump directly to run and debug your code will probably take you more time to fix the program. Learn one piece at a time. When learning a new thing, it could come with many new concepts, making it harder to understand all at once.

Dynamic Kernel Debugging

Compile kernel with CONFIG_DYNAMIC_DEBUG=y Mount debugfs, if not mounted yet sudo mount -t debugfs none /sys/kernel/debug Turn on debug for a specific module echo 'module pblk +pfl' > /sys/kernel/debug/dynamic_debug/control The flags are: p enables the pr_debug() callsite. f Include the function name in the printed message l Include line number in the printed message m Include module name in the printed message t Include thread ID in messages not generated from interrupt context _ No flags are set.

Open-Channel SSD

In Linux pblk implementation, a line corresponds to a chunk which is one erase block. A LUN is a PU. A group is a channel. Eventually, pblk calls pblk_submit_read() and pblk_submit_write() for reads/writes to the device. Read code path (from the media) in pblk 1 2 3 4 5 6 7 8 9 /* pblk-read.c */ pblk_submit_read() pblk_read_ppalist_rq(); or pblk_read_rq(); pblk_lookup_l2p_seq(); // get physical addresses pblk_submit_io(pblk, rqd); nvm_submit_io(dev, rqd); dev->ops->submit_io(dev, rqd); Write code path in pblk 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 pblk_write_to_cache() { for (i = 0; i < nr_entries; i++) { void *data = bio_data(bio); w_ctx.

Create The Author Version for Your Paper (ACM)

So you have your paper accepted to a conference and completed your camera ready version. Now is the time to create an author version for it so that you can post it on your own web site! The trick is actually quite simple if you are using the ACM Latex template. In acmart.cls, change the execution option for authorversion from false to true. -\ExecuteOptionsX{authorversion=false} +\ExecuteOptionsX{authorversion=true} You may also want to add page numbers into your paper.