// -*- 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() {
#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
@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.
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;
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;