From: xie xingguo Date: Sat, 20 Feb 2016 08:13:02 +0000 (+0800) Subject: os/filestore: fast exit if we fail to load exomap X-Git-Tag: v10.1.0~41^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ca2f2b104eb147ddceae3409eb0f0c5beeb2138d;p=ceph.git os/filestore: fast exit if we fail to load exomap 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 --- diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index fee71bf5b75..99f15967681 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -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::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);