From 5dbd118ca5c7376ab392dc20ab51ea2f1c4c5e0c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 24 Mar 2017 11:23:01 -0400 Subject: [PATCH] os/bluestore/KernelDevice: set rotational flag for files too If we're backed by a file we can still tell whether the underlying device is rotational or not. Signed-off-by: Sage Weil --- src/os/bluestore/KernelDevice.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/os/bluestore/KernelDevice.cc b/src/os/bluestore/KernelDevice.cc index 3e03eedd5b6..3ae091ab4b3 100644 --- a/src/os/bluestore/KernelDevice.cc +++ b/src/os/bluestore/KernelDevice.cc @@ -115,7 +115,11 @@ int KernelDevice::open(const string& p) goto out_fail; } size = s; + } else { + size = st.st_size; + } + { char partition[1024], devname[1024]; r = get_device_by_fd(fd_buffered, partition, devname); if (r < 0) { @@ -123,11 +127,8 @@ int KernelDevice::open(const string& p) << cpp_strerror(r) << dendl; goto out_fail; } + dout(20) << __func__ << " devname " << devname << dendl; rotational = block_device_is_rotational(devname); - } else { - size = st.st_size; - //regular file is rotational device - rotational = true; } // Operate as though the block size is 4 KB. The backing file -- 2.39.5