Skip to content

Commit

Permalink
osd: Pass coll_t by reference
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeniy Firsov <evgeniy.firsov@sandisk.com>

Conflicts:
	src/os/ObjectStore.h
	src/os/bluestore/BlueStore.cc
	src/os/bluestore/BlueStore.h
	src/os/memstore/MemStore.h
  • Loading branch information
Evgeniy Firsov committed Jan 27, 2016
1 parent 7e0a7a3 commit 18fe93c
Show file tree
Hide file tree
Showing 10 changed files with 336 additions and 330 deletions.
92 changes: 46 additions & 46 deletions src/os/ObjectStore.h

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions src/os/bluestore/BlueStore.cc
Expand Up @@ -2282,7 +2282,7 @@ int BlueStore::statfs(struct statfs *buf)
// ---------------
// cache

BlueStore::CollectionRef BlueStore::_get_collection(coll_t cid)
BlueStore::CollectionRef BlueStore::_get_collection(const coll_t& cid)
{
RWLock::RLocker l(coll_lock);
ceph::unordered_map<coll_t,CollectionRef>::iterator cp = coll_map.find(cid);
Expand Down Expand Up @@ -2337,7 +2337,7 @@ ObjectStore::CollectionHandle BlueStore::open_collection(const coll_t& cid)
return _get_collection(cid);
}

bool BlueStore::exists(coll_t cid, const ghobject_t& oid)
bool BlueStore::exists(const coll_t& cid, const ghobject_t& oid)
{
CollectionHandle c = _get_collection(cid);
if (!c)
Expand All @@ -2359,7 +2359,7 @@ bool BlueStore::exists(CollectionHandle &c_, const ghobject_t& oid)
}

int BlueStore::stat(
coll_t cid,
const coll_t& cid,
const ghobject_t& oid,
struct stat *st,
bool allow_eio)
Expand Down Expand Up @@ -2392,7 +2392,7 @@ int BlueStore::stat(
}

int BlueStore::read(
coll_t cid,
const coll_t& cid,
const ghobject_t& oid,
uint64_t offset,
size_t length,
Expand Down Expand Up @@ -2595,7 +2595,7 @@ int BlueStore::_do_read(
}

int BlueStore::fiemap(
coll_t cid,
const coll_t& cid,
const ghobject_t& oid,
uint64_t offset,
size_t len,
Expand Down Expand Up @@ -2709,7 +2709,7 @@ int BlueStore::fiemap(
}

int BlueStore::getattr(
coll_t cid,
const coll_t& cid,
const ghobject_t& oid,
const char *name,
bufferptr& value)
Expand Down Expand Up @@ -2754,7 +2754,7 @@ int BlueStore::getattr(


int BlueStore::getattrs(
coll_t cid,
const coll_t& cid,
const ghobject_t& oid,
map<string,bufferptr>& aset)
{
Expand Down Expand Up @@ -2799,13 +2799,13 @@ int BlueStore::list_collections(vector<coll_t>& ls)
return 0;
}

bool BlueStore::collection_exists(coll_t c)
bool BlueStore::collection_exists(const coll_t& c)
{
RWLock::RLocker l(coll_lock);
return coll_map.count(c);
}

bool BlueStore::collection_empty(coll_t cid)
bool BlueStore::collection_empty(const coll_t& cid)
{
dout(15) << __func__ << " " << cid << dendl;
vector<ghobject_t> ls;
Expand All @@ -2819,7 +2819,7 @@ bool BlueStore::collection_empty(coll_t cid)
return empty;
}

int BlueStore::collection_bits(coll_t cid)
int BlueStore::collection_bits(const coll_t& cid)
{
dout(15) << __func__ << " " << cid << dendl;
CollectionRef c = _get_collection(cid);
Expand All @@ -2831,7 +2831,7 @@ int BlueStore::collection_bits(coll_t cid)
}

int BlueStore::collection_list(
coll_t cid, ghobject_t start, ghobject_t end,
const coll_t& cid, ghobject_t start, ghobject_t end,
bool sort_bitwise, int max,
vector<ghobject_t> *ls, ghobject_t *pnext)
{
Expand Down Expand Up @@ -3053,7 +3053,7 @@ bufferlist BlueStore::OmapIteratorImpl::value()
}

int BlueStore::omap_get(
coll_t cid, ///< [in] Collection containing oid
const coll_t& cid, ///< [in] Collection containing oid
const ghobject_t &oid, ///< [in] Object containing omap
bufferlist *header, ///< [out] omap header
map<string, bufferlist> *out /// < [out] Key to value map
Expand Down Expand Up @@ -3117,7 +3117,7 @@ int BlueStore::omap_get(
}

int BlueStore::omap_get_header(
coll_t cid, ///< [in] Collection containing oid
const coll_t& cid, ///< [in] Collection containing oid
const ghobject_t &oid, ///< [in] Object containing omap
bufferlist *header, ///< [out] omap header
bool allow_eio ///< [in] don't assert on eio
Expand Down Expand Up @@ -3166,7 +3166,7 @@ int BlueStore::omap_get_header(
}

int BlueStore::omap_get_keys(
coll_t cid, ///< [in] Collection containing oid
const coll_t& cid, ///< [in] Collection containing oid
const ghobject_t &oid, ///< [in] Object containing omap
set<string> *keys ///< [out] Keys defined on oid
)
Expand Down Expand Up @@ -3224,7 +3224,7 @@ int BlueStore::omap_get_keys(
}

int BlueStore::omap_get_values(
coll_t cid, ///< [in] Collection containing oid
const coll_t& cid, ///< [in] Collection containing oid
const ghobject_t &oid, ///< [in] Object containing omap
const set<string> &keys, ///< [in] Keys to get
map<string, bufferlist> *out ///< [out] Returned keys and values
Expand Down Expand Up @@ -3274,7 +3274,7 @@ int BlueStore::omap_get_values(
}

int BlueStore::omap_check_keys(
coll_t cid, ///< [in] Collection containing oid
const coll_t& cid, ///< [in] Collection containing oid
const ghobject_t &oid, ///< [in] Object containing omap
const set<string> &keys, ///< [in] Keys to check
set<string> *out ///< [out] Subset of keys defined on oid
Expand Down Expand Up @@ -3327,7 +3327,7 @@ int BlueStore::omap_check_keys(
}

ObjectMap::ObjectMapIterator BlueStore::get_omap_iterator(
coll_t cid, ///< [in] collection
const coll_t& cid, ///< [in] collection
const ghobject_t &oid ///< [in] object
)
{
Expand Down
34 changes: 17 additions & 17 deletions src/os/bluestore/BlueStore.h
Expand Up @@ -539,7 +539,7 @@ class BlueStore : public ObjectStore {
KeyValueDB::Transaction t);
void _commit_bluefs_freespace(const vector<bluestore_extent_t>& extents);

CollectionRef _get_collection(coll_t cid);
CollectionRef _get_collection(const coll_t& cid);
void _queue_reap_collection(CollectionRef& c);
void _reap_collections();

Expand Down Expand Up @@ -624,10 +624,10 @@ class BlueStore : public ObjectStore {
public:
int statfs(struct statfs *buf);

bool exists(coll_t cid, const ghobject_t& oid);
bool exists(const coll_t& cid, const ghobject_t& oid);
bool exists(CollectionHandle &c, const ghobject_t& oid);
int stat(
coll_t cid,
const coll_t& cid,
const ghobject_t& oid,
struct stat *st,
bool allow_eio = false) override;
Expand All @@ -637,7 +637,7 @@ class BlueStore : public ObjectStore {
struct stat *st,
bool allow_eio = false) override;
int read(
coll_t cid,
const coll_t& cid,
const ghobject_t& oid,
uint64_t offset,
size_t len,
Expand All @@ -659,17 +659,17 @@ class BlueStore : public ObjectStore {
bufferlist& bl,
uint32_t op_flags = 0);

int fiemap(coll_t cid, const ghobject_t& oid,
int fiemap(const coll_t& cid, const ghobject_t& oid,
uint64_t offset, size_t len, bufferlist& bl) override;
int fiemap(CollectionHandle &c, const ghobject_t& oid,
uint64_t offset, size_t len, bufferlist& bl) override;

int getattr(coll_t cid, const ghobject_t& oid, const char *name,
int getattr(const coll_t& cid, const ghobject_t& oid, const char *name,
bufferptr& value) override;
int getattr(CollectionHandle &c, const ghobject_t& oid, const char *name,
bufferptr& value) override;

int getattrs(coll_t cid, const ghobject_t& oid,
int getattrs(const coll_t& cid, const ghobject_t& oid,
map<string,bufferptr>& aset) override;
int getattrs(CollectionHandle &c, const ghobject_t& oid,
map<string,bufferptr>& aset) override;
Expand All @@ -678,19 +678,19 @@ class BlueStore : public ObjectStore {

CollectionHandle open_collection(const coll_t &c) override;

bool collection_exists(coll_t c);
bool collection_empty(coll_t c);
int collection_bits(coll_t c);
bool collection_exists(const coll_t& c);
bool collection_empty(const coll_t& c);
int collection_bits(const coll_t& c);

int collection_list(coll_t cid, ghobject_t start, ghobject_t end,
int collection_list(const coll_t& cid, ghobject_t start, ghobject_t end,
bool sort_bitwise, int max,
vector<ghobject_t> *ls, ghobject_t *next) override;
int collection_list(CollectionHandle &c, ghobject_t start, ghobject_t end,
bool sort_bitwise, int max,
vector<ghobject_t> *ls, ghobject_t *next) override;

int omap_get(
coll_t cid, ///< [in] Collection containing oid
const coll_t& cid, ///< [in] Collection containing oid
const ghobject_t &oid, ///< [in] Object containing omap
bufferlist *header, ///< [out] omap header
map<string, bufferlist> *out /// < [out] Key to value map
Expand All @@ -704,7 +704,7 @@ class BlueStore : public ObjectStore {

/// Get omap header
int omap_get_header(
coll_t cid, ///< [in] Collection containing oid
const coll_t& cid, ///< [in] Collection containing oid
const ghobject_t &oid, ///< [in] Object containing omap
bufferlist *header, ///< [out] omap header
bool allow_eio = false ///< [in] don't assert on eio
Expand All @@ -718,7 +718,7 @@ class BlueStore : public ObjectStore {

/// Get keys defined on oid
int omap_get_keys(
coll_t cid, ///< [in] Collection containing oid
const coll_t& cid, ///< [in] Collection containing oid
const ghobject_t &oid, ///< [in] Object containing omap
set<string> *keys ///< [out] Keys defined on oid
) override;
Expand All @@ -730,7 +730,7 @@ class BlueStore : public ObjectStore {

/// Get key values
int omap_get_values(
coll_t cid, ///< [in] Collection containing oid
const coll_t& cid, ///< [in] Collection containing oid
const ghobject_t &oid, ///< [in] Object containing omap
const set<string> &keys, ///< [in] Keys to get
map<string, bufferlist> *out ///< [out] Returned keys and values
Expand All @@ -744,7 +744,7 @@ class BlueStore : public ObjectStore {

/// Filters keys into out which are defined on oid
int omap_check_keys(
coll_t cid, ///< [in] Collection containing oid
const coll_t& cid, ///< [in] Collection containing oid
const ghobject_t &oid, ///< [in] Object containing omap
const set<string> &keys, ///< [in] Keys to check
set<string> *out ///< [out] Subset of keys defined on oid
Expand All @@ -757,7 +757,7 @@ class BlueStore : public ObjectStore {
) override;

ObjectMap::ObjectMapIterator get_omap_iterator(
coll_t cid, ///< [in] collection
const coll_t& cid, ///< [in] collection
const ghobject_t &oid ///< [in] object
) override;
ObjectMap::ObjectMapIterator get_omap_iterator(
Expand Down
8 changes: 4 additions & 4 deletions src/os/filestore/CollectionIndex.h
Expand Up @@ -57,14 +57,14 @@ class CollectionIndex {
/// Debugging Constructor
Path(
string path, ///< [in] Path to return.
coll_t coll) ///< [in] collection
const coll_t& coll) ///< [in] collection
: full_path(path), parent_coll(coll) {}

/// Getter for the stored path.
const char *path() const { return full_path.c_str(); }

/// Getter for collection
coll_t coll() const { return parent_coll; }
const coll_t& coll() const { return parent_coll; }

/// Getter for parent
CollectionIndex* get_index() const {
Expand All @@ -78,7 +78,7 @@ class CollectionIndex {
/// Type of returned paths
typedef ceph::shared_ptr<Path> IndexedPath;

static IndexedPath get_testing_path(string path, coll_t collection) {
static IndexedPath get_testing_path(string path, const coll_t& collection) {
return IndexedPath(new Path(path, collection));
}

Expand Down Expand Up @@ -176,7 +176,7 @@ class CollectionIndex {
/// Call prior to removing directory
virtual int prep_delete() { return 0; }

CollectionIndex(coll_t collection):
CollectionIndex(const coll_t& collection):
access_lock_name ("CollectionIndex::access_lock::" + collection.to_str()),
access_lock(access_lock_name.c_str()) {}

Expand Down

0 comments on commit 18fe93c

Please sign in to comment.