We might have a backing device that is an odd number of 512-byte sectors
but have the block_size configured to 4096. Ensure the reported size
rounds down to avoid confusing other layers of the stack.
Signed-off-by: Sage Weil <sage@redhat.com>
fs = FS::create_by_fd(fd_direct);
assert(fs);
+ // round size down to an even block
+ size &= ~(block_size - 1);
+
r = _aio_start();
assert(r == 0);
//nvme is non-rotational device.
rotational = false;
+ // round size down to an even block
+ size &= ~(block_size - 1);
+
dout(1) << __func__ << " size " << size << " (" << pretty_si_t(size) << "B)"
<< " block_size " << block_size << " (" << pretty_si_t(block_size)
<< "B)" << dendl;