From a9c5e9dd0e5743d0cc70e5f3d3ca296346d14776 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 28 Sep 2017 15:42:12 +0800 Subject: [PATCH] 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 --- src/os/filestore/FileStore.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 -- 2.39.5