# dmsetup info
Name: ubuntu--vg-root
State: ACTIVE
Read Ahead: 256 <---- cat /sys/dev/block/253:0/bdi/read_ahead_kb gives 128 not 256
Tables present: LIVE
Open count: 1 <--- # how / from where are we getting this value
Event number: 0
Major, minor: 253, 0
Number of targets: 1
UUID: LVM-cNOV7zcldgzsAuxUbXbSdk2WhT012Pjay1B0JmoKCcTFOQDa9u19bDkqkdceVY0a
# strace for dmsetup info
open("/sys/dev/block/253:0/bdi/read_ahead_kb", O_RDONLY) = 4
read(4, "128\n", 23) = 4
close(4)= 0
write(1, "Read Ahead:256\n", 23Read Ahead:256) = 23
write(1, "Tables present: LIVE\n", 24Tables present: LIVE) = 24
write(1, "Open count:1\n", 21Open count:1) = 21
write(1, "Event number:0\n", 21Event number:0) = 21
write(1, "Major, minor:253, 0\n", 26Major, minor:253, 0) = 26
write(1, "Number of targets: 1\n", 21Number of targets: 1) = 21
write(1, "UUID: LVM-cNOV7zcldgzsAuxUbXbSdk"..., 75UUID: LVM-cNOV7zcldgzsAuxUbXbSdk2WhT012Pjay1B0JmoKCcTFOQDa9u19bDkqkdceVY0a) = 75
write(1, "\n", 1)= 1
我试图弄清楚 dmsetup 信息如何获得开放计数,我真的很想弄清楚这一点,运行了 strace 但无法告诉
我还在 /sys/dev/block/253:0/bdi/read_ahead_kb 上看到预读值 128
,但 dmsetup 信息显示 256。
这不是不一致吗?我在这里错过了什么吗?
答案1
打开计数由 ioctl 返回DM_DEV_STATUS
,我在 strace 中看到它:
ioctl(3, DM_DEV_STATUS, {version=4.0.0, data_size=16384, name="fedora-swap", flags=DM_EXISTS_FLAG} => {version=4.42.0, data_size=305, dev=makedev(0xfd, 0x2), name="fedora-swap", uuid="LVM-T3AyeS3A7de018NxTFWF0VlGG9nvww0aKeYyylJXyg92FDUfj7qe0NkAoVFgYYf1", target_count=1, open_count=2, event_nr=0, flags=DM_EXISTS_FLAG|DM_ACTIVE_PRESENT_FLAG}) = 0
dmsetup 输出中的预读值以 512b 扇区为单位,但在 sysfs 中以 KiB 为单位 -- 256*512 = 128 KiB