From: Sage Weil Date: Wed, 10 Feb 2016 20:55:51 +0000 (-0500) Subject: os/bluestore/KernelDevice: force block size X-Git-Tag: v10.1.0~156^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3969b831242de9c92c6598726d8a322b08920310;p=ceph.git os/bluestore/KernelDevice: force block size Ignore what the file or block device IO Block is. Signed-off-by: Sage Weil --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 04dafac42a855..38ea9cb8d83d7 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -869,6 +869,7 @@ OPTION(bdev_inject_crash_flush_delay, OPT_INT, 2) // wait N more seconds on flus OPTION(bdev_aio, OPT_BOOL, true) OPTION(bdev_aio_poll_ms, OPT_INT, 250) // milliseconds OPTION(bdev_aio_max_queue_depth, OPT_INT, 32) +OPTION(bdev_block_size, OPT_INT, 4096) // if yes, osd will unbind all NVMe devices from kernel driver and bind them // to the uio_pci_generic driver. The purpose is to prevent the case where diff --git a/src/os/bluestore/KernelDevice.cc b/src/os/bluestore/KernelDevice.cc index ae2d612ef41f7..e697d893431d5 100644 --- a/src/os/bluestore/KernelDevice.cc +++ b/src/os/bluestore/KernelDevice.cc @@ -119,7 +119,17 @@ int KernelDevice::open(string p) } else { size = st.st_size; } - block_size = st.st_blksize; + + // Operate as though the block size is 4 KB. The backing file + // blksize doesn't strictly matter except that some file systems may + // require a read/modify/write if we write something smaller than + // it. + block_size = g_conf->bdev_block_size; + if (block_size != st.st_blksize) { + dout(1) << __func__ << " backing device/file reports st_blksize " + << st.st_blksize << ", using bdev_block_size " + << block_size << " anyway" << dendl; + } fs = FS::create_by_fd(fd_direct); assert(fs);