]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/Readahead: Mutex -> ceph::mutex
authorSage Weil <sage@redhat.com>
Fri, 19 Oct 2018 13:47:53 +0000 (08:47 -0500)
committerKefu Chai <kchai@redhat.com>
Wed, 21 Nov 2018 03:56:33 +0000 (11:56 +0800)
Still need to kill C_SaferCond later.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/Readahead.cc
src/common/Readahead.h

index 51964fcd50e0a412cbca4eb8249141ba12386fdf..2d2b35ff781f2d4f0f933054462f24b9be9da004 100644 (file)
@@ -1,23 +1,21 @@
 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
 // vim: ts=8 sw=2 smarttab
 
-#include "Readahead.h"
-
+#include "common/Readahead.h"
+#include "common/Cond.h"
 
 Readahead::Readahead()
   : m_trigger_requests(10),
     m_readahead_min_bytes(0),
     m_readahead_max_bytes(NO_LIMIT),
     m_alignments(),
-    m_lock("Readahead::m_lock"),
     m_nr_consec_read(0),
     m_consec_read_bytes(0),
     m_last_pos(0),
     m_readahead_pos(0),
     m_readahead_trigger_pos(0),
     m_readahead_size(0),
-    m_pending(0),
-    m_pending_lock("Readahead::m_pending_lock") {
+    m_pending(0) {
 }
 
 Readahead::~Readahead() {
index 26b05b67a3823a2c679412c6143d1b5b5f069007..716e58cd3a271a837960704a364b431d29af28db 100644 (file)
@@ -4,9 +4,11 @@
 #ifndef CEPH_READAHEAD_H
 #define CEPH_READAHEAD_H
 
-#include "Mutex.h"
-#include "Cond.h"
 #include <list>
+#include <vector>
+
+#include "include/Context.h"
+#include "common/ceph_mutex.h"
 
 /**
    This class provides common state and logic for code that needs to perform readahead
@@ -39,7 +41,7 @@ public:
      @param extents read operations since last call to update
      @param limit size of the thing readahead is being applied to
    */
-  extent_t update(const vector<extent_t>& extents, uint64_t limit);
+  extent_t update(const std::vector<extent_t>& extents, uint64_t limit);
 
   /**
      Update state with a new read and return readahead to be performed.
@@ -132,7 +134,7 @@ private:
   std::vector<uint64_t> m_alignments;
 
   /// Held while reading/modifying any state except m_pending
-  Mutex m_lock;
+  ceph::mutex m_lock = ceph::make_mutex("Readahead::m_lock");
 
   /// Number of consecutive read requests in the current sequential stream
   int m_nr_consec_read;
@@ -156,7 +158,7 @@ private:
   int m_pending;
 
   /// Lock for m_pending
-  Mutex m_pending_lock;
+  ceph::mutex m_pending_lock = ceph::make_mutex("Readahead::m_pending_lock");
 
   /// Waiters for pending readahead
   std::list<Context *> m_pending_waiting;