Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verify_blocks in PatternStomper should be direct #16

Open
akiradeveloper opened this issue May 10, 2014 · 1 comment
Open

verify_blocks in PatternStomper should be direct #16

akiradeveloper opened this issue May 10, 2014 · 1 comment

Comments

@akiradeveloper
Copy link
Contributor

Currently, PatternStomper#verify_blocks opens the device with "rb" mode but it results in 4KB reads through page cache even if we use @block_size less than 4KB (e.g. 1 sector).

We should fix. Let's make it direct.

I tried using File::RDONLY | File::BINARY | File::DIRECT as the 2nd arg of File.open but it ends in error "Errno::EINVAL: Invalid argument -". I don't know why. Do you have a idea, Joe?

I am writing a new test to check unlikely path (RAM buffer read). But, it fails because of the issue above. I want to solve this

@akiradeveloper
Copy link
Contributor Author

The minimum test to reproduce. hvg1-cache2g is just a linear device.

mode = File::RDONLY | File::BINARY | File::DIRECT
File.open("/dev/mapper/hvg1-cache2g", mode) do |io|
  io.read(512).size
end

This is the strace log.
read(5, ...) fails. The buffer (2nd arg) is strange.

open("/dev/mapper/hvg1-cache2g", O_RDONLY|O_DIRECT) = 5
fstat(5, {st_mode=S_IFBLK|S_ISVTX|0660, st_rdev=makedev(251, 3), ...}) = 0
fstat(5, {st_mode=S_IFBLK|S_ISVTX|0660, st_rdev=makedev(251, 3), ...}) = 0
ioctl(5, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffa0a47c20) = -1 ENOTTY (Inappropriate ioctl for device)
read(5, 0x16de3a0, 512)                 = -1 EINVAL (Invalid argument)
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
close(5)                                = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
write(2, "fopen-test.rb:4:in `read'", 25fopen-test.rb:4:in `read') = 25
write(2, ": ", 2: )                       = 2
write(2, "Invalid argument - /dev/mapper/h"..., 43Invalid argument - /dev/mapper/hvg1-cache2g) = 43
write(2, " (", 2 ()                       = 2
write(2, "Errno::EINVAL", 13Errno::EINVAL)           = 13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant