forked from lvmguy/thinp-test-suite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_kernels.rb
48 lines (35 loc) · 1.04 KB
/
check_kernels.rb
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
46
47
48
require 'config'
require 'lib/log'
require 'lib/device-mapper/dm'
require 'lib/process'
require 'lib/fs'
require 'lib/utils'
#----------------------------------------------------------------
include Utils
SIZE = 20971520
def fsck_linux(dm, pool, dev_id)
thin_table = Table.new(ThinTarget.new(SIZE / 4, pool, dev_id))
dm.with_dev(thin_table) do |thin|
thin_fs = FS::file_system(:ext4, thin)
thin_fs.check
mnt = "./mnt#{dev_id}"
thin_fs.with_mount(mnt) do
ProcessControl.run("diff -ruNq linux-2.6.39.3 #{mnt}/linux-2.6.39.3")
end
end
end
config = Config.get_config
metadata_dev = config[:metadata_dev]
data_dev = config[:data_dev]
data_block_size = 128
low_water_mark = 1024
dm = DMInterface.new
table = Table.new(ThinPoolTarget.new(SIZE, metadata_dev, data_dev,
data_block_size, low_water_mark))
dm.with_dev(table) do |pool|
0.upto(3) do |dev_id|
puts "checking #{dev_id}"
fsck_linux(dm, pool, dev_id)
end
end
#----------------------------------------------------------------