Skip to content

Instantly share code, notes, and snippets.

View akiradeveloper's full-sized avatar

Akira Hayakawa akiradeveloper

View GitHub Profile
case class Hoge(n: Int) {
def run: Route = {
complete(StatusCodes.OK)
}
}
def hoge: Route = {
pass {
Hoge(1).run
// complete(StatusCodes.OK)
@akiradeveloper
akiradeveloper / gist:9226004
Created February 26, 2014 08:51
strace mkfs.xfs した結果. 正常に終わってるんじゃないのこれ・・・closeまでしてますよ
pwrite(4, "XAGI\0\0\0\1\0\0\0\4\0\4\200\0\0\0\0\0\0\0\0\3\0\0\0\1\0\0\0\0"..., 512, 4831839232) = 512
pwrite(4, "XFSB\0\0\20\0\0\0\0\0\0H\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512, 4831838208) = 512
pwrite(4, "IABT\0\0\0\0\377\377\377\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096, 3623890944) = 4096
pwrite(4, "XAGI\0\0\0\1\0\0\0\3\0\4\200\0\0\0\0\0\0\0\0\3\0\0\0\1\0\0\0\0"..., 512, 3623879680) = 512
pwrite(4, "XFSB\0\0\20\0\0\0\0\0\0H\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512, 3623878656) = 512
pwrite(4, "IABT\0\0\0\0\377\377\377\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096, 2415931392) = 4096
pwrite(4, "XAGI\0\0\0\1\0\0\0\2\0\4\200\0\0\0\0\0\0\0\0\3\0\0\0\1\0\0\0\0"..., 512, 2415920128) = 512
pwrite(4, "XFSB\0\0\20\0\0\0\0\0\0H\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512, 2415919104) = 512
pwrite(4, "IABT\0\0\0\0\377\377\377\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096, 1207971840) = 4096
pwrite(4, "XAGI\0\0\0\1\0\0\0\1\0\4\200\0\0\0\0\0\0\0\0\3\0\0\0\
@akiradeveloper
akiradeveloper / gist:11046203
Created April 18, 2014 14:11
redesign writeback structure patch draft
diff --git a/drivers/md/dm-writeboost-daemon.c b/drivers/md/dm-writeboost-daemon.c
index 0136baa..f1e4574 100644
--- a/drivers/md/dm-writeboost-daemon.c
+++ b/drivers/md/dm-writeboost-daemon.c
@@ -255,24 +255,25 @@ static void add_migrate_io(struct wb_device *wb, struct migrate_io *mio)
rb_insert_color(&mio->rb_node, &wb->migrate_tree);
}
-static void prepare_migrate_ios(struct wb_device *wb, struct segment_header *seg,
- size_t k, size_t *migrate_io_count)
@akiradeveloper
akiradeveloper / gist:11317774
Created April 26, 2014 11:35
dm-writeboost doc (ja) v1  半分書きました. 分かりにくい表現があれば, 指摘お願いします.
dm-writeboost
=============
dm-writeboostターゲットはブロックレベルのログ構造化キャッシングを提供する.
dm-writeboostは, 受け取ったランダムライトを巨大なログにまとめ, キャッシュデバイスへのシーケンシャルライトを行う.
Mechanism
=========
Basic Mechanism
@akiradeveloper
akiradeveloper / dm-writeboost-ja-v2.txt
Created April 27, 2014 01:38
ライトブーストのドキュメントを日本語で書く(v2) 気づいた点あったら指摘お願いします
dm-writeboost
=============
dm-writeboostターゲットはブロックレベルのログ構造化キャッシングを提供する.
dm-writeboostは, 受け取ったランダムライトを巨大なログにまとめ, キャッシュデバイスへのシーケンシャルライトを行う.
Mechanism
=========
Basic Mechanism
@akiradeveloper
akiradeveloper / writeboost.txt
Created May 6, 2014 03:08
This is the updated document for Writeboost. Please make a comment if you notice mistakes on grammars or know more fluent expression.
Writeboost
==========
Writeboost target provides block-level log-structured caching.
Accepted bios are put into a big "log" and the log is written to the cache
device sequentially.
Mechanism
=========
Writeboost caches only writes - reads are not cached.
@akiradeveloper
akiradeveloper / gist:55077445f0ac45c956c8
Created May 16, 2014 12:19
本当に動いたら最善手だと思う 
kira@Kamille:~/src/device-mapper-test-suite/lib/dmtest$ git di
diff --git a/lib/dmtest/tests/writeboost/stack.rb b/lib/dmtest/tests/writeboost/stack.rb
index 56b0d73..1aee66d 100644
--- a/lib/dmtest/tests/writeboost/stack.rb
+++ b/lib/dmtest/tests/writeboost/stack.rb
@@ -78,6 +78,12 @@ class WriteboostStack
@fast_tvm.table('plog_dev')
) do |backing_dev, cache_dev, plog_dev|
@backing_dev = backing_dev
+ class << @backing_dev
Successfully installed device_mapper_test_suite-0.0.1
1 gem installed
writeboost
WriteboostTestsBackingDevice
compile_ruby
do_stress
fio_cache
fio_database_funtime
fio_sub_volume
git_extract_cache_quick
let v1 = vec!["b", "C", "l"];
let v2 = v1.iter().map(|x| matches.opt_str(*x));
let n = v2.filter(|ref x| x.is_none()).count();
if n > 1 {
crash!(1, "{}: cannot split in more than one way", NAME);
} else if n == 1 {
let e = v2.find(|ref x| !x.is_none()).unwrap(); // error
}
@akiradeveloper
akiradeveloper / gist:5360311addc87a413efa
Created June 30, 2014 23:12
Rust workaround to implement factory-pattern
trait Construct {
fn new(_hint: Option<Self>) -> Box<Construct>;
}
struct Foo { x: int }
struct Bar { y: uint }
impl Construct for Foo {
fn new(_: Option<Foo>) -> Box<Construct> {
box Foo { x: 42 } as Box<Construct>