]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore/KernelDevice: set rotational flag for files too
authorSage Weil <sage@redhat.com>
Fri, 24 Mar 2017 15:23:01 +0000 (11:23 -0400)
committerSage Weil <sage@redhat.com>
Wed, 29 Mar 2017 17:24:58 +0000 (13:24 -0400)
If we're backed by a file we can still tell whether the
underlying device is rotational or not.

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

index 3e03eedd5b693be9e86ef77efc0d29b0fc3948e9..3ae091ab4b33c9244f22b92a513691ffb5b50dbd 100644 (file)
@@ -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