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

rbd: bench-write should return error if io-size >= 4G #12864

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/tools/rbd/action/Bench.cc
Expand Up @@ -196,6 +196,11 @@ int do_bench(librbd::Image& image, io_type_t io_type,
return -EINVAL;
}

if (io_size > std::numeric_limits<uint32_t>::max()) {
std::cerr << "rbd: io-size should be less than 4G" << std::endl;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: ... should not exceed 4G since it can be <=

Copy link
Contributor Author

@gaurav36 gaurav36 Jan 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be < but i can not be <=, because 4G is overflowing. 4G=4294967296 and after overflow value (unsigned l) will become 0. so i think io-size should be less than 4G

return -EINVAL;
}

rbd_bencher b(&image, io_type, io_size);

std::cout << "bench "
Expand Down