From 4a159760a514b60b1343764bd93d6aee78cb63a1 Mon Sep 17 00:00:00 2001 From: None None Date: Mon, 24 Aug 2020 10:42:44 +0000 Subject: [PATCH 1/3] some compiling fixes --- src/librmb/rados-metadata.h | 2 ++ src/librmb/rados-storage-impl.cpp | 10 ++++++++-- src/storage-rbox/rbox-mail.cpp | 2 +- src/storage-rbox/rbox-save.cpp | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/librmb/rados-metadata.h b/src/librmb/rados-metadata.h index 7bbc1a4d..21dbee98 100644 --- a/src/librmb/rados-metadata.h +++ b/src/librmb/rados-metadata.h @@ -19,6 +19,8 @@ #include #include +typedef unsigned int uint; + namespace librmb { class RadosMetadata { diff --git a/src/librmb/rados-storage-impl.cpp b/src/librmb/rados-storage-impl.cpp index fb60e416..3d93436e 100644 --- a/src/librmb/rados-storage-impl.cpp +++ b/src/librmb/rados-storage-impl.cpp @@ -275,10 +275,13 @@ int RadosStorageImpl::move(std::string &src_oid, const char *src_ns, std::string dest_io_ctx = io_ctx; if (strcmp(src_ns, dest_ns) != 0) { + uint32_t src_fadvise_flags = LIBRADOS_OP_FLAG_FADVISE_SEQUENTIAL | LIBRADOS_OP_FLAG_FADVISE_NOCACHE; + uint32_t dest_fadvise_flags = LIBRADOS_OP_FLAG_FADVISE_SEQUENTIAL | LIBRADOS_OP_FLAG_FADVISE_DONTNEED; src_io_ctx.dup(dest_io_ctx); src_io_ctx.set_namespace(src_ns); dest_io_ctx.set_namespace(dest_ns); - write_op.copy_from(src_oid, src_io_ctx, 0); + write_op.copy_from(src_oid, src_io_ctx, 0, src_fadvise_flags); + write_op.set_op_flags2(dest_fadvise_flags); } else { src_io_ctx = dest_io_ctx; @@ -335,7 +338,10 @@ int RadosStorageImpl::copy(std::string &src_oid, const char *src_ns, std::string } else { src_io_ctx = dest_io_ctx; } - write_op.copy_from(src_oid, src_io_ctx, 0); + uint32_t src_fadvise_flags = LIBRADOS_OP_FLAG_FADVISE_SEQUENTIAL | LIBRADOS_OP_FLAG_FADVISE_NOCACHE; + uint32_t dest_fadvise_flags = LIBRADOS_OP_FLAG_FADVISE_SEQUENTIAL | LIBRADOS_OP_FLAG_FADVISE_DONTNEED; + write_op.copy_from(src_oid, src_io_ctx, 0, src_fadvise_flags); + write_op.set_op_flags2(dest_fadvise_flags); // because we create a copy, save date needs to be updated // as an alternative we could use &ctx->data.save_date here if we save it to xattribute in write_metadata diff --git a/src/storage-rbox/rbox-mail.cpp b/src/storage-rbox/rbox-mail.cpp index bd15d82d..8d0b8a3f 100644 --- a/src/storage-rbox/rbox-mail.cpp +++ b/src/storage-rbox/rbox-mail.cpp @@ -496,7 +496,7 @@ int rbox_get_guid_metadata(struct rbox_mail *mail, const char **value_r) { } // lost for some reason, use fallback // index is empty. we have to check the object attributes do we have to tell someone that the index is broken? - if (rbox_mail_metadata_get(mail, rbox_metadata_key::RBOX_METADATA_GUID, value_r) < 0) { + if (rbox_mail_metadata_get(mail, rbox_metadata_key::RBOX_METADATA_GUID, const_cast(value_r)) < 0) { return -1; } diff --git a/src/storage-rbox/rbox-save.cpp b/src/storage-rbox/rbox-save.cpp index bc11406f..7b607ed3 100644 --- a/src/storage-rbox/rbox-save.cpp +++ b/src/storage-rbox/rbox-save.cpp @@ -192,7 +192,7 @@ void init_output_stream(mail_save_context *_ctx) { // create buffer ( delete is in wait_for_write_operations) r_ctx->rados_mail->set_mail_buffer(new librados::bufferlist()); r_ctx->output_stream = - o_stream_create_bufferlist(r_ctx->rados_mail, &r_ctx->rados_storage, rbox->storage->config->is_write_chunks()); + o_stream_create_bufferlist(r_ctx->rados_mail, const_cast(&r_ctx->rados_storage), rbox->storage->config->is_write_chunks()); o_stream_cork(r_ctx->output_stream); _ctx->data.output = r_ctx->output_stream; From 31f755997e648e813a4eb49d86c301d6e5b1121d Mon Sep 17 00:00:00 2001 From: None None Date: Mon, 24 Aug 2020 12:02:24 +0000 Subject: [PATCH 2/3] some compiling fixes --- src/storage-rbox/typeof-def.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage-rbox/typeof-def.h b/src/storage-rbox/typeof-def.h index 4badd349..3ed0b71f 100644 --- a/src/storage-rbox/typeof-def.h +++ b/src/storage-rbox/typeof-def.h @@ -23,7 +23,7 @@ /* replacement for MODULE_CONTEXT (v 2.3, assigned void or long int, this is not allowed with c++) */ #define RBOX_MODULE_CONTEXT(obj, id_ctx) \ (module_get_context_id(&(id_ctx).id) < array_count(&(obj)->module_contexts) \ - ? (*((void **)array_idx_modifiable(&(obj)->module_contexts, module_get_context_id(&(id_ctx).id)) + \ + ? (*((index_mailbox_context **)array_idx_modifiable(&(obj)->module_contexts, module_get_context_id(&(id_ctx).id)) + \ OBJ_REGISTER_COMPATIBLE(obj, id_ctx))) \ : NULL) From cbccc030421472d2455bf0c584ea1490bf03dd16 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 24 Aug 2020 13:28:24 +0000 Subject: [PATCH 3/3] some compiling fixes --- src/storage-rbox/ostream-bufferlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage-rbox/ostream-bufferlist.cpp b/src/storage-rbox/ostream-bufferlist.cpp index 83f4880e..2c3f0b60 100644 --- a/src/storage-rbox/ostream-bufferlist.cpp +++ b/src/storage-rbox/ostream-bufferlist.cpp @@ -63,7 +63,7 @@ static ssize_t o_stream_buffer_sendv(struct ostream_private *stream, const struc } for (i = 0; i < iov_count; i++) { // use unsigned char* for binary data! - bstream->buf->append(reinterpret_cast(iov[i].iov_base), iov[i].iov_len); + bstream->buf->append(reinterpret_cast(iov[i].iov_base), iov[i].iov_len); stream->ostream.offset += iov[i].iov_len; ret += iov[i].iov_len; }