mirror of
https://github.com/ceph/ceph
synced 2025-01-25 04:24:24 +00:00
os/bluestore: ensure block device size is a multiple of the block size
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>
This commit is contained in:
parent
108ee77b54
commit
7290f34101
@ -140,6 +140,9 @@ int KernelDevice::open(string p)
|
||||
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);
|
||||
|
||||
|
@ -813,6 +813,9 @@ int NVMEDevice::open(string p)
|
||||
//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;
|
||||
|
Loading…
Reference in New Issue
Block a user