From: Kefu Chai Date: Thu, 28 Sep 2017 07:42:12 +0000 (+0800) Subject: os/filestore: do not set never read variable X-Git-Tag: v13.0.1~733^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a9c5e9dd0e5743d0cc70e5f3d3ca296346d14776;p=ceph.git os/filestore: do not set never read variable do not set "omap_fsid_fd" to -1 after ::close() it. also move it's definition to where it is use for the first time for better readability. this silences the clang analyzer warning of: Value stored to 'omap_fsid_fd' is never read Signed-off-by: Kefu Chai --- diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index cbbce6b01eb..ed76406f810 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -1656,7 +1656,6 @@ int FileStore::mount() // check fsid with omap // get omap fsid - int omap_fsid_fd; char omap_fsid_buf[PATH_MAX]; struct ::stat omap_fsid_stat; snprintf(omap_fsid_buf, sizeof(omap_fsid_buf), "%s/osd_uuid", omap_dir.c_str()); @@ -1665,7 +1664,8 @@ int FileStore::mount() dout(10) << __FUNC__ << ": osd_uuid not found under omap, " << "assume as matched." << dendl; - }else{ + } else { + int omap_fsid_fd; // if osd_uuid exists, compares osd_uuid with fsid omap_fsid_fd = ::open(omap_fsid_buf, O_RDONLY, 0644); if (omap_fsid_fd < 0) { @@ -1677,7 +1677,6 @@ int FileStore::mount() } ret = read_fsid(omap_fsid_fd, &omap_fsid); VOID_TEMP_FAILURE_RETRY(::close(omap_fsid_fd)); - omap_fsid_fd = -1; // defensive if (ret < 0) { derr << __FUNC__ << ": error reading omap_fsid_fd" << ", omap_fsid = " << omap_fsid