]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/BlueStore: Simplifying default return value
authorErwan Velu <erwan@redhat.com>
Tue, 12 Jan 2016 10:12:38 +0000 (11:12 +0100)
committerErwan Velu <erwan@redhat.com>
Tue, 19 Jan 2016 10:05:22 +0000 (11:05 +0100)
r variable wasn't initialized but set to 0 twice. Once just before an early
"goto out" code and the other before the main code of the function.

This patch simply initialize r to 0 at the begining.
This make the code easier to read and prevent any future call to "out" label without a proper value stored in r.

Signed-off-by: Erwan Velu <erwan@redhat.com>
src/os/bluestore/BlueStore.cc

index 304a02ac936d9380526f5952f8f82794a18a8257..52e6afddb7173a4c5d9a4acbe7076719506e86fc 100644 (file)
@@ -2411,7 +2411,7 @@ int BlueStore::_do_read(
   map<uint64_t,bluestore_extent_t>::iterator bp, bend;
   map<uint64_t,bluestore_overlay_t>::iterator op, oend;
   uint64_t block_size = bdev->get_block_size();
-  int r;
+  int r = 0;
   IOContext ioc(NULL);   // FIXME?
 
   // generally, don't buffer anything, unless the client explicitly requests
@@ -2433,7 +2433,6 @@ int BlueStore::_do_read(
   _dump_onode(o);
 
   if (offset > o->onode.size) {
-    r = 0;
     goto out;
   }
 
@@ -2443,8 +2442,6 @@ int BlueStore::_do_read(
 
   o->flush();
 
-  r = 0;
-
   // loop over overlays and data fragments.  overlays take precedence.
   bend = o->onode.block_map.end();
   bp = o->onode.block_map.lower_bound(offset);