+ size[DLM_INTENT_REC_OFF] = sizeof(struct mds_rec_create);
+ size[DLM_INTENT_REC_OFF + 1] = data->namelen + 1;
+ /* As an optimization, we allocate an RPC request buffer for
+ * at least a default-sized LOV EA even if we aren't sending
+ * one. We grow the whole request to the next power-of-two
+ * size since we get that much from a slab allocation anyways.
+ * This avoids an allocation below in the common case where
+ * we need to save a default-sized LOV EA for open replay. */
+ size[DLM_INTENT_REC_OFF + 2] = max(lmmsize,
+ obddev->u.cli.cl_default_mds_easize);
+ rc = lustre_msg_size(class_exp2cliimp(exp)->imp_msg_magic, 6,
+ size);
+ if (rc & (rc - 1))
+ size[DLM_INTENT_REC_OFF + 2] =
+ min(size[DLM_INTENT_REC_OFF+2]+round_up(rc)-rc,
+ obddev->u.cli.cl_max_mds_easize);
+
+ if (it->it_flags & O_JOIN_FILE) {
+ __u64 head_size = *(__u32*)cb_data;
+ __u32 tsize = *(__u32*)lmm;
+
+ /* join is like an unlink of the tail */
+ policy.l_inodebits.bits = MDS_INODELOCK_UPDATE;
+ size[DLM_INTENT_REC_OFF + 3] =
+ sizeof(struct mds_rec_join);
+ req = ptlrpc_prep_req(class_exp2cliimp(exp),
+ LUSTRE_DLM_VERSION, LDLM_ENQUEUE,
+ 7, size, NULL);
+ /* when joining file, cb_data and lmm args together
+ * indicate the head file size*/
+ mdc_join_pack(req, DLM_INTENT_REC_OFF + 3, data,
+ (head_size << 32) | tsize);
+ cb_data = NULL;
+ lmm = NULL;
+ } else {
+ req = ptlrpc_prep_req(class_exp2cliimp(exp),
+ LUSTRE_DLM_VERSION, LDLM_ENQUEUE,
+ 6, size, NULL);
+ }
+