From 4692257cefa252176e1f1bdc0df553da52097b0f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 10 Jul 2014 07:01:44 -0700 Subject: [PATCH] nuke dlist No users. Signed-off-by: Sage Weil --- src/include/Makefile.am | 1 - src/include/dlist.h | 127 ---------------------------------------- src/mds/CInode.h | 3 +- src/mds/LogSegment.h | 1 - 4 files changed, 1 insertion(+), 131 deletions(-) delete mode 100644 src/include/dlist.h diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 6dacd4a2dc478..7fa1e18b96f6f 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -70,7 +70,6 @@ noinst_HEADERS += \ include/triple.h \ include/types.h \ include/utime.h \ - include/dlist.h \ include/elist.h \ include/uuid.h \ include/xlist.h \ diff --git a/src/include/dlist.h b/src/include/dlist.h deleted file mode 100644 index 09eb0bc151241..0000000000000 --- a/src/include/dlist.h +++ /dev/null @@ -1,127 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab -/* - * Ceph - scalable distributed file system - * - * Copyright (C) 2004-2006 Sage Weil - * - * This is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software - * Foundation. See file COPYING. - * - */ - -#ifndef CEPH_DLIST_H -#define CEPH_DLIST_H - -template -class dlist { -public: - struct item { - T _item; - item *_prev, *_next; - - item(T i) : _item(i), _prev(this), _next(this) {} - ~item() { - assert(!is_on_list()); - } - - // no copying! - item(const item& other); - const item& operator= (const item& right); - - - bool empty() const { return _prev == this; } - bool is_on_list() const { return !empty(); } - - bool remove_myself() { - if (_next == this) { - assert(_prev == this); - return false; - } - _next->_prev = _prev; - _prev->_next = _next; - _prev = _next = this; - return true; - } - - void insert_after(item *other) { - assert(other->empty()); - other->_prev = this; - other->_next = _next; - _next->_prev = other; - _next = other; - } - void insert_before(item *other) { - assert(other->empty()); - other->_next = this; - other->_prev = _prev; - _prev->_next = other; - _prev = other; - } - }; - -private: - item _head; - -public: - dlist(const dlist& other); - const dlist& operator=(const dlist& other); - - dlist() : _head(NULL) {} - ~dlist() { - assert(_head.empty()); - } - - bool empty() { - return _head.empty(); - } - - void clear() { - while (!_head.empty()) - remove(front()); - } - - void push_front(item *i) { - if (!i->empty()) - i->remove_myself(); - _head.insert_after(i); - } - void push_back(item *i) { - if (!i->empty()) - i->remove_myself(); - _head.insert_before(i); - } - - T front() { return (T)_head._next->_item; } - T back() { return (T)_head._prev->_item; } - - void pop_front() { - assert(!empty()); - _head._next->remove_myself(); - } - void pop_back() { - assert(!empty()); - _head._prev->remove_myself(); - } - - class iterator { - private: - item *cur; - public: - iterator(item *i = 0) : cur(i) {} - T operator*() { return (T)cur->_item; } - iterator& operator++() { - assert(cur); - cur = cur->_next; - return *this; - } - bool end() { return cur->_item == 0; } - }; - - iterator begin() { return iterator(_head._next); } -}; - - -#endif diff --git a/src/mds/CInode.h b/src/mds/CInode.h index 697e603dfc4c2..77e22c3735da4 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -18,7 +18,6 @@ #define CEPH_CINODE_H #include "common/config.h" -#include "include/dlist.h" #include "include/elist.h" #include "include/types.h" #include "include/lru.h" @@ -417,7 +416,7 @@ protected: flock_locks.clear(); } - // LogSegment dlists i (may) belong to + // LogSegment lists i (may) belong to public: elist::item item_dirty; elist::item item_caps; diff --git a/src/mds/LogSegment.h b/src/mds/LogSegment.h index 1df103b0514c6..a141855fdd1c5 100644 --- a/src/mds/LogSegment.h +++ b/src/mds/LogSegment.h @@ -15,7 +15,6 @@ #ifndef CEPH_LOGSEGMENT_H #define CEPH_LOGSEGMENT_H -#include "include/dlist.h" #include "include/elist.h" #include "include/interval_set.h" #include "include/Context.h" -- 2.39.5