You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2022/11/21 06:42:46 UTC

[GitHub] [incubator-brpc] wwbmmm commented on a diff in pull request #2005: allow IOBuf::append_user_data_with_meta to specify the lkey of rdma memory region

wwbmmm commented on code in PR #2005:
URL: https://github.com/apache/incubator-brpc/pull/2005#discussion_r1027626417


##########
src/butil/iobuf.h:
##########
@@ -66,6 +66,7 @@ friend class IOBufCutter;
 public:
     static const size_t DEFAULT_BLOCK_SIZE = 8192;
     static const size_t INITIAL_CAP = 32; // must be power of 2
+    static const size_t BLOCK_META_OFFSET = 16;

Review Comment:
   Where is it used?



##########
src/butil/iobuf.cpp:
##########
@@ -1219,11 +1227,23 @@ int IOBuf::append_user_data(void* data, size_t size, void (*deleter)(void*)) {
         deleter = ::free;
     }
     IOBuf::Block* b = new (mem) IOBuf::Block((char*)data, size, deleter);
+    b->u.data_meta = meta;
     const IOBuf::BlockRef r = { 0, b->cap, b };
     _move_back_ref(r);
     return 0;
 }
 
+uint64_t IOBuf::get_first_data_meta() {
+    if (_ref_num() == 0) {
+        return 0;
+    }
+    IOBuf::BlockRef const& r = _ref_at(0);
+    if (!r.block->flags) {

Review Comment:
   flags & IOBUF_BLOCK_FLAGS_USER_DATA



##########
src/butil/iobuf.h:
##########
@@ -246,7 +247,18 @@ friend class IOBufCutter;
     // Append the user-data to back side WITHOUT copying.
     // The user-data can be split and shared by smaller IOBufs and will be
     // deleted using the deleter func when no IOBuf references it anymore.
-    int append_user_data(void* data, size_t size, void (*deleter)(void*));
+    inline int append_user_data(void* data, size_t size, void (*deleter)(void*)) {

Review Comment:
   This method should be defined in `iobuf_inl.h`



##########
test/brpc_rdma_unittest.cpp:
##########
@@ -80,6 +80,7 @@ extern bool g_skip_rdma_init;
 }
 }
 
+static const size_t MAX_USER_MRS = 16;

Review Comment:
   Where is it used?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org