Skip to content

Commit

Permalink
Added asynchronous set_alloc_hint
Browse files Browse the repository at this point in the history
Signed-off-by: kiizawa <kiizawa@ucsc.edu>
  • Loading branch information
kiizawa committed Oct 25, 2017
1 parent d8a248f commit b1ccd5b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/include/rados/librados.hpp
Expand Up @@ -1064,6 +1064,11 @@ namespace librados
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
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
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
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

0 comments on commit b1ccd5b

Please sign in to comment.