]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/KernelDevice: force block size 8006/head
authorSage Weil <sage@redhat.com>
Wed, 10 Feb 2016 20:55:51 +0000 (15:55 -0500)
committerSage Weil <sage@redhat.com>
Wed, 10 Feb 2016 20:55:51 +0000 (15:55 -0500)
Ignore what the file or block device IO Block is.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/config_opts.h
src/os/bluestore/KernelDevice.cc

index 04dafac42a855d26464f5ada5aa3c408bdbf8b4f..38ea9cb8d83d7042f2dca15c32f4620a5f2ca894 100644 (file)
@@ -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
index ae2d612ef41f73afbdafb962936b50d939e501a7..e697d893431d59809da9370a08884019623e6949 100644 (file)
@@ -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);