Skip to content

Commit

Permalink
librbd: add override in header files
Browse files Browse the repository at this point in the history
Fixes: http://tracker.ceph.com/issues/19012

Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
  • Loading branch information
liuchang0812 committed Feb 21, 2017
1 parent a4fcdb6 commit 15a7402
Show file tree
Hide file tree
Showing 72 changed files with 356 additions and 354 deletions.
4 changes: 2 additions & 2 deletions src/librbd/AsyncObjectThrottle.h
Expand Up @@ -33,7 +33,7 @@ class C_AsyncObjectThrottle : public Context {
protected:
ImageCtxT &m_image_ctx;

virtual void finish(int r) {
void finish(int r) override {
m_finisher.finish_op(r);
}

Expand All @@ -55,7 +55,7 @@ class AsyncObjectThrottle : public AsyncObjectThrottleFinisher {
uint64_t end_object_no);

void start_ops(uint64_t max_concurrent);
virtual void finish_op(int r);
void finish_op(int r) override;

private:
Mutex m_lock;
Expand Down
14 changes: 7 additions & 7 deletions src/librbd/ExclusiveLock.h
Expand Up @@ -29,13 +29,13 @@ class ExclusiveLock : public ManagedLock<ImageCtxT> {
void handle_peer_notification(int r);

protected:
virtual void shutdown_handler(int r, Context *on_finish);
virtual void pre_acquire_lock_handler(Context *on_finish);
virtual void post_acquire_lock_handler(int r, Context *on_finish);
virtual void pre_release_lock_handler(bool shutting_down,
Context *on_finish);
virtual void post_release_lock_handler(bool shutting_down, int r,
Context *on_finish);
void shutdown_handler(int r, Context *on_finish) override;
void pre_acquire_lock_handler(Context *on_finish) override;
void post_acquire_lock_handler(int r, Context *on_finish) override;
void pre_release_lock_handler(bool shutting_down,
Context *on_finish) override;
void post_release_lock_handler(bool shutting_down, int r,
Context *on_finish) override;

private:

Expand Down
20 changes: 10 additions & 10 deletions src/librbd/ImageWatcher.h
Expand Up @@ -32,7 +32,7 @@ class ImageWatcher : public Watcher {

public:
ImageWatcher(ImageCtxT& image_ctx);
virtual ~ImageWatcher();
~ImageWatcher() override;

void unregister_watch(Context *on_finish);

Expand Down Expand Up @@ -104,7 +104,7 @@ class ImageWatcher : public Watcher {
{
}

virtual int update_progress(uint64_t offset, uint64_t total) {
int update_progress(uint64_t offset, uint64_t total) override {
m_image_watcher.schedule_async_progress(m_async_request_id, offset,
total);
return 0;
Expand All @@ -125,11 +125,11 @@ class ImageWatcher : public Watcher {
{
}

virtual ~RemoteContext() {
~RemoteContext() override {
delete m_prog_ctx;
}

virtual void finish(int r);
void finish(int r) override;

private:
ImageWatcher &m_image_watcher;
Expand All @@ -149,7 +149,7 @@ class ImageWatcher : public Watcher {
payload(payload) {
}

virtual void finish(int r) override {
void finish(int r) override {
image_watcher->process_payload(notify_id, handle, payload, r);
}
};
Expand All @@ -159,7 +159,7 @@ class ImageWatcher : public Watcher {

C_ResponseMessage(watcher::C_NotifyAck *notify_ack) : notify_ack(notify_ack) {
}
virtual void finish(int r);
void finish(int r) override;
};

ImageCtxT &m_image_ctx;
Expand Down Expand Up @@ -245,10 +245,10 @@ class ImageWatcher : public Watcher {
void process_payload(uint64_t notify_id, uint64_t handle,
const watch_notify::Payload &payload, int r);

virtual void handle_notify(uint64_t notify_id, uint64_t handle,
uint64_t notifier_id, bufferlist &bl);
virtual void handle_error(uint64_t cookie, int err);
virtual void handle_rewatch_complete(int r);
void handle_notify(uint64_t notify_id, uint64_t handle,
uint64_t notifier_id, bufferlist &bl) override;
void handle_error(uint64_t cookie, int err) override;
void handle_rewatch_complete(int r) override;

void send_notify(const watch_notify::Payload& payload,
Context *ctx = nullptr);
Expand Down
16 changes: 8 additions & 8 deletions src/librbd/Journal.h
Expand Up @@ -221,7 +221,7 @@ class Journal {
: journal(_journal), tid(_tid) {
}

virtual void finish(int r) {
void finish(int r) override {
journal->handle_io_event_safe(r, tid);
}
};
Expand All @@ -239,7 +239,7 @@ class Journal {
op_finish_future(op_finish_future), on_safe(on_safe) {
}

virtual void finish(int r) {
void finish(int r) override {
journal->handle_op_event_safe(r, tid, op_start_future, op_finish_future,
on_safe);
}
Expand All @@ -252,7 +252,7 @@ class Journal {
C_ReplayProcessSafe(Journal *journal, ReplayEntry &&replay_entry) :
journal(journal), replay_entry(std::move(replay_entry)) {
}
virtual void finish(int r) {
void finish(int r) override {
journal->handle_replay_process_safe(replay_entry, r);
}
};
Expand All @@ -262,17 +262,17 @@ class Journal {
ReplayHandler(Journal *_journal) : journal(_journal) {
}

virtual void get() {
void get() override {
// TODO
}
virtual void put() {
void put() override {
// TODO
}

virtual void handle_entries_available() {
void handle_entries_available() override {
journal->handle_replay_ready();
}
virtual void handle_complete(int r) {
void handle_complete(int r) override {
journal->handle_replay_complete(r);
}
};
Expand Down Expand Up @@ -315,7 +315,7 @@ class Journal {

MetadataListener(Journal<ImageCtxT> *journal) : journal(journal) { }

void handle_update(::journal::JournalMetadata *) {
void handle_update(::journal::JournalMetadata *) override {
FunctionContext *ctx = new FunctionContext([this](int r) {
journal->handle_metadata_updated();
});
Expand Down
4 changes: 2 additions & 2 deletions src/librbd/LibrbdAdminSocketHook.h
Expand Up @@ -15,10 +15,10 @@ namespace librbd {
class LibrbdAdminSocketHook : public AdminSocketHook {
public:
LibrbdAdminSocketHook(ImageCtx *ictx);
~LibrbdAdminSocketHook();
~LibrbdAdminSocketHook() override;

bool call(std::string command, cmdmap_t& cmdmap, std::string format,
bufferlist& out);
bufferlist& out) override;

private:
typedef std::map<std::string,LibrbdAdminSocketCommand*> Commands;
Expand Down
32 changes: 16 additions & 16 deletions src/librbd/LibrbdWriteback.h
Expand Up @@ -21,36 +21,36 @@ namespace librbd {
LibrbdWriteback(ImageCtx *ictx, Mutex& lock);

// Note that oloc, trunc_size, and trunc_seq are ignored
virtual void read(const object_t& oid, uint64_t object_no,
const object_locator_t& oloc, uint64_t off, uint64_t len,
snapid_t snapid, bufferlist *pbl, uint64_t trunc_size,
__u32 trunc_seq, int op_flags, Context *onfinish);
void read(const object_t& oid, uint64_t object_no,
const object_locator_t& oloc, uint64_t off, uint64_t len,
snapid_t snapid, bufferlist *pbl, uint64_t trunc_size,
__u32 trunc_seq, int op_flags, Context *onfinish) override;

// Determine whether a read to this extent could be affected by a
// write-triggered copy-on-write
virtual bool may_copy_on_write(const object_t& oid, uint64_t read_off,
uint64_t read_len, snapid_t snapid);
bool may_copy_on_write(const object_t& oid, uint64_t read_off,
uint64_t read_len, snapid_t snapid) override;

// Note that oloc, trunc_size, and trunc_seq are ignored
virtual ceph_tid_t write(const object_t& oid, const object_locator_t& oloc,
uint64_t off, uint64_t len,
const SnapContext& snapc, const bufferlist &bl,
ceph::real_time mtime, uint64_t trunc_size,
__u32 trunc_seq, ceph_tid_t journal_tid,
Context *oncommit);
ceph_tid_t write(const object_t& oid, const object_locator_t& oloc,
uint64_t off, uint64_t len,
const SnapContext& snapc, const bufferlist &bl,
ceph::real_time mtime, uint64_t trunc_size,
__u32 trunc_seq, ceph_tid_t journal_tid,
Context *oncommit) override;
using WritebackHandler::write;

virtual void overwrite_extent(const object_t& oid, uint64_t off,
uint64_t len, ceph_tid_t original_journal_tid,
ceph_tid_t new_journal_tid);
void overwrite_extent(const object_t& oid, uint64_t off,
uint64_t len, ceph_tid_t original_journal_tid,
ceph_tid_t new_journal_tid) override;

struct write_result_d {
bool done;
int ret;
std::string oid;
Context *oncommit;
write_result_d(const std::string& oid, Context *oncommit) :
done(false), ret(0), oid(oid), oncommit(oncommit) {}
done(false), ret(0), oid(oid), oncommit(oncommit) {}
private:
write_result_d(const write_result_d& rhs);
const write_result_d& operator=(const write_result_d& rhs);
Expand Down
2 changes: 1 addition & 1 deletion src/librbd/ManagedLock.h
Expand Up @@ -199,7 +199,7 @@ class ManagedLock {
C_ShutDownRelease(ManagedLock *lock)
: lock(lock) {
}
virtual void finish(int r) override {
void finish(int r) override {
lock->send_shutdown_release();
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/librbd/MirroringWatcher.h
Expand Up @@ -58,8 +58,8 @@ class MirroringWatcher : public Watcher {
bool handle_payload(const mirroring_watcher::UnknownPayload &payload,
Context *on_notify_ack);

virtual void handle_notify(uint64_t notify_id, uint64_t handle,
uint64_t notifier_id, bufferlist &bl);
void handle_notify(uint64_t notify_id, uint64_t handle,
uint64_t notifier_id, bufferlist &bl) override;
};

} // namespace librbd
Expand Down
2 changes: 1 addition & 1 deletion src/librbd/TaskFinisher.h
Expand Up @@ -119,7 +119,7 @@ class TaskFinisher {
{
}
protected:
virtual void finish(int r) {
void finish(int r) override {
m_task_finisher->complete(m_task);
}
private:
Expand Down
8 changes: 4 additions & 4 deletions src/librbd/Utils.h
Expand Up @@ -50,7 +50,7 @@ class C_CallbackAdapter : public Context {
}

protected:
virtual void finish(int r) {
void finish(int r) override {
(obj->*MF)(r);
}
};
Expand All @@ -63,7 +63,7 @@ class C_StateCallbackAdapter : public Context {
}

protected:
virtual void complete(int r) override {
void complete(int r) override {
Context *on_finish = (obj->*MF)(&r);
if (on_finish != nullptr) {
on_finish->complete(r);
Expand All @@ -73,7 +73,7 @@ class C_StateCallbackAdapter : public Context {
}
Context::complete(r);
}
virtual void finish(int r) override {
void finish(int r) override {
}
};

Expand All @@ -85,7 +85,7 @@ struct C_AsyncCallback : public Context {
C_AsyncCallback(WQ *op_work_queue, Context *on_finish)
: op_work_queue(op_work_queue), on_finish(on_finish) {
}
virtual void finish(int r) {
void finish(int r) override {
op_work_queue->queue(on_finish, r);
}
};
Expand Down
12 changes: 6 additions & 6 deletions src/librbd/Watcher.h
Expand Up @@ -114,11 +114,11 @@ class Watcher {

WatchCtx(Watcher &parent) : watcher(parent) {}

virtual void handle_notify(uint64_t notify_id,
uint64_t handle,
uint64_t notifier_id,
bufferlist& bl);
virtual void handle_error(uint64_t handle, int err);
void handle_notify(uint64_t notify_id,
uint64_t handle,
uint64_t notifier_id,
bufferlist& bl) override;
void handle_error(uint64_t handle, int err) override;
};

struct C_RegisterWatch : public Context {
Expand All @@ -128,7 +128,7 @@ class Watcher {
C_RegisterWatch(Watcher *watcher, Context *on_finish)
: watcher(watcher), on_finish(on_finish) {
}
virtual void finish(int r) override {
void finish(int r) override {
watcher->handle_register_watch(r, on_finish);
}
};
Expand Down
22 changes: 11 additions & 11 deletions src/librbd/cache/PassthroughImageCache.h
Expand Up @@ -22,20 +22,20 @@ class PassthroughImageCache : public ImageCache {
PassthroughImageCache(ImageCtx &image_ctx);

/// client AIO methods
virtual void aio_read(Extents&& image_extents, ceph::bufferlist *bl,
int fadvise_flags, Context *on_finish);
virtual void aio_write(Extents&& image_extents, ceph::bufferlist&& bl,
int fadvise_flags, Context *on_finish);
virtual void aio_discard(uint64_t offset, uint64_t length,
Context *on_finish);
virtual void aio_flush(Context *on_finish);
void aio_read(Extents&& image_extents, ceph::bufferlist *bl,
int fadvise_flags, Context *on_finish) override;
void aio_write(Extents&& image_extents, ceph::bufferlist&& bl,
int fadvise_flags, Context *on_finish) override;
void aio_discard(uint64_t offset, uint64_t length,
Context *on_finish) override;
void aio_flush(Context *on_finish) override;

/// internal state methods
virtual void init(Context *on_finish);
virtual void shut_down(Context *on_finish);
void init(Context *on_finish) override;
void shut_down(Context *on_finish) override;

virtual void invalidate(Context *on_finish);
virtual void flush(Context *on_finish);
void invalidate(Context *on_finish) override;
void flush(Context *on_finish) override;

private:
ImageCtxT &m_image_ctx;
Expand Down
4 changes: 2 additions & 2 deletions src/librbd/exclusive_lock/AutomaticPolicy.h
Expand Up @@ -17,11 +17,11 @@ class AutomaticPolicy : public Policy {
AutomaticPolicy(ImageCtx *image_ctx) : m_image_ctx(image_ctx) {
}

virtual bool may_auto_request_lock() {
bool may_auto_request_lock() override {
return true;
}

virtual int lock_requested(bool force);
int lock_requested(bool force) override;

private:
ImageCtx *m_image_ctx;
Expand Down
4 changes: 2 additions & 2 deletions src/librbd/exclusive_lock/StandardPolicy.h
Expand Up @@ -17,11 +17,11 @@ class StandardPolicy : public Policy {
StandardPolicy(ImageCtx *image_ctx) : m_image_ctx(image_ctx) {
}

virtual bool may_auto_request_lock() {
bool may_auto_request_lock() override {
return false;
}

virtual int lock_requested(bool force);
int lock_requested(bool force) override;

private:
ImageCtx *m_image_ctx;
Expand Down
2 changes: 1 addition & 1 deletion src/librbd/internal.h
Expand Up @@ -61,7 +61,7 @@ namespace librbd {
NoOpProgressContext()
{
}
int update_progress(uint64_t offset, uint64_t src_size)
int update_progress(uint64_t offset, uint64_t src_size) override
{
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions src/librbd/io/AioCompletion.h
Expand Up @@ -212,8 +212,8 @@ class C_AioRequest : public Context {
C_AioRequest(AioCompletion *completion) : m_completion(completion) {
m_completion->add_request();
}
virtual ~C_AioRequest() {}
virtual void finish(int r) {
~C_AioRequest() override {}
void finish(int r) override {
m_completion->complete_request(r);
}
protected:
Expand Down

0 comments on commit 15a7402

Please sign in to comment.