]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/FileStore: using FIEMAP_FLAGS_SYNC instead of fsync() before call
authorJianpeng Ma <jianpeng.ma@intel.com>
Mon, 29 Sep 2014 03:00:25 +0000 (11:00 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Mon, 29 Sep 2014 03:11:56 +0000 (11:11 +0800)
fiemap.

When call fiemap, it need sync the file. Now it used fsync() to achieve
this. But for fiemap, there is a flag FIEMAP_FLAGS_SYNC which do the
same thing like fsync().

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/os/GenericFileStoreBackend.cc

index 56deeb21193d0f3a828557a197a698f5683ec705..5cf7f54d7d59daf2e3b346f2e42e2acf18232982 100644 (file)
@@ -221,8 +221,7 @@ int GenericFileStoreBackend::do_fiemap(int fd, off_t start, size_t len, struct f
 
   fiemap->fm_start = start;
   fiemap->fm_length = len;
-
-  fsync(fd); /* flush extents to disk if needed */
+  fiemap->fm_flags = FIEMAP_FLAG_SYNC; /* flush extents to disk if needed */
 
   if (ioctl(fd, FS_IOC_FIEMAP, fiemap) < 0) {
     ret = -errno;