diff options
Diffstat (limited to 'src/blk/BlockDevice.cc')
-rw-r--r-- | src/blk/BlockDevice.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/blk/BlockDevice.cc b/src/blk/BlockDevice.cc index 345d51fdb09..6804ee50cbc 100644 --- a/src/blk/BlockDevice.cc +++ b/src/blk/BlockDevice.cc @@ -196,3 +196,20 @@ void BlockDevice::reap_ioc() --ioc_reap_count; } } + +bool BlockDevice::is_valid_io(uint64_t off, uint64_t len) const { + bool ret = (off % block_size == 0 && + len % block_size == 0 && + len > 0 && + off < size && + off + len <= size); + + if (!ret) { + derr << __func__ << " " << std::hex + << off << "~" << len + << " block_size " << block_size + << " size " << size + << std::dec << dendl; + } + return ret; +} |