From ca2f2b104eb147ddceae3409eb0f0c5beeb2138d Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Sat, 20 Feb 2016 16:13:02 +0800 Subject: [PATCH] os/filestore: fast exit if we fail to load exomap MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/os/filestore/FileStore.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- 2.47.3