Whamcloud - gitweb
LU-6741 osp: Pack small request inline 53/16353/7
authorwang di <di.wang@intel.com>
Tue, 8 Sep 2015 14:41:37 +0000 (07:41 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 2 Oct 2015 04:14:00 +0000 (04:14 +0000)
Pack small size request inline, instead of using
bulk transfer to save space and RPC round trips.

Signed-off-by: wang di <di.wang@intel.com>
Change-Id: I9ca71d3c7634c6c82ce0be7ad4f2d54e8f967e19
Reviewed-on: http://review.whamcloud.com/16353
Tested-by: Jenkins
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/lustre/lustre_idl.h
lustre/osp/osp_trans.c
lustre/ptlrpc/layout.c
lustre/ptlrpc/pack_generic.c
lustre/ptlrpc/wiretest.c
lustre/target/out_handler.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index fccdc1b..ba99064 100644 (file)
@@ -3947,11 +3947,15 @@ struct object_update_request {
        struct object_update    ourq_updates[0];
 };
 
-#define OUT_UPDATE_HEADER_MAGIC        0xBDDF0001
+#define OUT_UPDATE_HEADER_MAGIC                0xBDDF0001
+#define OUT_UPDATE_MAX_INLINE_SIZE     4096
 /* Header for updates request between MDTs */
 struct out_update_header {
        __u32           ouh_magic;
        __u32           ouh_count;
+       __u32           ouh_inline_length;
+       __u32           ouh_padding;
+       __u32           ouh_inline_data[0];
 };
 
 struct out_update_buffer {
index e700acf..c506572 100644 (file)
@@ -243,6 +243,51 @@ object_update_request_dump(const struct object_update_request *ourq,
 }
 
 /**
+ * Prepare inline update request
+ *
+ * Prepare OUT update ptlrpc inline request, and the request usually includes
+ * one update buffer, which does not need bulk transfer.
+ *
+ * \param[in] env      execution environment
+ * \param[in] req      ptlrpc request
+ * \param[in] ours     sub osp_update_request to be packed
+ *
+ * \retval             0 if packing succeeds
+ * \retval             negative errno if packing fails
+ */
+int osp_prep_inline_update_req(const struct lu_env *env,
+                              struct ptlrpc_request *req,
+                              struct osp_update_request_sub *ours)
+{
+       struct out_update_header *ouh;
+       __u32 update_req_size = object_update_request_size(ours->ours_req);
+       int rc;
+
+       req_capsule_set_size(&req->rq_pill, &RMF_OUT_UPDATE_HEADER, RCL_CLIENT,
+                            update_req_size + sizeof(*ouh));
+
+       rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, OUT_UPDATE);
+       if (rc != 0)
+               RETURN(rc);
+
+       ouh = req_capsule_client_get(&req->rq_pill, &RMF_OUT_UPDATE_HEADER);
+       ouh->ouh_magic = OUT_UPDATE_HEADER_MAGIC;
+       ouh->ouh_count = 1;
+       ouh->ouh_inline_length = update_req_size;
+
+       memcpy(ouh->ouh_inline_data, ours->ours_req, update_req_size);
+
+       req_capsule_set_size(&req->rq_pill, &RMF_OUT_UPDATE_REPLY,
+                            RCL_SERVER, OUT_UPDATE_REPLY_SIZE);
+
+       ptlrpc_request_set_replen(req);
+       req->rq_request_portal = OUT_PORTAL;
+       req->rq_reply_portal = OSC_REPLY_PORTAL;
+
+       RETURN(rc);
+}
+
+/**
  * Prepare update request.
  *
  * Prepare OUT update ptlrpc request, and the request usually includes
@@ -273,11 +318,30 @@ int osp_prep_update_req(const struct lu_env *env, struct obd_import *imp,
                object_update_request_dump(ours->ours_req, D_INFO);
                buf_count++;
        }
+       LASSERT(buf_count > 0);
 
        req = ptlrpc_request_alloc(imp, &RQF_OUT_UPDATE);
        if (req == NULL)
                RETURN(-ENOMEM);
 
+       if (buf_count == 1) {
+               ours = list_entry(our->our_req_list.next,
+                                 struct osp_update_request_sub, ours_list);
+
+               /* Let's check if it can be packed inline */
+               if (object_update_request_size(ours->ours_req) +
+                   sizeof(struct out_update_header) <
+                               OUT_UPDATE_MAX_INLINE_SIZE) {
+                       rc = osp_prep_inline_update_req(env, req, ours);
+                       if (rc == 0)
+                               *reqp = req;
+                       GOTO(out_req, rc);
+               }
+       }
+
+       req_capsule_set_size(&req->rq_pill, &RMF_OUT_UPDATE_HEADER, RCL_CLIENT,
+                            sizeof(struct osp_update_request));
+
        req_capsule_set_size(&req->rq_pill, &RMF_OUT_UPDATE_BUF, RCL_CLIENT,
                             buf_count * sizeof(*oub));
 
@@ -288,7 +352,7 @@ int osp_prep_update_req(const struct lu_env *env, struct obd_import *imp,
        ouh = req_capsule_client_get(&req->rq_pill, &RMF_OUT_UPDATE_HEADER);
        ouh->ouh_magic = OUT_UPDATE_HEADER_MAGIC;
        ouh->ouh_count = buf_count;
-
+       ouh->ouh_inline_length = 0;
        oub = req_capsule_client_get(&req->rq_pill, &RMF_OUT_UPDATE_BUF);
        list_for_each_entry(ours, &our->our_req_list, ours_list) {
                oub->oub_size = ours->ours_req_size;
@@ -336,7 +400,6 @@ out_req:
  * \retval             0 if RPC succeeds.
  * \retval             negative errno if RPC fails.
  */
-
 int osp_remote_sync(const struct lu_env *env, struct osp_device *osp,
                    struct osp_update_request *our,
                    struct ptlrpc_request **reqp)
index 3a0d7dd..2e3efd5 100644 (file)
@@ -1203,9 +1203,8 @@ struct req_msg_field RMF_LFSCK_REPLY =
                    lustre_swab_lfsck_reply, NULL);
 EXPORT_SYMBOL(RMF_LFSCK_REPLY);
 
-struct req_msg_field RMF_OUT_UPDATE_HEADER = DEFINE_MSGF("out_update", 0,
-                               sizeof(struct out_update_header),
-                               lustre_swab_out_update_header, NULL);
+struct req_msg_field RMF_OUT_UPDATE_HEADER = DEFINE_MSGF("out_update_header", 0,
+                               -1, lustre_swab_out_update_header, NULL);
 EXPORT_SYMBOL(RMF_OUT_UPDATE_HEADER);
 
 struct req_msg_field RMF_OUT_UPDATE_BUF = DEFINE_MSGF("update_buf",
index 5898859..737e989 100644 (file)
@@ -2578,6 +2578,8 @@ void lustre_swab_out_update_header(struct out_update_header *ouh)
 {
        __swab32s(&ouh->ouh_magic);
        __swab32s(&ouh->ouh_count);
+       __swab32s(&ouh->ouh_inline_length);
+       __swab32s(&ouh->ouh_padding);
 }
 EXPORT_SYMBOL(lustre_swab_out_update_header);
 
index 689211b..9a76efc 100644 (file)
@@ -1191,6 +1191,8 @@ void lustre_assert_wire_constants(void)
                 OBD_CONNECT_MULTIMODRPCS);
        LASSERTF(OBD_CONNECT_DIR_STRIPE == 0x400000000000000ULL, "found 0x%.16llxULL\n",
                 OBD_CONNECT_DIR_STRIPE);
+       LASSERTF(OBD_CONNECT_BULK_MBITS == 0x2000000000000000ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT_BULK_MBITS);
        LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n",
                (unsigned)OBD_CKSUM_CRC32);
        LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",
@@ -4621,6 +4623,42 @@ void lustre_assert_wire_constants(void)
        LASSERTF((int)sizeof(((struct object_update_reply *)0)->ourp_lens) == 0, "found %lld\n",
                 (long long)(int)sizeof(((struct object_update_reply *)0)->ourp_lens));
 
+       /* Checks for struct out_update_header */
+       LASSERTF((int)sizeof(struct out_update_header) == 16, "found %lld\n",
+                (long long)(int)sizeof(struct out_update_header));
+       LASSERTF((int)offsetof(struct out_update_header, ouh_magic) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct out_update_header, ouh_magic));
+       LASSERTF((int)sizeof(((struct out_update_header *)0)->ouh_magic) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct out_update_header *)0)->ouh_magic));
+       LASSERTF((int)offsetof(struct out_update_header, ouh_count) == 4, "found %lld\n",
+                (long long)(int)offsetof(struct out_update_header, ouh_count));
+       LASSERTF((int)sizeof(((struct out_update_header *)0)->ouh_count) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct out_update_header *)0)->ouh_count));
+       LASSERTF((int)offsetof(struct out_update_header, ouh_inline_length) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct out_update_header, ouh_inline_length));
+       LASSERTF((int)sizeof(((struct out_update_header *)0)->ouh_inline_length) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct out_update_header *)0)->ouh_inline_length));
+       LASSERTF((int)offsetof(struct out_update_header, ouh_padding) == 12, "found %lld\n",
+                (long long)(int)offsetof(struct out_update_header, ouh_padding));
+       LASSERTF((int)sizeof(((struct out_update_header *)0)->ouh_padding) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct out_update_header *)0)->ouh_padding));
+       LASSERTF((int)offsetof(struct out_update_header, ouh_inline_data) == 16, "found %lld\n",
+                (long long)(int)offsetof(struct out_update_header, ouh_inline_data));
+       LASSERTF((int)sizeof(((struct out_update_header *)0)->ouh_inline_data) == 0, "found %lld\n",
+                (long long)(int)sizeof(((struct out_update_header *)0)->ouh_inline_data));
+
+       /* Checks for struct out_update_buffer */
+       LASSERTF((int)sizeof(struct out_update_buffer) == 8, "found %lld\n",
+                (long long)(int)sizeof(struct out_update_buffer));
+       LASSERTF((int)offsetof(struct out_update_buffer, oub_size) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct out_update_buffer, oub_size));
+       LASSERTF((int)sizeof(((struct out_update_buffer *)0)->oub_size) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct out_update_buffer *)0)->oub_size));
+       LASSERTF((int)offsetof(struct out_update_buffer, oub_padding) == 4, "found %lld\n",
+                (long long)(int)offsetof(struct out_update_buffer, oub_padding));
+       LASSERTF((int)sizeof(((struct out_update_buffer *)0)->oub_padding) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct out_update_buffer *)0)->oub_padding));
+
        /* Checks for struct lfsck_request */
        LASSERTF((int)sizeof(struct lfsck_request) == 96, "found %lld\n",
                 (long long)(int)sizeof(struct lfsck_request));
@@ -4746,4 +4784,82 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct lfsck_reply, lr_padding_2));
        LASSERTF((int)sizeof(((struct lfsck_reply *)0)->lr_padding_2) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct lfsck_reply *)0)->lr_padding_2));
+
+       /* Checks for struct update_params */
+       LASSERTF((int)sizeof(struct update_params) == 0, "found %lld\n",
+                (long long)(int)sizeof(struct update_params));
+       LASSERTF((int)offsetof(struct update_params, up_params) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct update_params, up_params));
+       LASSERTF((int)sizeof(((struct update_params *)0)->up_params) == 0, "found %lld\n",
+                (long long)(int)sizeof(((struct update_params *)0)->up_params));
+
+       /* Checks for struct update_op */
+       LASSERTF((int)sizeof(struct update_op) == 24, "found %lld\n",
+                (long long)(int)sizeof(struct update_op));
+       LASSERTF((int)offsetof(struct update_op, uop_fid) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct update_op, uop_fid));
+       LASSERTF((int)sizeof(((struct update_op *)0)->uop_fid) == 16, "found %lld\n",
+                (long long)(int)sizeof(((struct update_op *)0)->uop_fid));
+       LASSERTF((int)offsetof(struct update_op, uop_type) == 16, "found %lld\n",
+                (long long)(int)offsetof(struct update_op, uop_type));
+       LASSERTF((int)sizeof(((struct update_op *)0)->uop_type) == 2, "found %lld\n",
+                (long long)(int)sizeof(((struct update_op *)0)->uop_type));
+       LASSERTF((int)offsetof(struct update_op, uop_param_count) == 18, "found %lld\n",
+                (long long)(int)offsetof(struct update_op, uop_param_count));
+       LASSERTF((int)sizeof(((struct update_op *)0)->uop_param_count) == 2, "found %lld\n",
+                (long long)(int)sizeof(((struct update_op *)0)->uop_param_count));
+       LASSERTF((int)offsetof(struct update_op, uop_params_off) == 20, "found %lld\n",
+                (long long)(int)offsetof(struct update_op, uop_params_off));
+       LASSERTF((int)sizeof(((struct update_op *)0)->uop_params_off) == 0, "found %lld\n",
+                (long long)(int)sizeof(((struct update_op *)0)->uop_params_off));
+
+       /* Checks for struct update_ops */
+       LASSERTF((int)sizeof(struct update_ops) == 0, "found %lld\n",
+                (long long)(int)sizeof(struct update_ops));
+       LASSERTF((int)offsetof(struct update_ops, uops_op) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct update_ops, uops_op));
+       LASSERTF((int)sizeof(((struct update_ops *)0)->uops_op) == 0, "found %lld\n",
+                (long long)(int)sizeof(((struct update_ops *)0)->uops_op));
+
+       /* Checks for struct update_records */
+       LASSERTF((int)sizeof(struct update_records) == 32, "found %lld\n",
+                (long long)(int)sizeof(struct update_records));
+       LASSERTF((int)offsetof(struct update_records, ur_master_transno) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct update_records, ur_master_transno));
+       LASSERTF((int)sizeof(((struct update_records *)0)->ur_master_transno) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct update_records *)0)->ur_master_transno));
+       LASSERTF((int)offsetof(struct update_records, ur_batchid) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct update_records, ur_batchid));
+       LASSERTF((int)sizeof(((struct update_records *)0)->ur_batchid) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct update_records *)0)->ur_batchid));
+       LASSERTF((int)offsetof(struct update_records, ur_flags) == 16, "found %lld\n",
+                (long long)(int)offsetof(struct update_records, ur_flags));
+       LASSERTF((int)sizeof(((struct update_records *)0)->ur_flags) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct update_records *)0)->ur_flags));
+       LASSERTF((int)offsetof(struct update_records, ur_index) == 20, "found %lld\n",
+                (long long)(int)offsetof(struct update_records, ur_index));
+       LASSERTF((int)sizeof(((struct update_records *)0)->ur_index) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct update_records *)0)->ur_index));
+       LASSERTF((int)offsetof(struct update_records, ur_update_count) == 24, "found %lld\n",
+                (long long)(int)offsetof(struct update_records, ur_update_count));
+       LASSERTF((int)sizeof(((struct update_records *)0)->ur_update_count) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct update_records *)0)->ur_update_count));
+       LASSERTF((int)offsetof(struct update_records, ur_param_count) == 28, "found %lld\n",
+                (long long)(int)offsetof(struct update_records, ur_param_count));
+       LASSERTF((int)sizeof(((struct update_records *)0)->ur_param_count) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct update_records *)0)->ur_param_count));
+       LASSERTF(UPDATE_RECORD_CONTINUE == 0x00000001UL, "found 0x%.8xUL\n",
+               (unsigned)UPDATE_RECORD_CONTINUE);
+
+       /* Checks for struct llog_update_record */
+       LASSERTF((int)sizeof(struct llog_update_record) == 48, "found %lld\n",
+                (long long)(int)sizeof(struct llog_update_record));
+       LASSERTF((int)offsetof(struct llog_update_record, lur_hdr) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct llog_update_record, lur_hdr));
+       LASSERTF((int)sizeof(((struct llog_update_record *)0)->lur_hdr) == 16, "found %lld\n",
+                (long long)(int)sizeof(((struct llog_update_record *)0)->lur_hdr));
+       LASSERTF((int)offsetof(struct llog_update_record, lur_update_rec) == 16, "found %lld\n",
+                (long long)(int)offsetof(struct llog_update_record, lur_update_rec));
+       LASSERTF((int)sizeof(((struct llog_update_record *)0)->lur_update_rec) == 32, "found %lld\n",
+                (long long)(int)sizeof(((struct llog_update_record *)0)->lur_update_rec));
 }
index 9ee9e73..002cda2 100644 (file)
@@ -863,10 +863,10 @@ int out_handle(struct tgt_session_info *tsi)
        struct req_capsule              *pill = tsi->tsi_pill;
        struct dt_device                *dt = tsi->tsi_tgt->lut_bottom;
        struct out_update_header        *ouh;
-       struct out_update_buffer        *oub;
+       struct out_update_buffer        *oub = NULL;
        struct object_update            *update;
        struct object_update_reply      *reply;
-       struct ptlrpc_bulk_desc         *desc;
+       struct ptlrpc_bulk_desc         *desc = NULL;
        struct l_wait_info              lwi;
        void                            **update_bufs;
        int                             current_batchid = -1;
@@ -875,16 +875,18 @@ int out_handle(struct tgt_session_info *tsi)
        unsigned int                    reply_index = 0;
        int                             rc = 0;
        int                             rc1 = 0;
-
+       int                             ouh_size;
        ENTRY;
 
        req_capsule_set(pill, &RQF_OUT_UPDATE);
+       ouh_size = req_capsule_get_size(pill, &RMF_OUT_UPDATE_HEADER,
+                                       RCL_CLIENT);
+       if (ouh_size <= 0)
+               RETURN(err_serious(-EPROTO));
+
        ouh = req_capsule_client_get(pill, &RMF_OUT_UPDATE_HEADER);
-       if (ouh == NULL) {
-               CERROR("%s: No buf!: rc = %d\n", tgt_name(tsi->tsi_tgt),
-                      -EPROTO);
+       if (ouh == NULL)
                RETURN(err_serious(-EPROTO));
-       }
 
        if (ouh->ouh_magic != OUT_UPDATE_HEADER_MAGIC) {
                CERROR("%s: invalid update buffer magic %x expect %x: "
@@ -894,11 +896,8 @@ int out_handle(struct tgt_session_info *tsi)
        }
 
        update_buf_count = ouh->ouh_count;
-       if (update_buf_count == 0) {
-               CERROR("%s: empty update: rc = %d\n", tgt_name(tsi->tsi_tgt),
-                      -EPROTO);
+       if (update_buf_count == 0)
                RETURN(err_serious(-EPROTO));
-       }
 
        req_capsule_set_size(pill, &RMF_OUT_UPDATE_REPLY, RCL_SERVER,
                             OUT_UPDATE_REPLY_SIZE);
@@ -913,34 +912,46 @@ int out_handle(struct tgt_session_info *tsi)
        if (update_bufs == NULL)
                RETURN(-ENOMEM);
 
-       oub = req_capsule_client_get(pill, &RMF_OUT_UPDATE_BUF);
-       desc = ptlrpc_prep_bulk_exp(pill->rc_req, update_buf_count,
-                                   PTLRPC_BULK_OPS_COUNT,
-                                   PTLRPC_BULK_GET_SINK |
-                                   PTLRPC_BULK_BUF_KVEC,
-                                   MDS_BULK_PORTAL, &ptlrpc_bulk_kvec_ops);
-       if (desc == NULL)
-               GOTO(out_free, rc = -ENOMEM);
-
-       /* NB Having prepped, we must commit... */
-       for (i = 0; i < update_buf_count; i++, oub++) {
-               OBD_ALLOC(update_bufs[i], oub->oub_size);
-               if (update_bufs[i] == NULL)
+       if (ouh->ouh_inline_length > 0) {
+               update_bufs[0] = ouh->ouh_inline_data;
+       } else {
+               struct out_update_buffer *tmp;
+
+               oub = req_capsule_client_get(pill, &RMF_OUT_UPDATE_BUF);
+               if (oub == NULL)
+                       GOTO(out_free, rc = -EPROTO);
+
+               desc = ptlrpc_prep_bulk_exp(pill->rc_req, update_buf_count,
+                                           PTLRPC_BULK_OPS_COUNT,
+                                           PTLRPC_BULK_GET_SINK |
+                                           PTLRPC_BULK_BUF_KVEC,
+                                           MDS_BULK_PORTAL,
+                                           &ptlrpc_bulk_kvec_ops);
+               if (desc == NULL)
                        GOTO(out_free, rc = -ENOMEM);
 
-               desc->bd_frag_ops->add_iov_frag(desc, update_bufs[i],
-                                               oub->oub_size);
-       }
+               tmp = oub;
+               for (i = 0; i < update_buf_count; i++, tmp++) {
+                       if (tmp->oub_size >= OUT_MAXREQSIZE)
+                               GOTO(out_free, rc = -EPROTO);
 
-       pill->rc_req->rq_bulk_write = 1;
-       rc = sptlrpc_svc_prep_bulk(pill->rc_req, desc);
-       if (rc != 0)
-               GOTO(out_free, rc);
+                       OBD_ALLOC(update_bufs[i], tmp->oub_size);
+                       if (update_bufs[i] == NULL)
+                               GOTO(out_free, rc = -ENOMEM);
 
-       rc = target_bulk_io(pill->rc_req->rq_export, desc, &lwi);
-       if (rc < 0)
-               GOTO(out_free, rc);
+                       desc->bd_frag_ops->add_iov_frag(desc, update_bufs[i],
+                                                       tmp->oub_size);
+               }
 
+               pill->rc_req->rq_bulk_write = 1;
+               rc = sptlrpc_svc_prep_bulk(pill->rc_req, desc);
+               if (rc != 0)
+                       GOTO(out_free, rc);
+
+               rc = target_bulk_io(pill->rc_req->rq_export, desc, &lwi);
+               if (rc < 0)
+                       GOTO(out_free, rc);
+       }
        /* Prepare the update reply buffer */
        reply = req_capsule_server_get(pill, &RMF_OUT_UPDATE_REPLY);
        if (reply == NULL)
@@ -1078,14 +1089,15 @@ out:
        }
 
 out_free:
-       oub = req_capsule_client_get(pill, &RMF_OUT_UPDATE_BUF);
        if (update_bufs != NULL) {
-               for (i = 0; i < update_buf_count; i++, oub++) {
-                       if (update_bufs[i] != NULL)
-                               OBD_FREE(update_bufs[i], oub->oub_size);
+               if (oub != NULL) {
+                       for (i = 0; i < update_buf_count; i++, oub++) {
+                               if (update_bufs[i] != NULL)
+                                       OBD_FREE(update_bufs[i], oub->oub_size);
+                       }
                }
-               OBD_FREE(update_bufs, sizeof(update_bufs[0]) *
-                                       update_buf_count);
+
+               OBD_FREE(update_bufs, sizeof(*update_bufs) * update_buf_count);
        }
 
        if (desc != NULL)
index 6888021..deb7437 100644 (file)
@@ -2111,6 +2111,25 @@ static void check_object_update_reply(void)
        CHECK_MEMBER(object_update_reply, ourp_lens);
 }
 
+static void check_out_update_header(void)
+{
+       BLANK_LINE();
+       CHECK_STRUCT(out_update_header);
+       CHECK_MEMBER(out_update_header, ouh_magic);
+       CHECK_MEMBER(out_update_header, ouh_count);
+       CHECK_MEMBER(out_update_header, ouh_inline_length);
+       CHECK_MEMBER(out_update_header, ouh_padding);
+       CHECK_MEMBER(out_update_header, ouh_inline_data);
+}
+
+static void check_out_update_buffer(void)
+{
+       BLANK_LINE();
+       CHECK_STRUCT(out_update_buffer);
+       CHECK_MEMBER(out_update_buffer, oub_size);
+       CHECK_MEMBER(out_update_buffer, oub_padding);
+}
+
 static void check_lfsck_request(void)
 {
        BLANK_LINE();
@@ -2604,6 +2623,8 @@ main(int argc, char **argv)
        check_object_update_request();
        check_object_update_result();
        check_object_update_reply();
+       check_out_update_header();
+       check_out_update_buffer();
 
        check_lfsck_request();
        check_lfsck_reply();
index b54c7de..b8b939e 100644 (file)
@@ -872,7 +872,6 @@ void lustre_assert_wire_constants(void)
                 (int)offsetof(struct ptlrpc_body_v3, pb_padding64_2), (int)offsetof(struct ptlrpc_body_v2, pb_padding64_2));
        LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_padding64_2) == (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_padding64_2), "%d != %d\n",
                 (int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_padding64_2), (int)sizeof(((struct ptlrpc_body_v2 *)0)->pb_padding64_2));
-
        LASSERTF(MSG_PTLRPC_BODY_OFF == 0, "found %lld\n",
                 (long long)MSG_PTLRPC_BODY_OFF);
        LASSERTF(REQ_REC_OFF == 1, "found %lld\n",
@@ -1199,6 +1198,8 @@ void lustre_assert_wire_constants(void)
                 OBD_CONNECT_MULTIMODRPCS);
        LASSERTF(OBD_CONNECT_DIR_STRIPE == 0x400000000000000ULL, "found 0x%.16llxULL\n",
                 OBD_CONNECT_DIR_STRIPE);
+       LASSERTF(OBD_CONNECT_BULK_MBITS == 0x2000000000000000ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT_BULK_MBITS);
        LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n",
                (unsigned)OBD_CKSUM_CRC32);
        LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",
@@ -4629,6 +4630,42 @@ void lustre_assert_wire_constants(void)
        LASSERTF((int)sizeof(((struct object_update_reply *)0)->ourp_lens) == 0, "found %lld\n",
                 (long long)(int)sizeof(((struct object_update_reply *)0)->ourp_lens));
 
+       /* Checks for struct out_update_header */
+       LASSERTF((int)sizeof(struct out_update_header) == 16, "found %lld\n",
+                (long long)(int)sizeof(struct out_update_header));
+       LASSERTF((int)offsetof(struct out_update_header, ouh_magic) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct out_update_header, ouh_magic));
+       LASSERTF((int)sizeof(((struct out_update_header *)0)->ouh_magic) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct out_update_header *)0)->ouh_magic));
+       LASSERTF((int)offsetof(struct out_update_header, ouh_count) == 4, "found %lld\n",
+                (long long)(int)offsetof(struct out_update_header, ouh_count));
+       LASSERTF((int)sizeof(((struct out_update_header *)0)->ouh_count) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct out_update_header *)0)->ouh_count));
+       LASSERTF((int)offsetof(struct out_update_header, ouh_inline_length) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct out_update_header, ouh_inline_length));
+       LASSERTF((int)sizeof(((struct out_update_header *)0)->ouh_inline_length) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct out_update_header *)0)->ouh_inline_length));
+       LASSERTF((int)offsetof(struct out_update_header, ouh_padding) == 12, "found %lld\n",
+                (long long)(int)offsetof(struct out_update_header, ouh_padding));
+       LASSERTF((int)sizeof(((struct out_update_header *)0)->ouh_padding) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct out_update_header *)0)->ouh_padding));
+       LASSERTF((int)offsetof(struct out_update_header, ouh_inline_data) == 16, "found %lld\n",
+                (long long)(int)offsetof(struct out_update_header, ouh_inline_data));
+       LASSERTF((int)sizeof(((struct out_update_header *)0)->ouh_inline_data) == 0, "found %lld\n",
+                (long long)(int)sizeof(((struct out_update_header *)0)->ouh_inline_data));
+
+       /* Checks for struct out_update_buffer */
+       LASSERTF((int)sizeof(struct out_update_buffer) == 8, "found %lld\n",
+                (long long)(int)sizeof(struct out_update_buffer));
+       LASSERTF((int)offsetof(struct out_update_buffer, oub_size) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct out_update_buffer, oub_size));
+       LASSERTF((int)sizeof(((struct out_update_buffer *)0)->oub_size) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct out_update_buffer *)0)->oub_size));
+       LASSERTF((int)offsetof(struct out_update_buffer, oub_padding) == 4, "found %lld\n",
+                (long long)(int)offsetof(struct out_update_buffer, oub_padding));
+       LASSERTF((int)sizeof(((struct out_update_buffer *)0)->oub_padding) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct out_update_buffer *)0)->oub_padding));
+
        /* Checks for struct lfsck_request */
        LASSERTF((int)sizeof(struct lfsck_request) == 96, "found %lld\n",
                 (long long)(int)sizeof(struct lfsck_request));
@@ -4754,4 +4791,82 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct lfsck_reply, lr_padding_2));
        LASSERTF((int)sizeof(((struct lfsck_reply *)0)->lr_padding_2) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct lfsck_reply *)0)->lr_padding_2));
+
+       /* Checks for struct update_params */
+       LASSERTF((int)sizeof(struct update_params) == 0, "found %lld\n",
+                (long long)(int)sizeof(struct update_params));
+       LASSERTF((int)offsetof(struct update_params, up_params) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct update_params, up_params));
+       LASSERTF((int)sizeof(((struct update_params *)0)->up_params) == 0, "found %lld\n",
+                (long long)(int)sizeof(((struct update_params *)0)->up_params));
+
+       /* Checks for struct update_op */
+       LASSERTF((int)sizeof(struct update_op) == 24, "found %lld\n",
+                (long long)(int)sizeof(struct update_op));
+       LASSERTF((int)offsetof(struct update_op, uop_fid) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct update_op, uop_fid));
+       LASSERTF((int)sizeof(((struct update_op *)0)->uop_fid) == 16, "found %lld\n",
+                (long long)(int)sizeof(((struct update_op *)0)->uop_fid));
+       LASSERTF((int)offsetof(struct update_op, uop_type) == 16, "found %lld\n",
+                (long long)(int)offsetof(struct update_op, uop_type));
+       LASSERTF((int)sizeof(((struct update_op *)0)->uop_type) == 2, "found %lld\n",
+                (long long)(int)sizeof(((struct update_op *)0)->uop_type));
+       LASSERTF((int)offsetof(struct update_op, uop_param_count) == 18, "found %lld\n",
+                (long long)(int)offsetof(struct update_op, uop_param_count));
+       LASSERTF((int)sizeof(((struct update_op *)0)->uop_param_count) == 2, "found %lld\n",
+                (long long)(int)sizeof(((struct update_op *)0)->uop_param_count));
+       LASSERTF((int)offsetof(struct update_op, uop_params_off) == 20, "found %lld\n",
+                (long long)(int)offsetof(struct update_op, uop_params_off));
+       LASSERTF((int)sizeof(((struct update_op *)0)->uop_params_off) == 0, "found %lld\n",
+                (long long)(int)sizeof(((struct update_op *)0)->uop_params_off));
+
+       /* Checks for struct update_ops */
+       LASSERTF((int)sizeof(struct update_ops) == 0, "found %lld\n",
+                (long long)(int)sizeof(struct update_ops));
+       LASSERTF((int)offsetof(struct update_ops, uops_op) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct update_ops, uops_op));
+       LASSERTF((int)sizeof(((struct update_ops *)0)->uops_op) == 0, "found %lld\n",
+                (long long)(int)sizeof(((struct update_ops *)0)->uops_op));
+
+       /* Checks for struct update_records */
+       LASSERTF((int)sizeof(struct update_records) == 32, "found %lld\n",
+                (long long)(int)sizeof(struct update_records));
+       LASSERTF((int)offsetof(struct update_records, ur_master_transno) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct update_records, ur_master_transno));
+       LASSERTF((int)sizeof(((struct update_records *)0)->ur_master_transno) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct update_records *)0)->ur_master_transno));
+       LASSERTF((int)offsetof(struct update_records, ur_batchid) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct update_records, ur_batchid));
+       LASSERTF((int)sizeof(((struct update_records *)0)->ur_batchid) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct update_records *)0)->ur_batchid));
+       LASSERTF((int)offsetof(struct update_records, ur_flags) == 16, "found %lld\n",
+                (long long)(int)offsetof(struct update_records, ur_flags));
+       LASSERTF((int)sizeof(((struct update_records *)0)->ur_flags) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct update_records *)0)->ur_flags));
+       LASSERTF((int)offsetof(struct update_records, ur_index) == 20, "found %lld\n",
+                (long long)(int)offsetof(struct update_records, ur_index));
+       LASSERTF((int)sizeof(((struct update_records *)0)->ur_index) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct update_records *)0)->ur_index));
+       LASSERTF((int)offsetof(struct update_records, ur_update_count) == 24, "found %lld\n",
+                (long long)(int)offsetof(struct update_records, ur_update_count));
+       LASSERTF((int)sizeof(((struct update_records *)0)->ur_update_count) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct update_records *)0)->ur_update_count));
+       LASSERTF((int)offsetof(struct update_records, ur_param_count) == 28, "found %lld\n",
+                (long long)(int)offsetof(struct update_records, ur_param_count));
+       LASSERTF((int)sizeof(((struct update_records *)0)->ur_param_count) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct update_records *)0)->ur_param_count));
+       LASSERTF(UPDATE_RECORD_CONTINUE == 0x00000001UL, "found 0x%.8xUL\n",
+               (unsigned)UPDATE_RECORD_CONTINUE);
+
+       /* Checks for struct llog_update_record */
+       LASSERTF((int)sizeof(struct llog_update_record) == 48, "found %lld\n",
+                (long long)(int)sizeof(struct llog_update_record));
+       LASSERTF((int)offsetof(struct llog_update_record, lur_hdr) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct llog_update_record, lur_hdr));
+       LASSERTF((int)sizeof(((struct llog_update_record *)0)->lur_hdr) == 16, "found %lld\n",
+                (long long)(int)sizeof(((struct llog_update_record *)0)->lur_hdr));
+       LASSERTF((int)offsetof(struct llog_update_record, lur_update_rec) == 16, "found %lld\n",
+                (long long)(int)offsetof(struct llog_update_record, lur_update_rec));
+       LASSERTF((int)sizeof(((struct llog_update_record *)0)->lur_update_rec) == 32, "found %lld\n",
+                (long long)(int)sizeof(((struct llog_update_record *)0)->lur_update_rec));
 }