Skip to content

Instantly share code, notes, and snippets.

@akiradeveloper
Created October 13, 2017 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akiradeveloper/96fa561e77377d8b038c08a0adf8ac51 to your computer and use it in GitHub Desktop.
Save akiradeveloper/96fa561e77377d8b038c08a0adf8ac51 to your computer and use it in GitHub Desktop.
debian7 + script.sh
BACKING=/dev/vdb
CACHE=/dev/vdc
sz=`sudo blockdev --getsz ${BACKING}`
echo $sz
sudo dd if=/dev/zero of=$CACHE oflag=direct bs=512 count=1
sudo dmsetup create wbdev --table "0 $sz writeboost $BACKING $CACHE 2 writeback_threshold 70"
sudo dmsetup status wbdev | wbstatus
sudo dd if=/dev/mapper/wbdev of=/tmp/o iflag=direct bs=4k count=1
sudo dmsetup status wbdev | wbstatus
sudo dd if=/dev/urandom of=/dev/mapper/wbdev oflag=direct bs=4k count=1
sudo dmsetup status wbdev | wbstatus
41943040
cursor pos = 0
# of cache blocks = 5201666
# of segments = 40958
current id = 1
last flushed id = 0
last writeback id = 0
# of dirty cache blocks = 0
# of partial flushes = 0
write? hit? on_buffer? fullsize?
0 0 0 0 0
0 0 0 1 83
0 0 1 0 0
0 0 1 1 0
0 1 0 0 0
0 1 0 1 0
0 1 1 0 0
0 1 1 1 0
1 0 0 0 0
1 0 0 1 0
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 0
1 1 1 1 0
cursor pos = 0
# of cache blocks = 5201666
# of segments = 40958
current id = 1
last flushed id = 0
last writeback id = 0
# of dirty cache blocks = 0
# of partial flushes = 0
write? hit? on_buffer? fullsize?
0 0 0 0 0
0 0 0 1 84
0 0 1 0 0
0 0 1 1 0
0 1 0 0 0
0 1 0 1 0
0 1 1 0 0
0 1 1 1 0
1 0 0 0 0
1 0 0 1 0
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 0
1 1 1 1 0
cursor pos = 128
# of cache blocks = 5201666
# of segments = 40958
current id = 2
last flushed id = 1
last writeback id = 0
# of dirty cache blocks = 1
# of partial flushes = 0
write? hit? on_buffer? fullsize?
0 0 0 0 0
0 0 0 1 84
0 0 1 0 0
0 0 1 1 0
0 1 0 0 0
0 1 0 1 0
0 1 1 0 0
0 1 1 1 0
1 0 0 0 0
1 0 0 1 1
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 0
1 1 1 1 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment