Skip to content

Commit

Permalink
os/bluestore: multi-tier support in BlueStore
Browse files Browse the repository at this point in the history
port kiizawa's patch(ceph#18211)

Signed-off-by: Yang Honggang <yanghonggang@umcloud.com>
  • Loading branch information
Yang Honggang committed Sep 15, 2019
1 parent 5609e91 commit e91dcb9
Show file tree
Hide file tree
Showing 18 changed files with 558 additions and 40 deletions.
2 changes: 2 additions & 0 deletions src/common/ceph_strings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ const char *ceph_osd_alloc_hint_flag_name(int f)
return "compressible";
case CEPH_OSD_ALLOC_HINT_FLAG_INCOMPRESSIBLE:
return "incompressible";
case CEPH_OSD_ALLOC_HINT_FLAG_FAST_TIER:
return "fast_tier";
default:
return "???";
}
Expand Down
3 changes: 3 additions & 0 deletions src/common/legacy_config_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,9 @@ OPTION(bluestore_block_db_create, OPT_BOOL)
OPTION(bluestore_block_wal_path, OPT_STR)
OPTION(bluestore_block_wal_size, OPT_U64) // rocksdb wal
OPTION(bluestore_block_wal_create, OPT_BOOL)
OPTION(bluestore_block_fast_path, OPT_STR)
OPTION(bluestore_block_fast_size, OPT_U64) // fast tier
OPTION(bluestore_block_fast_create, OPT_BOOL)
OPTION(bluestore_block_preallocate_file, OPT_BOOL) //whether preallocate space if block/db_path/wal_path is file rather that block device.
OPTION(bluestore_csum_type, OPT_STR) // none|xxhash32|xxhash64|crc32c|crc32c_16|crc32c_8
OPTION(bluestore_csum_min_block, OPT_U32)
Expand Down
16 changes: 16 additions & 0 deletions src/common/options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3301,6 +3301,22 @@ std::vector<Option> get_global_options() {
.add_see_also("bluestore_block_wal_path")
.add_see_also("bluestore_block_wal_size"),

Option("bluestore_block_fast_path", Option::TYPE_STR, Option::LEVEL_DEV)
.set_default("")
.add_tag("mkfs")
.set_description("Path to fast block device/file"),

Option("bluestore_block_fast_size", Option::TYPE_UINT, Option::LEVEL_DEV)
.set_default(1_G)
.add_tag("mkfs")
.set_description("Size of file to create for backing bluestore fast tier"),

Option("bluestore_block_fast_create", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_default(true)
.add_tag("mkfs")
.set_description("Create bluestore_block_fast_path if it doesn't exist")
.add_see_also("bluestore_block_fast_path").add_see_also("bluestore_block_fast_size"),

Option("bluestore_block_preallocate_file", Option::TYPE_BOOL, Option::LEVEL_DEV)
.set_default(false)
.add_tag("mkfs")
Expand Down
1 change: 1 addition & 0 deletions src/include/rados.h
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ enum {
CEPH_OSD_ALLOC_HINT_FLAG_LONGLIVED = 128,
CEPH_OSD_ALLOC_HINT_FLAG_COMPRESSIBLE = 256,
CEPH_OSD_ALLOC_HINT_FLAG_INCOMPRESSIBLE = 512,
CEPH_OSD_ALLOC_HINT_FLAG_FAST_TIER = 1024,
};

const char *ceph_osd_alloc_hint_flag_name(int f);
Expand Down
1 change: 1 addition & 0 deletions src/include/rados/librados.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ enum {
LIBRADOS_ALLOC_HINT_FLAG_LONGLIVED = 128,
LIBRADOS_ALLOC_HINT_FLAG_COMPRESSIBLE = 256,
LIBRADOS_ALLOC_HINT_FLAG_INCOMPRESSIBLE = 512,
LIBRADOS_ALLOC_HINT_FLAG_FAST_TIER = 1024,
};
/** @} */

Expand Down
5 changes: 5 additions & 0 deletions src/include/rados/librados.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ namespace librados
ALLOC_HINT_FLAG_LONGLIVED = 128,
ALLOC_HINT_FLAG_COMPRESSIBLE = 256,
ALLOC_HINT_FLAG_INCOMPRESSIBLE = 512,
ALLOC_HINT_FLAG_FAST_TIER = 1024,
};

/*
Expand Down Expand Up @@ -1062,6 +1063,10 @@ namespace librados
int aio_rmxattr(const std::string& oid, AioCompletion *c, const char *name);
int aio_stat(const std::string& oid, AioCompletion *c, uint64_t *psize, time_t *pmtime);
int aio_stat2(const std::string& oid, AioCompletion *c, uint64_t *psize, struct timespec *pts);
int aio_set_alloc_hint(const std::string& oid, AioCompletion *c,
uint64_t expected_object_size,
uint64_t expected_write_size,
uint32_t flags);

/**
* Cancel aio operation
Expand Down
11 changes: 11 additions & 0 deletions src/librados/IoCtxImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,17 @@ int librados::IoCtxImpl::aio_setxattr(const object_t& oid, AioCompletionImpl *c,
return aio_operate(oid, &op, c, snapc, 0);
}

int librados::IoCtxImpl::aio_set_alloc_hint(const object_t& oid, AioCompletionImpl *c,
uint64_t expected_object_size,
uint64_t expected_write_size,
uint32_t flags)
{
::ObjectOperation wr;
prepare_assert_ops(&wr);
wr.set_alloc_hint(expected_object_size, expected_write_size, flags);
return aio_operate(oid, &wr, c, snapc, 0);
}

namespace {
struct AioGetxattrsData {
AioGetxattrsData(librados::AioCompletionImpl *c, map<string, bufferlist>* attrset,
Expand Down
4 changes: 4 additions & 0 deletions src/librados/IoCtxImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ struct librados::IoCtxImpl {
map<string, bufferlist>& attrset);
int aio_rmxattr(const object_t& oid, AioCompletionImpl *c,
const char *name);
int aio_set_alloc_hint(const object_t& oid, AioCompletionImpl *c,
uint64_t expected_object_size,
uint64_t expected_write_size,
uint32_t flags);
int aio_cancel(AioCompletionImpl *c);

int pool_change_auid(unsigned long long auid);
Expand Down
9 changes: 9 additions & 0 deletions src/librados/librados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2005,6 +2005,15 @@ int librados::IoCtx::aio_rmxattr(const std::string& oid, AioCompletion *c,
return io_ctx_impl->aio_rmxattr(obj, c->pc, name);
}

int librados::IoCtx::aio_set_alloc_hint(const std::string& oid, AioCompletion *c,
uint64_t expected_object_size,
uint64_t expected_write_size,
uint32_t flags)
{
object_t obj(oid);
return io_ctx_impl->aio_set_alloc_hint(obj, c->pc, expected_object_size, expected_write_size, flags);
}

int librados::IoCtx::aio_stat(const std::string& oid, librados::AioCompletion *c,
uint64_t *psize, time_t *pmtime)
{
Expand Down
Loading

0 comments on commit e91dcb9

Please sign in to comment.