* Ensure the existance of an object in a collection. Create an
* empty object if necessary
*/
- void touch(coll_t cid, const ghobject_t& oid) {
+ void touch(const coll_t& cid, const ghobject_t& oid) {
if (use_tbl) {
__u32 op = OP_TOUCH;
::encode(op, tbl);
* ObjectStore will omit the untouched data and store it as a
* "hole" in the file.
*/
- void write(coll_t cid, const ghobject_t& oid, uint64_t off, uint64_t len,
+ void write(const coll_t& cid, const ghobject_t& oid, uint64_t off, uint64_t len,
const bufferlist& write_data, uint32_t flags = 0) {
if (use_tbl) {
__u32 op = OP_WRITE;
* ObjectStore instances may optimize this to release the
* underlying storage space.
*/
- void zero(coll_t cid, const ghobject_t& oid, uint64_t off, uint64_t len) {
+ void zero(const coll_t& cid, const ghobject_t& oid, uint64_t off, uint64_t len) {
if (use_tbl) {
__u32 op = OP_ZERO;
::encode(op, tbl);
data.ops++;
}
/// Discard all data in the object beyond the specified size.
- void truncate(coll_t cid, const ghobject_t& oid, uint64_t off) {
+ void truncate(const coll_t& cid, const ghobject_t& oid, uint64_t off) {
if (use_tbl) {
__u32 op = OP_TRUNCATE;
::encode(op, tbl);
data.ops++;
}
/// Remove an object. All four parts of the object are removed.
- void remove(coll_t cid, const ghobject_t& oid) {
+ void remove(const coll_t& cid, const ghobject_t& oid) {
if (use_tbl) {
__u32 op = OP_REMOVE;
::encode(op, tbl);
data.ops++;
}
/// Set an xattr of an object
- void setattr(coll_t cid, const ghobject_t& oid, const char* name, bufferlist& val) {
+ void setattr(const coll_t& cid, const ghobject_t& oid, const char* name, bufferlist& val) {
string n(name);
setattr(cid, oid, n, val);
}
/// Set an xattr of an object
- void setattr(coll_t cid, const ghobject_t& oid, const string& s, bufferlist& val) {
+ void setattr(const coll_t& cid, const ghobject_t& oid, const string& s, bufferlist& val) {
if (use_tbl) {
__u32 op = OP_SETATTR;
::encode(op, tbl);
data.ops++;
}
/// Set multiple xattrs of an object
- void setattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& attrset) {
+ void setattrs(const coll_t& cid, const ghobject_t& oid, map<string,bufferptr>& attrset) {
if (use_tbl) {
__u32 op = OP_SETATTRS;
::encode(op, tbl);
data.ops++;
}
/// Set multiple xattrs of an object
- void setattrs(coll_t cid, const ghobject_t& oid, map<string,bufferlist>& attrset) {
+ void setattrs(const coll_t& cid, const ghobject_t& oid, map<string,bufferlist>& attrset) {
if (use_tbl) {
__u32 op = OP_SETATTRS;
::encode(op, tbl);
data.ops++;
}
/// remove an xattr from an object
- void rmattr(coll_t cid, const ghobject_t& oid, const char *name) {
+ void rmattr(const coll_t& cid, const ghobject_t& oid, const char *name) {
string n(name);
rmattr(cid, oid, n);
}
/// remove an xattr from an object
- void rmattr(coll_t cid, const ghobject_t& oid, const string& s) {
+ void rmattr(const coll_t& cid, const ghobject_t& oid, const string& s) {
if (use_tbl) {
__u32 op = OP_RMATTR;
::encode(op, tbl);
data.ops++;
}
/// remove all xattrs from an object
- void rmattrs(coll_t cid, const ghobject_t& oid) {
+ void rmattrs(const coll_t& cid, const ghobject_t& oid) {
if (use_tbl) {
__u32 op = OP_RMATTRS;
::encode(op, tbl);
* The destination named object may already exist, in
* which case its previous contents are discarded.
*/
- void clone(coll_t cid, const ghobject_t& oid, ghobject_t noid) {
+ void clone(const coll_t& cid, const ghobject_t& oid, ghobject_t noid) {
if (use_tbl) {
__u32 op = OP_CLONE;
::encode(op, tbl);
* portion of the data from the source object. None of the other
* three parts of an object is copied from the source.
*/
- void clone_range(coll_t cid, const ghobject_t& oid, ghobject_t noid,
+ void clone_range(const coll_t& cid, const ghobject_t& oid, ghobject_t noid,
uint64_t srcoff, uint64_t srclen, uint64_t dstoff) {
if (use_tbl) {
__u32 op = OP_CLONERANGE2;
data.ops++;
}
/// Create the collection
- void create_collection(coll_t cid, int bits) {
+ void create_collection(const coll_t& cid, int bits) {
if (use_tbl) {
__u32 op = OP_MKCOLL;
::encode(op, tbl);
* @param hint - the hint payload, which contains the customized
* data along with the hint type.
*/
- void collection_hint(coll_t cid, uint32_t type, const bufferlist& hint) {
+ void collection_hint(const coll_t& cid, uint32_t type, const bufferlist& hint) {
if (use_tbl) {
__u32 op = OP_COLL_HINT;
::encode(op, tbl);
}
/// remove the collection, the collection must be empty
- void remove_collection(coll_t cid) {
+ void remove_collection(const coll_t& cid) {
if (use_tbl) {
__u32 op = OP_RMCOLL;
::encode(op, tbl);
}
data.ops++;
}
- void collection_move(coll_t cid, coll_t oldcid, const ghobject_t& oid)
+ void collection_move(const coll_t& cid, coll_t oldcid, const ghobject_t& oid)
__attribute__ ((deprecated)) {
// NOTE: we encode this as a fixed combo of ADD + REMOVE. they
// always appear together, so this is effectively a single MOVE.
}
data.ops++;
}
- void collection_move_rename(coll_t oldcid, const ghobject_t& oldoid,
+ void collection_move_rename(const coll_t& oldcid, const ghobject_t& oldoid,
coll_t cid, const ghobject_t& oid) {
if (use_tbl) {
__u32 op = OP_COLL_MOVE_RENAME;
// backends need not implement these at all.
/// Set an xattr on a collection
- void collection_setattr(coll_t cid, const string& name, bufferlist& val)
+ void collection_setattr(const coll_t& cid, const string& name, bufferlist& val)
__attribute__ ((deprecated)) {
if (use_tbl) {
__u32 op = OP_COLL_SETATTR;
}
/// Remove an xattr from a collection
- void collection_rmattr(coll_t cid, const string& name)
+ void collection_rmattr(const coll_t& cid, const string& name)
__attribute__ ((deprecated)) {
if (use_tbl) {
__u32 op = OP_COLL_RMATTR;
data.ops++;
}
/// Set multiple xattrs on a collection
- void collection_setattrs(coll_t cid, map<string,bufferptr>& aset)
+ void collection_setattrs(const coll_t& cid, map<string,bufferptr>& aset)
__attribute__ ((deprecated)) {
if (use_tbl) {
__u32 op = OP_COLL_SETATTRS;
data.ops++;
}
/// Set multiple xattrs on a collection
- void collection_setattrs(coll_t cid, map<string,bufferlist>& aset)
+ void collection_setattrs(const coll_t& cid, map<string,bufferlist>& aset)
__attribute__ ((deprecated)) {
if (use_tbl) {
__u32 op = OP_COLL_SETATTRS;
}
/// Set keys on oid omap. Replaces duplicate keys.
void omap_setkeys(
- coll_t cid, ///< [in] Collection containing oid
+ const coll_t& cid, ///< [in] Collection containing oid
const ghobject_t &oid, ///< [in] Object to update
const map<string, bufferlist> &attrset ///< [in] Replacement keys and values
) {
* @param oid oid of object
* @returns true if object exists, false otherwise
*/
- virtual bool exists(coll_t cid, const ghobject_t& oid) = 0; // useful?
+ virtual bool exists(const coll_t& cid, const ghobject_t& oid) = 0; // useful?
virtual bool exists(CollectionHandle& c, const ghobject_t& oid) {
return exists(c->get_cid(), oid);
}
* @returns 0 on success, negative error code on failure.
*/
virtual int stat(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
struct stat *st,
bool allow_eio = false) = 0; // struct stat?
* @returns number of bytes read on success, or negative error code on failure.
*/
virtual int read(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
uint64_t offset,
size_t len,
* @param bl output bufferlist for extent map information.
* @returns 0 on success, negative error code on failure.
*/
- virtual int fiemap(coll_t cid, const ghobject_t& oid,
+ virtual int fiemap(const coll_t& cid, const ghobject_t& oid,
uint64_t offset, size_t len, bufferlist& bl) = 0;
virtual int fiemap(CollectionHandle& c, const ghobject_t& oid,
uint64_t offset, size_t len, bufferlist& bl) {
* @param value place to put output result.
* @returns 0 on success, negative error code on failure.
*/
- virtual int getattr(coll_t cid, const ghobject_t& oid,
+ virtual int getattr(const coll_t& cid, const ghobject_t& oid,
const char *name, bufferptr& value) = 0;
virtual int getattr(CollectionHandle &c, const ghobject_t& oid,
const char *name, bufferptr& value) {
* @param value place to put output result.
* @returns 0 on success, negative error code on failure.
*/
- int getattr(coll_t cid, const ghobject_t& oid, const char *name, bufferlist& value) {
+ int getattr(const coll_t& cid, const ghobject_t& oid, const char *name, bufferlist& value) {
bufferptr bp;
int r = getattr(cid, oid, name, bp);
if (bp.length())
* @param aset place to put output result.
* @returns 0 on success, negative error code on failure.
*/
- virtual int getattrs(coll_t cid, const ghobject_t& oid,
+ virtual int getattrs(const coll_t& cid, const ghobject_t& oid,
map<string,bufferptr>& aset) = 0;
virtual int getattrs(CollectionHandle &c, const ghobject_t& oid,
map<string,bufferptr>& aset) {
* @param aset place to put output result.
* @returns 0 on success, negative error code on failure.
*/
- int getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferlist>& aset) {
+ int getattrs(const coll_t& cid, const ghobject_t& oid, map<string,bufferlist>& aset) {
map<string,bufferptr> bmap;
int r = getattrs(cid, oid, bmap);
for (map<string,bufferptr>::iterator i = bmap.begin();
*/
virtual int list_collections(vector<coll_t>& ls) = 0;
- virtual int collection_version_current(coll_t c, uint32_t *version) {
+ virtual int collection_version_current(const coll_t& c, uint32_t *version) {
*version = 0;
return 1;
}
* @param c collection
* @returns true if it exists, false otherwise
*/
- virtual bool collection_exists(coll_t c) = 0;
+ virtual bool collection_exists(const coll_t& c) = 0;
/**
* collection_getattr - get an xattr of a collection
*
* @param size size of buffer to receive value
* @returns 0 on success, negative error code on failure
*/
- virtual int collection_getattr(coll_t cid, const char *name,
+ virtual int collection_getattr(const coll_t& cid, const char *name,
void *value, size_t size)
__attribute__ ((deprecated)) {
return -EOPNOTSUPP;
* @param bl buffer to receive value
* @returns 0 on success, negative error code on failure
*/
- virtual int collection_getattr(coll_t cid, const char *name, bufferlist& bl)
+ virtual int collection_getattr(const coll_t& cid, const char *name, bufferlist& bl)
__attribute__ ((deprecated)) {
return -EOPNOTSUPP;
}
* @param aset map of keys and buffers that contain the values
* @returns 0 on success, negative error code on failure
*/
- virtual int collection_getattrs(coll_t cid, map<string,bufferptr> &aset)
+ virtual int collection_getattrs(const coll_t& cid, map<string,bufferptr> &aset)
__attribute__ ((deprecated)) {
return -EOPNOTSUPP;
}
* @param c collection
* @returns true if empty, false otherwise
*/
- virtual bool collection_empty(coll_t c) = 0;
+ virtual bool collection_empty(const coll_t& c) = 0;
/**
* return the number of significant bits of the coll_t::pgid.
* set. A lazy backend can choose not to store and report this (e.g.,
* FileStore).
*/
- virtual int collection_bits(coll_t c) {
+ virtual int collection_bits(const coll_t& c) {
return -EOPNOTSUPP;
}
* @param next [out] next item sorts >= this value
* @return zero on success, or negative error
*/
- virtual int collection_list(coll_t c, ghobject_t start, ghobject_t end,
+ virtual int collection_list(const coll_t& c, ghobject_t start, ghobject_t end,
bool sort_bitwise, int max,
vector<ghobject_t> *ls, ghobject_t *next) = 0;
virtual int collection_list(CollectionHandle &c,
/// OMAP
/// Get omap contents
virtual int omap_get(
- coll_t c, ///< [in] Collection containing oid
+ const coll_t& c, ///< [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
/// Get omap header
virtual int omap_get_header(
- coll_t c, ///< [in] Collection containing oid
+ const coll_t& c, ///< [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
/// Get keys defined on oid
virtual int omap_get_keys(
- coll_t c, ///< [in] Collection containing oid
+ const coll_t& c, ///< [in] Collection containing oid
const ghobject_t &oid, ///< [in] Object containing omap
set<string> *keys ///< [out] Keys defined on oid
) = 0;
/// Get key values
virtual int omap_get_values(
- coll_t c, ///< [in] Collection containing oid
+ const coll_t& c, ///< [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
/// Filters keys into out which are defined on oid
virtual int omap_check_keys(
- coll_t c, ///< [in] Collection containing oid
+ const coll_t& c, ///< [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
* @return iterator, null on error
*/
virtual ObjectMap::ObjectMapIterator get_omap_iterator(
- coll_t c, ///< [in] collection
+ const coll_t& c, ///< [in] collection
const ghobject_t &oid ///< [in] object
) = 0;
virtual ObjectMap::ObjectMapIterator get_omap_iterator(
// ---------------
// 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);
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)
}
int BlueStore::stat(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
struct stat *st,
bool allow_eio)
}
int BlueStore::read(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
uint64_t offset,
size_t length,
}
int BlueStore::fiemap(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
uint64_t offset,
size_t len,
}
int BlueStore::getattr(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
const char *name,
bufferptr& value)
int BlueStore::getattrs(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
map<string,bufferptr>& aset)
{
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;
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);
}
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)
{
}
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
}
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
}
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
)
}
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
}
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
}
ObjectMap::ObjectMapIterator BlueStore::get_omap_iterator(
- coll_t cid, ///< [in] collection
+ const coll_t& cid, ///< [in] collection
const ghobject_t &oid ///< [in] object
)
{
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();
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;
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,
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;
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,
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
/// 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
/// 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;
/// 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
/// 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
) 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(
/// 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 {
/// 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));
}
/// 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()) {}
return out << *s.parent;
}
-int FileStore::get_cdir(coll_t cid, char *s, int len)
+int FileStore::get_cdir(const coll_t& cid, char *s, int len)
{
const string &cid_str(cid.to_str());
return snprintf(s, len, "%s/current/%s", basedir.c_str(), cid_str.c_str());
}
-int FileStore::get_index(coll_t cid, Index *index)
+int FileStore::get_index(const coll_t& cid, Index *index)
{
int r = index_manager.get_index(cid, basedir, index);
assert(!m_filestore_fail_eio || r != -EIO);
return r;
}
-int FileStore::init_index(coll_t cid)
+int FileStore::init_index(const coll_t& cid)
{
char path[PATH_MAX];
get_cdir(cid, path, sizeof(path));
return 0;
}
-int FileStore::lfn_truncate(coll_t cid, const ghobject_t& oid, off_t length)
+int FileStore::lfn_truncate(const coll_t& cid, const ghobject_t& oid, off_t length)
{
FDRef fd;
int r = lfn_open(cid, oid, false, &fd);
return r;
}
-int FileStore::lfn_stat(coll_t cid, const ghobject_t& oid, struct stat *buf)
+int FileStore::lfn_stat(const coll_t& cid, const ghobject_t& oid, struct stat *buf)
{
IndexedPath path;
Index index;
return r;
}
-int FileStore::lfn_open(coll_t cid,
+int FileStore::lfn_open(const coll_t& cid,
const ghobject_t& oid,
bool create,
FDRef *outfd,
{
}
-int FileStore::lfn_link(coll_t c, coll_t newcid, const ghobject_t& o, const ghobject_t& newoid)
+int FileStore::lfn_link(const coll_t& c, const coll_t& newcid, const ghobject_t& o, const ghobject_t& newoid)
{
Index index_new, index_old;
IndexedPath path_new, path_old;
return 0;
}
-int FileStore::lfn_unlink(coll_t cid, const ghobject_t& o,
+int FileStore::lfn_unlink(const coll_t& cid, const ghobject_t& o,
const SequencerPosition &spos,
bool force_clear_omap)
{
return 0;
}
-void FileStore::_set_global_replay_guard(coll_t cid,
+void FileStore::_set_global_replay_guard(const coll_t& cid,
const SequencerPosition &spos)
{
if (backend->can_checkpoint())
dout(10) << __func__ << ": " << spos << " done" << dendl;
}
-int FileStore::_check_global_replay_guard(coll_t cid,
+int FileStore::_check_global_replay_guard(const coll_t& cid,
const SequencerPosition& spos)
{
char fn[PATH_MAX];
}
-void FileStore::_set_replay_guard(coll_t cid,
+void FileStore::_set_replay_guard(const coll_t& cid,
const SequencerPosition &spos,
bool in_progress=false)
{
dout(10) << "_set_replay_guard " << spos << " done" << dendl;
}
-void FileStore::_close_replay_guard(coll_t cid,
+void FileStore::_close_replay_guard(const coll_t& cid,
const SequencerPosition &spos)
{
char fn[PATH_MAX];
dout(10) << "_close_replay_guard " << spos << " done" << dendl;
}
-int FileStore::_check_replay_guard(coll_t cid, ghobject_t oid, const SequencerPosition& spos)
+int FileStore::_check_replay_guard(const coll_t& cid, ghobject_t oid, const SequencerPosition& spos)
{
if (!replaying || backend->can_checkpoint())
return 1;
return ret;
}
-int FileStore::_check_replay_guard(coll_t cid, const SequencerPosition& spos)
+int FileStore::_check_replay_guard(const coll_t& cid, const SequencerPosition& spos)
{
if (!replaying || backend->can_checkpoint())
return 1;
// --------------------
// objects
-bool FileStore::exists(coll_t cid, const ghobject_t& oid)
+bool FileStore::exists(const coll_t& _cid, const ghobject_t& oid)
{
- tracepoint(objectstore, exists_enter, cid.c_str());
- _kludge_temp_object_collection(cid, oid);
+ tracepoint(objectstore, exists_enter, _cid.c_str());
+ const coll_t& cid = !_need_temp_object_collection(_cid, oid) ? _cid : _cid.get_temp();
struct stat st;
bool retval = stat(cid, oid, &st) == 0;
tracepoint(objectstore, exists_exit, retval);
}
int FileStore::stat(
- coll_t cid, const ghobject_t& oid, struct stat *st, bool allow_eio)
+ const coll_t& _cid, const ghobject_t& oid, struct stat *st, bool allow_eio)
{
- tracepoint(objectstore, stat_enter, cid.c_str());
- _kludge_temp_object_collection(cid, oid);
+ tracepoint(objectstore, stat_enter, _cid.c_str());
+ const coll_t& cid = !_need_temp_object_collection(_cid, oid) ? _cid : _cid.get_temp();
int r = lfn_stat(cid, oid, st);
assert(allow_eio || !m_filestore_fail_eio || r != -EIO);
if (r < 0) {
}
int FileStore::read(
- coll_t cid,
+ const coll_t& _cid,
const ghobject_t& oid,
uint64_t offset,
size_t len,
bool allow_eio)
{
int got;
- tracepoint(objectstore, read_enter, cid.c_str(), offset, len);
- _kludge_temp_object_collection(cid, oid);
+ tracepoint(objectstore, read_enter, _cid.c_str(), offset, len);
+ const coll_t& cid = !_need_temp_object_collection(_cid, oid) ? _cid : _cid.get_temp();
dout(15) << "read " << cid << "/" << oid << " " << offset << "~" << len << dendl;
#endif
}
-int FileStore::fiemap(coll_t cid, const ghobject_t& oid,
+int FileStore::fiemap(const coll_t& _cid, const ghobject_t& oid,
uint64_t offset, size_t len,
bufferlist& bl)
{
- tracepoint(objectstore, fiemap_enter, cid.c_str(), offset, len);
- _kludge_temp_object_collection(cid, oid);
+ tracepoint(objectstore, fiemap_enter, _cid.c_str(), offset, len);
+ const coll_t& cid = !_need_temp_object_collection(_cid, oid) ? _cid : _cid.get_temp();
if ((!backend->has_seek_data_hole() && !backend->has_fiemap()) ||
len <= (size_t)m_filestore_fiemap_threshold) {
}
-int FileStore::_remove(coll_t cid, const ghobject_t& oid,
+int FileStore::_remove(const coll_t& cid, const ghobject_t& oid,
const SequencerPosition &spos)
{
dout(15) << "remove " << cid << "/" << oid << dendl;
return r;
}
-int FileStore::_truncate(coll_t cid, const ghobject_t& oid, uint64_t size)
+int FileStore::_truncate(const coll_t& cid, const ghobject_t& oid, uint64_t size)
{
dout(15) << "truncate " << cid << "/" << oid << " size " << size << dendl;
int r = lfn_truncate(cid, oid, size);
}
-int FileStore::_touch(coll_t cid, const ghobject_t& oid)
+int FileStore::_touch(const coll_t& cid, const ghobject_t& oid)
{
dout(15) << "touch " << cid << "/" << oid << dendl;
return r;
}
-int FileStore::_write(coll_t cid, const ghobject_t& oid,
+int FileStore::_write(const coll_t& cid, const ghobject_t& oid,
uint64_t offset, size_t len,
const bufferlist& bl, uint32_t fadvise_flags)
{
return r;
}
-int FileStore::_zero(coll_t cid, const ghobject_t& oid, uint64_t offset, size_t len)
+int FileStore::_zero(const coll_t& cid, const ghobject_t& oid, uint64_t offset, size_t len)
{
dout(15) << "zero " << cid << "/" << oid << " " << offset << "~" << len << dendl;
int ret = 0;
return ret;
}
-int FileStore::_clone(coll_t cid, const ghobject_t& oldoid, const ghobject_t& newoid,
+int FileStore::_clone(const coll_t& cid, const ghobject_t& oldoid, const ghobject_t& newoid,
const SequencerPosition& spos)
{
dout(15) << "clone " << cid << "/" << oldoid << " -> " << cid << "/" << newoid << dendl;
return r;
}
-int FileStore::_clone_range(coll_t cid, const ghobject_t& oldoid, const ghobject_t& newoid,
+int FileStore::_clone_range(const coll_t& cid, const ghobject_t& oldoid, const ghobject_t& newoid,
uint64_t srcoff, uint64_t len, uint64_t dstoff,
const SequencerPosition& spos)
{
// objects
-int FileStore::getattr(coll_t cid, const ghobject_t& oid, const char *name, bufferptr &bp)
+int FileStore::getattr(const coll_t& _cid, const ghobject_t& oid, const char *name, bufferptr &bp)
{
- tracepoint(objectstore, getattr_enter, cid.c_str());
- _kludge_temp_object_collection(cid, oid);
+ tracepoint(objectstore, getattr_enter, _cid.c_str());
+ const coll_t& cid = !_need_temp_object_collection(_cid, oid) ? _cid : _cid.get_temp();
dout(15) << "getattr " << cid << "/" << oid << " '" << name << "'" << dendl;
FDRef fd;
int r = lfn_open(cid, oid, false, &fd);
}
}
-int FileStore::getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset)
+int FileStore::getattrs(const coll_t& _cid, const ghobject_t& oid, map<string,bufferptr>& aset)
{
- tracepoint(objectstore, getattrs_enter, cid.c_str());
- _kludge_temp_object_collection(cid, oid);
+ tracepoint(objectstore, getattrs_enter, _cid.c_str());
+ const coll_t& cid = !_need_temp_object_collection(_cid, oid) ? _cid : _cid.get_temp();
set<string> omap_attrs;
map<string, bufferlist> omap_aset;
Index index;
}
}
-int FileStore::_setattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset,
+int FileStore::_setattrs(const coll_t& cid, const ghobject_t& oid, map<string,bufferptr>& aset,
const SequencerPosition &spos)
{
map<string, bufferlist> omap_set;
}
-int FileStore::_rmattr(coll_t cid, const ghobject_t& oid, const char *name,
+int FileStore::_rmattr(const coll_t& cid, const ghobject_t& oid, const char *name,
const SequencerPosition &spos)
{
dout(15) << "rmattr " << cid << "/" << oid << " '" << name << "'" << dendl;
return r;
}
-int FileStore::_rmattrs(coll_t cid, const ghobject_t& oid,
+int FileStore::_rmattrs(const coll_t& cid, const ghobject_t& oid,
const SequencerPosition &spos)
{
dout(15) << "rmattrs " << cid << "/" << oid << dendl;
// collections
-int FileStore::collection_getattr(coll_t c, const char *name,
+int FileStore::collection_getattr(const coll_t& c, const char *name,
void *value, size_t size)
{
char fn[PATH_MAX];
return r;
}
-int FileStore::collection_getattr(coll_t c, const char *name, bufferlist& bl)
+int FileStore::collection_getattr(const coll_t& c, const char *name, bufferlist& bl)
{
char fn[PATH_MAX];
get_cdir(c, fn, sizeof(fn));
return r;
}
-int FileStore::collection_getattrs(coll_t cid, map<string,bufferptr>& aset)
+int FileStore::collection_getattrs(const coll_t& cid, map<string,bufferptr>& aset)
{
char fn[PATH_MAX];
get_cdir(cid, fn, sizeof(fn));
}
-int FileStore::_collection_setattr(coll_t c, const char *name,
+int FileStore::_collection_setattr(const coll_t& c, const char *name,
const void *value, size_t size)
{
char fn[PATH_MAX];
return r;
}
-int FileStore::_collection_rmattr(coll_t c, const char *name)
+int FileStore::_collection_rmattr(const coll_t& c, const char *name)
{
char fn[PATH_MAX];
get_cdir(c, fn, sizeof(fn));
}
-int FileStore::_collection_setattrs(coll_t cid, map<string,bufferptr>& aset)
+int FileStore::_collection_setattrs(const coll_t& cid, map<string,bufferptr>& aset)
{
char fn[PATH_MAX];
get_cdir(cid, fn, sizeof(fn));
// --------------------------
// collections
-int FileStore::collection_version_current(coll_t c, uint32_t *version)
+int FileStore::collection_version_current(const coll_t& c, uint32_t *version)
{
Index index;
int r = get_index(c, &index);
return r;
}
-int FileStore::collection_stat(coll_t c, struct stat *st)
+int FileStore::collection_stat(const coll_t& c, struct stat *st)
{
tracepoint(objectstore, collection_stat_enter, c.c_str());
char fn[PATH_MAX];
return r;
}
-bool FileStore::collection_exists(coll_t c)
+bool FileStore::collection_exists(const coll_t& c)
{
tracepoint(objectstore, collection_exists_enter, c.c_str());
struct stat st;
return ret;
}
-bool FileStore::collection_empty(coll_t c)
+bool FileStore::collection_empty(const coll_t& c)
{
tracepoint(objectstore, collection_empty_enter, c.c_str());
dout(15) << "collection_empty " << c << dendl;
tracepoint(objectstore, collection_empty_exit, ret);
return ret;
}
-int FileStore::collection_list(coll_t c, ghobject_t start, ghobject_t end,
+int FileStore::collection_list(const coll_t& c, ghobject_t start, ghobject_t end,
bool sort_bitwise, int max,
vector<ghobject_t> *ls, ghobject_t *next)
{
return 0;
}
-int FileStore::omap_get(coll_t c, const ghobject_t &hoid,
+int FileStore::omap_get(const coll_t& _c, const ghobject_t &hoid,
bufferlist *header,
map<string, bufferlist> *out)
{
- tracepoint(objectstore, omap_get_enter, c.c_str());
- _kludge_temp_object_collection(c, hoid);
+ tracepoint(objectstore, omap_get_enter, _c.c_str());
+ const coll_t& c = !_need_temp_object_collection(_c, hoid) ? _c : _c.get_temp();
dout(15) << __func__ << " " << c << "/" << hoid << dendl;
Index index;
int r = get_index(c, &index);
}
int FileStore::omap_get_header(
- coll_t c,
+ const coll_t& _c,
const ghobject_t &hoid,
bufferlist *bl,
bool allow_eio)
{
- tracepoint(objectstore, omap_get_header_enter, c.c_str());
- _kludge_temp_object_collection(c, hoid);
+ tracepoint(objectstore, omap_get_header_enter, _c.c_str());
+ const coll_t& c = !_need_temp_object_collection(_c, hoid) ? _c : _c.get_temp();
dout(15) << __func__ << " " << c << "/" << hoid << dendl;
Index index;
int r = get_index(c, &index);
return 0;
}
-int FileStore::omap_get_keys(coll_t c, const ghobject_t &hoid, set<string> *keys)
+int FileStore::omap_get_keys(const coll_t& _c, const ghobject_t &hoid, set<string> *keys)
{
- tracepoint(objectstore, omap_get_keys_enter, c.c_str());
- _kludge_temp_object_collection(c, hoid);
+ tracepoint(objectstore, omap_get_keys_enter, _c.c_str());
+ const coll_t& c = !_need_temp_object_collection(_c, hoid) ? _c : _c.get_temp();
dout(15) << __func__ << " " << c << "/" << hoid << dendl;
Index index;
int r = get_index(c, &index);
return 0;
}
-int FileStore::omap_get_values(coll_t c, const ghobject_t &hoid,
+int FileStore::omap_get_values(const coll_t& _c, const ghobject_t &hoid,
const set<string> &keys,
map<string, bufferlist> *out)
{
- tracepoint(objectstore, omap_get_values_enter, c.c_str());
- _kludge_temp_object_collection(c, hoid);
+ tracepoint(objectstore, omap_get_values_enter, _c.c_str());
+ const coll_t& c = !_need_temp_object_collection(_c, hoid) ? _c : _c.get_temp();
dout(15) << __func__ << " " << c << "/" << hoid << dendl;
Index index;
const char *where = 0;
return r;
}
-int FileStore::omap_check_keys(coll_t c, const ghobject_t &hoid,
+int FileStore::omap_check_keys(const coll_t& _c, const ghobject_t &hoid,
const set<string> &keys,
set<string> *out)
{
- tracepoint(objectstore, omap_check_keys_enter, c.c_str());
- _kludge_temp_object_collection(c, hoid);
+ tracepoint(objectstore, omap_check_keys_enter, _c.c_str());
+ const coll_t& c = !_need_temp_object_collection(_c, hoid) ? _c : _c.get_temp();
dout(15) << __func__ << " " << c << "/" << hoid << dendl;
Index index;
return 0;
}
-ObjectMap::ObjectMapIterator FileStore::get_omap_iterator(coll_t c,
+ObjectMap::ObjectMapIterator FileStore::get_omap_iterator(const coll_t& _c,
const ghobject_t &hoid)
{
- tracepoint(objectstore, get_omap_iterator, c.c_str());
- _kludge_temp_object_collection(c, hoid);
+ tracepoint(objectstore, get_omap_iterator, _c.c_str());
+ const coll_t& c = !_need_temp_object_collection(_c, hoid) ? _c : _c.get_temp();
dout(15) << __func__ << " " << c << "/" << hoid << dendl;
Index index;
int r = get_index(c, &index);
return object_map->get_iterator(hoid);
}
-int FileStore::_collection_hint_expected_num_objs(coll_t c, uint32_t pg_num,
+int FileStore::_collection_hint_expected_num_objs(const coll_t& c, uint32_t pg_num,
uint64_t expected_num_objs,
const SequencerPosition &spos)
{
}
int FileStore::_create_collection(
- coll_t c,
+ const coll_t& c,
const SequencerPosition &spos)
{
char fn[PATH_MAX];
return 0;
}
-int FileStore::_destroy_collection(coll_t c)
+int FileStore::_destroy_collection(const coll_t& c)
{
int r = 0;
char fn[PATH_MAX];
}
-int FileStore::_collection_add(coll_t c, coll_t oldcid, const ghobject_t& o,
+int FileStore::_collection_add(const coll_t& c, const coll_t& oldcid, const ghobject_t& o,
const SequencerPosition& spos)
{
dout(15) << "collection_add " << c << "/" << o << " from " << oldcid << "/" << o << dendl;
return r;
}
-int FileStore::_collection_move_rename(coll_t oldcid, const ghobject_t& oldoid,
+int FileStore::_collection_move_rename(const coll_t& oldcid, const ghobject_t& oldoid,
coll_t c, const ghobject_t& o,
const SequencerPosition& spos)
{
}
}
-int FileStore::_omap_clear(coll_t cid, const ghobject_t &hoid,
+int FileStore::_omap_clear(const coll_t& cid, const ghobject_t &hoid,
const SequencerPosition &spos) {
dout(15) << __func__ << " " << cid << "/" << hoid << dendl;
Index index;
return 0;
}
-int FileStore::_omap_setkeys(coll_t cid, const ghobject_t &hoid,
+int FileStore::_omap_setkeys(const coll_t& cid, const ghobject_t &hoid,
const map<string, bufferlist> &aset,
const SequencerPosition &spos) {
dout(15) << __func__ << " " << cid << "/" << hoid << dendl;
return r;
}
-int FileStore::_omap_rmkeys(coll_t cid, const ghobject_t &hoid,
+int FileStore::_omap_rmkeys(const coll_t& cid, const ghobject_t &hoid,
const set<string> &keys,
const SequencerPosition &spos) {
dout(15) << __func__ << " " << cid << "/" << hoid << dendl;
return 0;
}
-int FileStore::_omap_rmkeyrange(coll_t cid, const ghobject_t &hoid,
+int FileStore::_omap_rmkeyrange(const coll_t& cid, const ghobject_t &hoid,
const string& first, const string& last,
const SequencerPosition &spos) {
dout(15) << __func__ << " " << cid << "/" << hoid << " [" << first << "," << last << "]" << dendl;
return _omap_rmkeys(cid, hoid, keys, spos);
}
-int FileStore::_omap_setheader(coll_t cid, const ghobject_t &hoid,
+int FileStore::_omap_setheader(const coll_t& cid, const ghobject_t &hoid,
const bufferlist &bl,
const SequencerPosition &spos)
{
return object_map->set_header(hoid, bl, &spos);
}
-int FileStore::_split_collection(coll_t cid,
+int FileStore::_split_collection(const coll_t& cid,
uint32_t bits,
uint32_t rem,
coll_t dest,
return r;
}
-int FileStore::_set_alloc_hint(coll_t cid, const ghobject_t& oid,
+int FileStore::_set_alloc_hint(const coll_t& cid, const ghobject_t& oid,
uint64_t expected_object_size,
uint64_t expected_write_size)
{
// Indexed Collections
IndexManager index_manager;
- int get_index(coll_t c, Index *index);
- int init_index(coll_t c);
+ int get_index(const coll_t& c, Index *index);
+ int init_index(const coll_t& c);
+ bool _need_temp_object_collection(const coll_t& cid, const ghobject_t& oid) {
+ // - normal temp case: cid is pg, object is temp (pool < -1)
+ // - hammer temp case: cid is pg (or already temp), object pool is -1
+ return (cid.is_pg() && (oid.hobj.pool < -1 ||
+ oid.hobj.pool == -1));
+ }
void _kludge_temp_object_collection(coll_t& cid, const ghobject_t& oid) {
// - normal temp case: cid is pg, object is temp (pool < -1)
// - hammer temp case: cid is pg (or already temp), object pool is -1
boost::scoped_ptr<ObjectMap> object_map;
// helper fns
- int get_cdir(coll_t cid, char *s, int len);
+ int get_cdir(const coll_t& cid, char *s, int len);
/// read a uuid from fd
int read_fsid(int fd, uuid_d *uuid);
public:
int lfn_find(const ghobject_t& oid, const Index& index,
IndexedPath *path = NULL);
- int lfn_truncate(coll_t cid, const ghobject_t& oid, off_t length);
- int lfn_stat(coll_t cid, const ghobject_t& oid, struct stat *buf);
+ int lfn_truncate(const coll_t& cid, const ghobject_t& oid, off_t length);
+ int lfn_stat(const coll_t& cid, const ghobject_t& oid, struct stat *buf);
int lfn_open(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
bool create,
FDRef *outfd,
Index *index = 0);
void lfn_close(FDRef fd);
- int lfn_link(coll_t c, coll_t newcid, const ghobject_t& o, const ghobject_t& newoid) ;
- int lfn_unlink(coll_t cid, const ghobject_t& o, const SequencerPosition &spos,
+ int lfn_link(const coll_t& c, const coll_t& newcid, const ghobject_t& o, const ghobject_t& newoid) ;
+ int lfn_unlink(const coll_t& cid, const ghobject_t& o, const SequencerPosition &spos,
bool force_clear_omap=false);
public:
const SequencerPosition& spos,
const ghobject_t *oid=0,
bool in_progress=false);
- void _set_replay_guard(coll_t cid,
+ void _set_replay_guard(const coll_t& cid,
const SequencerPosition& spos,
bool in_progress);
- void _set_global_replay_guard(coll_t cid,
+ void _set_global_replay_guard(const coll_t& cid,
const SequencerPosition &spos);
/// close a replay guard opened with in_progress=true
void _close_replay_guard(int fd, const SequencerPosition& spos);
- void _close_replay_guard(coll_t cid, const SequencerPosition& spos);
+ void _close_replay_guard(const coll_t& cid, const SequencerPosition& spos);
/**
* check replay guard xattr on given file
* @return 1 if we can apply (maybe replay) this operation, -1 if spos has already been applied, 0 if it was in progress
*/
int _check_replay_guard(int fd, const SequencerPosition& spos);
- int _check_replay_guard(coll_t cid, const SequencerPosition& spos);
- int _check_replay_guard(coll_t cid, ghobject_t oid, const SequencerPosition& pos);
- int _check_global_replay_guard(coll_t cid, const SequencerPosition& spos);
+ int _check_replay_guard(const coll_t& cid, const SequencerPosition& spos);
+ int _check_replay_guard(const coll_t& cid, ghobject_t oid, const SequencerPosition& pos);
+ int _check_global_replay_guard(const coll_t& cid, const SequencerPosition& spos);
// ------------------
// objects
int pick_object_revision_lt(ghobject_t& oid) {
return 0;
}
- bool exists(coll_t cid, const ghobject_t& oid);
+ bool exists(const coll_t& cid, const ghobject_t& oid);
int stat(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
struct stat *st,
bool allow_eio = false);
int read(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
uint64_t offset,
size_t len,
map<uint64_t, uint64_t> *m);
int _do_seek_hole_data(int fd, uint64_t offset, size_t len,
map<uint64_t, uint64_t> *m);
- int fiemap(coll_t cid, const ghobject_t& oid, uint64_t offset, size_t len, bufferlist& bl);
+ int fiemap(const coll_t& cid, const ghobject_t& oid, uint64_t offset, size_t len, bufferlist& bl);
- int _touch(coll_t cid, const ghobject_t& oid);
- int _write(coll_t cid, const ghobject_t& oid, uint64_t offset, size_t len,
+ int _touch(const coll_t& cid, const ghobject_t& oid);
+ int _write(const coll_t& cid, const ghobject_t& oid, uint64_t offset, size_t len,
const bufferlist& bl, uint32_t fadvise_flags = 0);
- int _zero(coll_t cid, const ghobject_t& oid, uint64_t offset, size_t len);
- int _truncate(coll_t cid, const ghobject_t& oid, uint64_t size);
- int _clone(coll_t cid, const ghobject_t& oldoid, const ghobject_t& newoid,
+ int _zero(const coll_t& cid, const ghobject_t& oid, uint64_t offset, size_t len);
+ int _truncate(const coll_t& cid, const ghobject_t& oid, uint64_t size);
+ int _clone(const coll_t& cid, const ghobject_t& oldoid, const ghobject_t& newoid,
const SequencerPosition& spos);
- int _clone_range(coll_t cid, const ghobject_t& oldoid, const ghobject_t& newoid,
+ int _clone_range(const coll_t& cid, const ghobject_t& oldoid, const ghobject_t& newoid,
uint64_t srcoff, uint64_t len, uint64_t dstoff,
const SequencerPosition& spos);
int _do_clone_range(int from, int to, uint64_t srcoff, uint64_t len, uint64_t dstoff);
int _do_sparse_copy_range(int from, int to, uint64_t srcoff, uint64_t len, uint64_t dstoff);
int _do_copy_range(int from, int to, uint64_t srcoff, uint64_t len, uint64_t dstoff, bool skip_sloppycrc=false);
- int _remove(coll_t cid, const ghobject_t& oid, const SequencerPosition &spos);
+ int _remove(const coll_t& cid, const ghobject_t& oid, const SequencerPosition &spos);
int _fgetattr(int fd, const char *name, bufferptr& bp);
int _fgetattrs(int fd, map<string,bufferptr>& aset);
int snapshot(const string& name);
// attrs
- int getattr(coll_t cid, const ghobject_t& oid, const char *name, bufferptr &bp);
- int getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset);
+ int getattr(const coll_t& cid, const ghobject_t& oid, const char *name, bufferptr &bp);
+ int getattrs(const coll_t& cid, const ghobject_t& oid, map<string,bufferptr>& aset);
- int _setattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset,
+ int _setattrs(const coll_t& cid, const ghobject_t& oid, map<string,bufferptr>& aset,
const SequencerPosition &spos);
- int _rmattr(coll_t cid, const ghobject_t& oid, const char *name,
+ int _rmattr(const coll_t& cid, const ghobject_t& oid, const char *name,
const SequencerPosition &spos);
- int _rmattrs(coll_t cid, const ghobject_t& oid,
+ int _rmattrs(const coll_t& cid, const ghobject_t& oid,
const SequencerPosition &spos);
- int collection_getattr(coll_t c, const char *name, void *value, size_t size);
- int collection_getattr(coll_t c, const char *name, bufferlist& bl);
- int collection_getattrs(coll_t cid, map<string,bufferptr> &aset);
+ int collection_getattr(const coll_t& c, const char *name, void *value, size_t size);
+ int collection_getattr(const coll_t& c, const char *name, bufferlist& bl);
+ int collection_getattrs(const coll_t& cid, map<string,bufferptr> &aset);
- int _collection_setattr(coll_t c, const char *name, const void *value, size_t size);
- int _collection_rmattr(coll_t c, const char *name);
- int _collection_setattrs(coll_t cid, map<string,bufferptr> &aset);
+ int _collection_setattr(const coll_t& c, const char *name, const void *value, size_t size);
+ int _collection_rmattr(const coll_t& c, const char *name);
+ int _collection_setattrs(const coll_t& cid, map<string,bufferptr> &aset);
int _collection_remove_recursive(const coll_t &cid,
const SequencerPosition &spos);
// collections
- int collection_list(coll_t c, ghobject_t start, ghobject_t end,
+ int collection_list(const coll_t& c, ghobject_t start, ghobject_t end,
bool sort_bitwise, int max,
vector<ghobject_t> *ls, ghobject_t *next);
int list_collections(vector<coll_t>& ls);
int list_collections(vector<coll_t>& ls, bool include_temp);
- int collection_version_current(coll_t c, uint32_t *version);
- int collection_stat(coll_t c, struct stat *st);
- bool collection_exists(coll_t c);
- bool collection_empty(coll_t c);
+ int collection_version_current(const coll_t& c, uint32_t *version);
+ int collection_stat(const coll_t& c, struct stat *st);
+ bool collection_exists(const coll_t& c);
+ bool collection_empty(const coll_t& c);
// omap (see ObjectStore.h for documentation)
- int omap_get(coll_t c, const ghobject_t &oid, bufferlist *header,
+ int omap_get(const coll_t& c, const ghobject_t &oid, bufferlist *header,
map<string, bufferlist> *out);
int omap_get_header(
- coll_t c,
+ const coll_t& c,
const ghobject_t &oid,
bufferlist *out,
bool allow_eio = false);
- int omap_get_keys(coll_t c, const ghobject_t &oid, set<string> *keys);
- int omap_get_values(coll_t c, const ghobject_t &oid, const set<string> &keys,
+ int omap_get_keys(const coll_t& c, const ghobject_t &oid, set<string> *keys);
+ int omap_get_values(const coll_t& c, const ghobject_t &oid, const set<string> &keys,
map<string, bufferlist> *out);
- int omap_check_keys(coll_t c, const ghobject_t &oid, const set<string> &keys,
+ int omap_check_keys(const coll_t& c, const ghobject_t &oid, const set<string> &keys,
set<string> *out);
- ObjectMap::ObjectMapIterator get_omap_iterator(coll_t c, const ghobject_t &oid);
+ ObjectMap::ObjectMapIterator get_omap_iterator(const coll_t& c, const ghobject_t &oid);
- int _create_collection(coll_t c, const SequencerPosition &spos);
- int _destroy_collection(coll_t c);
+ int _create_collection(const coll_t& c, const SequencerPosition &spos);
+ int _destroy_collection(const coll_t& c);
/**
* Give an expected number of objects hint to the collection.
*
*
* @return 0 on success, an error code otherwise
*/
- int _collection_hint_expected_num_objs(coll_t c, uint32_t pg_num,
+ int _collection_hint_expected_num_objs(const coll_t& c, uint32_t pg_num,
uint64_t expected_num_objs,
const SequencerPosition &spos);
- int _collection_add(coll_t c, coll_t ocid, const ghobject_t& oid,
+ int _collection_add(const coll_t& c, const coll_t& ocid, const ghobject_t& oid,
const SequencerPosition& spos);
- int _collection_move_rename(coll_t oldcid, const ghobject_t& oldoid,
+ int _collection_move_rename(const coll_t& oldcid, const ghobject_t& oldoid,
coll_t c, const ghobject_t& o,
const SequencerPosition& spos);
- int _set_alloc_hint(coll_t cid, const ghobject_t& oid,
+ int _set_alloc_hint(const coll_t& cid, const ghobject_t& oid,
uint64_t expected_object_size,
uint64_t expected_write_size);
void _inject_failure();
// omap
- int _omap_clear(coll_t cid, const ghobject_t &oid,
+ int _omap_clear(const coll_t& cid, const ghobject_t &oid,
const SequencerPosition &spos);
- int _omap_setkeys(coll_t cid, const ghobject_t &oid,
+ int _omap_setkeys(const coll_t& cid, const ghobject_t &oid,
const map<string, bufferlist> &aset,
const SequencerPosition &spos);
- int _omap_rmkeys(coll_t cid, const ghobject_t &oid, const set<string> &keys,
+ int _omap_rmkeys(const coll_t& cid, const ghobject_t &oid, const set<string> &keys,
const SequencerPosition &spos);
- int _omap_rmkeyrange(coll_t cid, const ghobject_t &oid,
+ int _omap_rmkeyrange(const coll_t& cid, const ghobject_t &oid,
const string& first, const string& last,
const SequencerPosition &spos);
- int _omap_setheader(coll_t cid, const ghobject_t &oid, const bufferlist &bl,
+ int _omap_setheader(const coll_t& cid, const ghobject_t &oid, const bufferlist &bl,
const SequencerPosition &spos);
- int _split_collection(coll_t cid, uint32_t bits, uint32_t rem, coll_t dest,
+ int _split_collection(const coll_t& cid, uint32_t bits, uint32_t rem, coll_t dest,
const SequencerPosition &spos);
- int _split_collection_create(coll_t cid, uint32_t bits, uint32_t rem,
+ int _split_collection_create(const coll_t& cid, uint32_t bits, uint32_t rem,
coll_t dest,
const SequencerPosition &spos);
// ---------------
// read operations
-bool KStore::exists(coll_t cid, const ghobject_t& oid)
+bool KStore::exists(const coll_t& cid, const ghobject_t& oid)
{
dout(10) << __func__ << " " << cid << " " << oid << dendl;
CollectionRef c = _get_collection(cid);
}
int KStore::stat(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
struct stat *st,
bool allow_eio)
}
int KStore::read(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
uint64_t offset,
size_t length,
}
int KStore::fiemap(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
uint64_t offset,
size_t len,
}
int KStore::getattr(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
const char *name,
bufferptr& value)
}
int KStore::getattrs(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
map<string,bufferptr>& aset)
{
return 0;
}
-bool KStore::collection_exists(coll_t c)
+bool KStore::collection_exists(const coll_t& c)
{
RWLock::RLocker l(coll_lock);
return coll_map.count(c);
}
-bool KStore::collection_empty(coll_t cid)
+bool KStore::collection_empty(const coll_t& cid)
{
dout(15) << __func__ << " " << cid << dendl;
vector<ghobject_t> ls;
}
int KStore::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)
{
}
int KStore::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
}
int KStore::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
}
int KStore::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
)
}
int KStore::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
}
int KStore::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
}
ObjectMap::ObjectMapIterator KStore::get_omap_iterator(
- coll_t cid, ///< [in] collection
+ const coll_t& cid, ///< [in] collection
const ghobject_t &oid ///< [in] object
)
{
int statfs(struct statfs *buf);
- bool exists(coll_t cid, const ghobject_t& oid);
+ bool exists(const coll_t& cid, const ghobject_t& oid);
int stat(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
struct stat *st,
bool allow_eio = false); // struct stat?
int read(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
uint64_t offset,
size_t len,
bufferlist& bl,
uint32_t op_flags = 0);
- int fiemap(coll_t cid, const ghobject_t& oid, uint64_t offset, size_t len, bufferlist& bl);
- int getattr(coll_t cid, const ghobject_t& oid, const char *name, bufferptr& value);
- int getattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset);
+ int fiemap(const coll_t& cid, const ghobject_t& oid, uint64_t offset, size_t len, bufferlist& bl);
+ int getattr(const coll_t& cid, const ghobject_t& oid, const char *name, bufferptr& value);
+ int getattrs(const coll_t& cid, const ghobject_t& oid, map<string,bufferptr>& aset);
int list_collections(vector<coll_t>& ls);
- bool collection_exists(coll_t c);
- bool collection_empty(coll_t c);
+ bool collection_exists(const coll_t& c);
+ bool collection_empty(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);
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
/// 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
/// 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
);
/// 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
/// 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
);
ObjectMap::ObjectMapIterator get_omap_iterator(
- coll_t cid, ///< [in] collection
+ const coll_t& cid, ///< [in] collection
const ghobject_t &oid ///< [in] object
);
return objectstore_perf_stat_t();
}
-MemStore::CollectionRef MemStore::get_collection(coll_t cid)
+MemStore::CollectionRef MemStore::get_collection(const coll_t& cid)
{
RWLock::RLocker l(coll_lock);
ceph::unordered_map<coll_t,CollectionRef>::iterator cp = coll_map.find(cid);
// ---------------
// read operations
-bool MemStore::exists(coll_t cid, const ghobject_t& oid)
+bool MemStore::exists(const coll_t& cid, const ghobject_t& oid)
{
CollectionHandle c = get_collection(cid);
if (!c)
}
int MemStore::stat(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
struct stat *st,
bool allow_eio)
}
int MemStore::read(
- coll_t cid,
+ const coll_t& cid,
const ghobject_t& oid,
uint64_t offset,
size_t len,
return o->read(offset, l, bl);
}
-int MemStore::fiemap(coll_t cid, const ghobject_t& oid,
+int MemStore::fiemap(const coll_t& cid, const ghobject_t& oid,
uint64_t offset, size_t len, bufferlist& bl)
{
dout(10) << __func__ << " " << cid << " " << oid << " " << offset << "~"
return 0;
}
-int MemStore::getattr(coll_t cid, const ghobject_t& oid,
+int MemStore::getattr(const coll_t& cid, const ghobject_t& oid,
const char *name, bufferptr& value)
{
CollectionHandle c = get_collection(cid);
return 0;
}
-int MemStore::getattrs(coll_t cid, const ghobject_t& oid,
+int MemStore::getattrs(const coll_t& cid, const ghobject_t& oid,
map<string,bufferptr>& aset)
{
CollectionHandle c = get_collection(cid);
return 0;
}
-bool MemStore::collection_exists(coll_t cid)
+bool MemStore::collection_exists(const coll_t& cid)
{
dout(10) << __func__ << " " << cid << dendl;
RWLock::RLocker l(coll_lock);
return coll_map.count(cid);
}
-bool MemStore::collection_empty(coll_t cid)
+bool MemStore::collection_empty(const coll_t& cid)
{
dout(10) << __func__ << " " << cid << dendl;
CollectionRef c = get_collection(cid);
return c->object_map.empty();
}
-int MemStore::collection_list(coll_t cid, ghobject_t start, ghobject_t end,
+int MemStore::collection_list(const coll_t& cid, ghobject_t start, ghobject_t end,
bool sort_bitwise, int max,
vector<ghobject_t> *ls, ghobject_t *next)
{
}
int MemStore::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
}
int MemStore::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
}
int MemStore::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
)
}
int MemStore::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
}
int MemStore::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
return 0;
}
-ObjectMap::ObjectMapIterator MemStore::get_omap_iterator(coll_t cid,
+ObjectMap::ObjectMapIterator MemStore::get_omap_iterator(const coll_t& cid,
const ghobject_t& oid)
{
dout(10) << __func__ << " " << cid << " " << oid << dendl;
}
}
-int MemStore::_touch(coll_t cid, const ghobject_t& oid)
+int MemStore::_touch(const coll_t& cid, const ghobject_t& oid)
{
dout(10) << __func__ << " " << cid << " " << oid << dendl;
CollectionRef c = get_collection(cid);
return 0;
}
-int MemStore::_write(coll_t cid, const ghobject_t& oid,
+int MemStore::_write(const coll_t& cid, const ghobject_t& oid,
uint64_t offset, size_t len, const bufferlist& bl,
uint32_t fadvise_flags)
{
return 0;
}
-int MemStore::_zero(coll_t cid, const ghobject_t& oid,
+int MemStore::_zero(const coll_t& cid, const ghobject_t& oid,
uint64_t offset, size_t len)
{
dout(10) << __func__ << " " << cid << " " << oid << " " << offset << "~"
return _write(cid, oid, offset, len, bl);
}
-int MemStore::_truncate(coll_t cid, const ghobject_t& oid, uint64_t size)
+int MemStore::_truncate(const coll_t& cid, const ghobject_t& oid, uint64_t size)
{
dout(10) << __func__ << " " << cid << " " << oid << " " << size << dendl;
CollectionRef c = get_collection(cid);
return r;
}
-int MemStore::_remove(coll_t cid, const ghobject_t& oid)
+int MemStore::_remove(const coll_t& cid, const ghobject_t& oid)
{
dout(10) << __func__ << " " << cid << " " << oid << dendl;
CollectionRef c = get_collection(cid);
return 0;
}
-int MemStore::_setattrs(coll_t cid, const ghobject_t& oid,
+int MemStore::_setattrs(const coll_t& cid, const ghobject_t& oid,
map<string,bufferptr>& aset)
{
dout(10) << __func__ << " " << cid << " " << oid << dendl;
return 0;
}
-int MemStore::_rmattr(coll_t cid, const ghobject_t& oid, const char *name)
+int MemStore::_rmattr(const coll_t& cid, const ghobject_t& oid, const char *name)
{
dout(10) << __func__ << " " << cid << " " << oid << " " << name << dendl;
CollectionRef c = get_collection(cid);
return 0;
}
-int MemStore::_rmattrs(coll_t cid, const ghobject_t& oid)
+int MemStore::_rmattrs(const coll_t& cid, const ghobject_t& oid)
{
dout(10) << __func__ << " " << cid << " " << oid << dendl;
CollectionRef c = get_collection(cid);
return 0;
}
-int MemStore::_clone(coll_t cid, const ghobject_t& oldoid,
+int MemStore::_clone(const coll_t& cid, const ghobject_t& oldoid,
const ghobject_t& newoid)
{
dout(10) << __func__ << " " << cid << " " << oldoid
return 0;
}
-int MemStore::_clone_range(coll_t cid, const ghobject_t& oldoid,
+int MemStore::_clone_range(const coll_t& cid, const ghobject_t& oldoid,
const ghobject_t& newoid,
uint64_t srcoff, uint64_t len, uint64_t dstoff)
{
return len;
}
-int MemStore::_omap_clear(coll_t cid, const ghobject_t &oid)
+int MemStore::_omap_clear(const coll_t& cid, const ghobject_t &oid)
{
dout(10) << __func__ << " " << cid << " " << oid << dendl;
CollectionRef c = get_collection(cid);
return 0;
}
-int MemStore::_omap_setkeys(coll_t cid, const ghobject_t &oid,
+int MemStore::_omap_setkeys(const coll_t& cid, const ghobject_t &oid,
bufferlist& aset_bl)
{
dout(10) << __func__ << " " << cid << " " << oid << dendl;
return 0;
}
-int MemStore::_omap_rmkeys(coll_t cid, const ghobject_t &oid,
+int MemStore::_omap_rmkeys(const coll_t& cid, const ghobject_t &oid,
bufferlist& keys_bl)
{
dout(10) << __func__ << " " << cid << " " << oid << dendl;
return 0;
}
-int MemStore::_omap_rmkeyrange(coll_t cid, const ghobject_t &oid,
+int MemStore::_omap_rmkeyrange(const coll_t& cid, const ghobject_t &oid,
const string& first, const string& last)
{
dout(10) << __func__ << " " << cid << " " << oid << " " << first
return 0;
}
-int MemStore::_omap_setheader(coll_t cid, const ghobject_t &oid,
+int MemStore::_omap_setheader(const coll_t& cid, const ghobject_t &oid,
const bufferlist &bl)
{
dout(10) << __func__ << " " << cid << " " << oid << dendl;
return 0;
}
-int MemStore::_create_collection(coll_t cid)
+int MemStore::_create_collection(const coll_t& cid)
{
dout(10) << __func__ << " " << cid << dendl;
RWLock::WLocker l(coll_lock);
return 0;
}
-int MemStore::_destroy_collection(coll_t cid)
+int MemStore::_destroy_collection(const coll_t& cid)
{
dout(10) << __func__ << " " << cid << dendl;
RWLock::WLocker l(coll_lock);
return 0;
}
-int MemStore::_collection_add(coll_t cid, coll_t ocid, const ghobject_t& oid)
+int MemStore::_collection_add(const coll_t& cid, const coll_t& ocid, const ghobject_t& oid)
{
dout(10) << __func__ << " " << cid << " " << ocid << " " << oid << dendl;
CollectionRef c = get_collection(cid);
return 0;
}
-int MemStore::_collection_move_rename(coll_t oldcid, const ghobject_t& oldoid,
+int MemStore::_collection_move_rename(const coll_t& oldcid, const ghobject_t& oldoid,
coll_t cid, const ghobject_t& oid)
{
dout(10) << __func__ << " " << oldcid << " " << oldoid << " -> "
return r;
}
-int MemStore::_split_collection(coll_t cid, uint32_t bits, uint32_t match,
+int MemStore::_split_collection(const coll_t& cid, uint32_t bits, uint32_t match,
coll_t dest)
{
dout(10) << __func__ << " " << cid << " " << bits << " " << match << " "
ceph::unordered_map<coll_t, CollectionRef> coll_map;
RWLock coll_lock; ///< rwlock to protect coll_map
- CollectionRef get_collection(coll_t cid);
+ CollectionRef get_collection(const coll_t& cid);
Finisher finisher;
void _do_transaction(Transaction& t);
- int _touch(coll_t cid, const ghobject_t& oid);
- int _write(coll_t cid, const ghobject_t& oid, uint64_t offset, size_t len,
+ int _touch(const coll_t& cid, const ghobject_t& oid);
+ int _write(const coll_t& cid, const ghobject_t& oid, uint64_t offset, size_t len,
const bufferlist& bl, uint32_t fadvsie_flags = 0);
- int _zero(coll_t cid, const ghobject_t& oid, uint64_t offset, size_t len);
- int _truncate(coll_t cid, const ghobject_t& oid, uint64_t size);
- int _remove(coll_t cid, const ghobject_t& oid);
- int _setattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr>& aset);
- int _rmattr(coll_t cid, const ghobject_t& oid, const char *name);
- int _rmattrs(coll_t cid, const ghobject_t& oid);
- int _clone(coll_t cid, const ghobject_t& oldoid, const ghobject_t& newoid);
- int _clone_range(coll_t cid, const ghobject_t& oldoid,
+ int _zero(const coll_t& cid, const ghobject_t& oid, uint64_t offset, size_t len);
+ int _truncate(const coll_t& cid, const ghobject_t& oid, uint64_t size);
+ int _remove(const coll_t& cid, const ghobject_t& oid);
+ int _setattrs(const coll_t& cid, const ghobject_t& oid, map<string,bufferptr>& aset);
+ int _rmattr(const coll_t& cid, const ghobject_t& oid, const char *name);
+ int _rmattrs(const coll_t& cid, const ghobject_t& oid);
+ int _clone(const coll_t& cid, const ghobject_t& oldoid, const ghobject_t& newoid);
+ int _clone_range(const coll_t& cid, const ghobject_t& oldoid,
const ghobject_t& newoid,
uint64_t srcoff, uint64_t len, uint64_t dstoff);
- int _omap_clear(coll_t cid, const ghobject_t &oid);
- int _omap_setkeys(coll_t cid, const ghobject_t &oid, bufferlist& aset_bl);
- int _omap_rmkeys(coll_t cid, const ghobject_t &oid, bufferlist& keys_bl);
- int _omap_rmkeyrange(coll_t cid, const ghobject_t &oid,
+ int _omap_clear(const coll_t& cid, const ghobject_t &oid);
+ int _omap_setkeys(const coll_t& cid, const ghobject_t &oid, bufferlist& aset_bl);
+ int _omap_rmkeys(const coll_t& cid, const ghobject_t &oid, bufferlist& keys_bl);
+ int _omap_rmkeyrange(const coll_t& cid, const ghobject_t &oid,
const string& first, const string& last);
- int _omap_setheader(coll_t cid, const ghobject_t &oid, const bufferlist &bl);
+ int _omap_setheader(const coll_t& cid, const ghobject_t &oid, const bufferlist &bl);
- int _collection_hint_expected_num_objs(coll_t cid, uint32_t pg_num,
+ int _collection_hint_expected_num_objs(const coll_t& cid, uint32_t pg_num,
uint64_t num_objs) const { return 0; }
- int _create_collection(coll_t c);
- int _destroy_collection(coll_t c);
- int _collection_add(coll_t cid, coll_t ocid, const ghobject_t& oid);
- int _collection_move_rename(coll_t oldcid, const ghobject_t& oldoid,
+ int _create_collection(const coll_t& c);
+ int _destroy_collection(const coll_t& c);
+ int _collection_add(const coll_t& cid, const coll_t& ocid, const ghobject_t& oid);
+ int _collection_move_rename(const coll_t& oldcid, const ghobject_t& oldoid,
coll_t cid, const ghobject_t& o);
- int _split_collection(coll_t cid, uint32_t bits, uint32_t rem, coll_t dest);
+ int _split_collection(const coll_t& cid, uint32_t bits, uint32_t rem, coll_t dest);
int _save();
int _load();
int statfs(struct statfs *buf);
- bool exists(coll_t cid, const ghobject_t& oid) override;
+ bool exists(const coll_t& cid, const ghobject_t& oid) override;
bool exists(CollectionHandle &c, const ghobject_t& oid) override;
- int stat(coll_t cid, const ghobject_t& oid,
+ int stat(const coll_t& cid, const ghobject_t& oid,
struct stat *st, bool allow_eio = false) override;
int stat(CollectionHandle &c, const ghobject_t& oid,
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,
bufferlist& bl,
uint32_t op_flags = 0,
bool allow_eio = false) override;
- int fiemap(coll_t cid, const ghobject_t& oid, uint64_t offset, size_t len, bufferlist& bl);
- int getattr(coll_t cid, const ghobject_t& oid, const char *name,
+ int fiemap(const coll_t& cid, const ghobject_t& oid, uint64_t offset, size_t len, bufferlist& bl);
+ 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;
CollectionHandle open_collection(const coll_t& c) {
return get_collection(c);
}
- bool collection_exists(coll_t c);
- bool collection_empty(coll_t c);
- int collection_list(coll_t cid, ghobject_t start, ghobject_t end,
+ bool collection_exists(const coll_t& c);
+ bool collection_empty(const coll_t& c);
+ 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);
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
/// 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
/// 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
);
/// 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
/// 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
);
ObjectMap::ObjectMapIterator get_omap_iterator(
- coll_t cid, ///< [in] collection
+ const coll_t& cid, ///< [in] collection
const ghobject_t &oid ///< [in] object
);