]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/filestore: fast exit if we fail to load exomap
authorxie xingguo <xie.xingguo@zte.com.cn>
Sat, 20 Feb 2016 08:13:02 +0000 (16:13 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 15 Mar 2016 13:56:54 +0000 (21:56 +0800)
Also move the definition of 'written' ahead to make
old-compiler happy. In my local testbed, it keeps
complaining "crosses initialization of ‘int64_t written’"
accompanying with this change.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/filestore/FileStore.cc

index fee71bf5b753c210b4d408bf7c773c9219774c8a..99f15967681c19a8b7db67d575c6c6b285e5180d 100644 (file)
@@ -3385,7 +3385,11 @@ int FileStore::_do_sparse_copy_range(int from, int to, uint64_t srcoff, uint64_t
     r = _do_fiemap(from, srcoff, len, &exomap);
   }
 
-  int64_t written = 0;
+ int64_t written = 0;
+ if (r < 0)
+    goto out;
+
   for (map<uint64_t, uint64_t>::iterator miter = exomap.begin(); miter != exomap.end(); ++miter) {
     uint64_t it_off = miter->first - srcoff + dstoff;
     r = _do_copy_range(from, to, miter->first, miter->second, it_off, true);