]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
bench/dumb_backend.cc: check return value of posix_fadvise()
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Tue, 28 May 2013 12:26:29 +0000 (14:26 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 31 May 2013 17:15:22 +0000 (19:15 +0200)
CID 743396 (#1 of 1): Unchecked return value from library (CHECKED_RETURN)
  check_return: Calling function "posix_fadvise(fd, offset, bl->length(), 4)"
   without checking return value. This library function may fail and return
   an error code.
  unchecked_value: No check of the return value of
   "posix_fadvise(fd, offset, bl->length(), 4)".

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/test/bench/dumb_backend.cc

index a763c45f0c89fd5884bf615fa2a35d620e899212..170fee7fab6a50b7e5c65da81ab70e0890e0bb2f 100644 (file)
@@ -30,9 +30,12 @@ void DumbBackend::_write(
   if (do_sync_file_range)
     ::sync_file_range(fd, offset, bl.length(),
                      SYNC_FILE_RANGE_WAIT_AFTER);
-  if (do_fadvise)
-    ::posix_fadvise(fd, offset, bl.length(),
-                   POSIX_FADV_DONTNEED);
+  if (do_fadvise) {
+    int fa_r = posix_fadvise(fd, offset, bl.length(), POSIX_FADV_DONTNEED);
+    if (fa_r) {
+        std::cout << "posix_fadvise failed, errno is: " << fa_r << std::endl;
+    }
+  }
   ::close(fd);
   {
     Mutex::Locker l(pending_commit_mutex);