]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
FileStore: avoid fiemap detection if explicitly disabled in config 3867/head
authorZhiqiang Wang <zhiqiang.wang@intel.com>
Fri, 6 Mar 2015 08:20:09 +0000 (16:20 +0800)
committerZhiqiang Wang <zhiqiang.wang@intel.com>
Fri, 6 Mar 2015 08:20:09 +0000 (16:20 +0800)
Signed-off-by: Zhiqiang Wang <zhiqiang.wang@intel.com>
src/os/GenericFileStoreBackend.cc

index ed035cd5c7561f034050101af23492b8fbd8f003..76a0fe460b4b6e3031bef4b34f4a24ca5c8f444f 100644 (file)
@@ -112,24 +112,25 @@ int GenericFileStoreBackend::detect_features()
   }
 
   // fiemap an extent inside that
-  struct fiemap *fiemap;
-  int r = do_fiemap(fd, 2430421, 59284, &fiemap);
-  if (r < 0) {
-    dout(0) << "detect_features: FIEMAP ioctl is NOT supported" << dendl;
+  if (!m_filestore_fiemap) {
+    dout(0) << "detect_features: FIEMAP ioctl is disabled via 'filestore fiemap' config option" << dendl;
     ioctl_fiemap = false;
   } else {
-    if (fiemap->fm_mapped_extents == 0) {
-      dout(0) << "detect_features: FIEMAP ioctl is supported, but buggy -- upgrade your kernel" << dendl;
+    struct fiemap *fiemap;
+    int r = do_fiemap(fd, 2430421, 59284, &fiemap);
+    if (r < 0) {
+      dout(0) << "detect_features: FIEMAP ioctl is NOT supported" << dendl;
       ioctl_fiemap = false;
     } else {
-      dout(0) << "detect_features: FIEMAP ioctl is supported and appears to work" << dendl;
-      ioctl_fiemap = true;
+      if (fiemap->fm_mapped_extents == 0) {
+        dout(0) << "detect_features: FIEMAP ioctl is supported, but buggy -- upgrade your kernel" << dendl;
+        ioctl_fiemap = false;
+      } else {
+        dout(0) << "detect_features: FIEMAP ioctl is supported and appears to work" << dendl;
+        ioctl_fiemap = true;
+      }
+      free(fiemap);
     }
-    free(fiemap);
-  }
-  if (!m_filestore_fiemap) {
-    dout(0) << "detect_features: FIEMAP ioctl is disabled via 'filestore fiemap' config option" << dendl;
-    ioctl_fiemap = false;
   }
 
   // SEEK_DATA/SEEK_HOLE detection
@@ -149,10 +150,9 @@ int GenericFileStoreBackend::detect_features()
         dout(0) << "detect_features: lseek SEEK_DATA/SEEK_HOLE is NOT supported" << dendl;
         seek_data_hole = false;
       } else {
-        r = -errno;
-        derr << "detect_features: failed to lseek " << fn << ": " << cpp_strerror(r) << dendl;
+        derr << "detect_features: failed to lseek " << fn << ": " << cpp_strerror(-errno) << dendl;
         VOID_TEMP_FAILURE_RETRY(::close(fd));
-        return r;
+        return -errno;
       }
     } else {
       dout(0) << "detect_features: lseek SEEK_DATA/SEEK_HOLE is supported" << dendl;