return size_round(offsetof(struct lustre_msg_v2, lm_buflens[count]));
}
-int lustre_msg_swabbed(struct lustre_msg *msg)
+static int lustre_msg_need_swab(struct lustre_msg *msg)
{
return (msg->lm_magic == LUSTRE_MSG_MAGIC_V1_SWABBED) ||
(msg->lm_magic == LUSTRE_MSG_MAGIC_V2_SWABBED);
}
-static inline int
-lustre_msg_check_version_v2(struct lustre_msg_v2 *msg, __u32 version)
+int lustre_msg_check_version_v2(struct lustre_msg_v2 *msg, __u32 version)
{
__u32 ver = lustre_msg_get_version(msg);
return (ver & LUSTRE_VERSION_MASK) != version;
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return 0;
case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED:
return lustre_msg_check_version_v2(msg, version);
default:
- LASSERTF(0, "incorrect message magic: %08x\n", msg->lm_magic);
+ CERROR("incorrect message magic: %08x\n", msg->lm_magic);
return -EINVAL;
}
}
+static int ptlrpc_reqbuf_need_swab(struct ptlrpc_request *req, int index)
+{
+ int swabb;
+
+ swabb = (!lustre_req_need_swab(req)) ||
+ lustre_req_swabbed(req, index);
+
+ return !swabb;
+}
+
+static int ptlrpc_repbuf_need_swab(struct ptlrpc_request *req, int index)
+{
+ int swabb;
+
+ swabb = (!lustre_rep_need_swab(req)) ||
+ lustre_rep_swabbed(req, index);
+
+ return !swabb;
+}
+
+
/* early reply size */
int lustre_msg_early_size() {
static int size = 0;
- if (!size)
+ if (!size)
size = lustre_msg_size(LUSTRE_MSG_MAGIC_V2, 1, NULL);
return size;
}
goto out;
spin_lock(&svc->srv_lock);
}
-
+
rs = list_entry(svc->srv_free_rs_list.next, struct ptlrpc_reply_state,
rs_list);
list_del(&rs->rs_list);
switch (req->rq_reqmsg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return lustre_pack_reply_v1(req, count - 1, lens + 1,
bufs ? bufs + 1 : NULL, flags);
case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED:
return lustre_pack_reply_v2(req, count, lens, bufs, flags);
default:
- LASSERTF(0, "incorrect message magic: %08x\n",
+ CERROR("incorrect message magic: %08x\n",
req->rq_reqmsg->lm_magic);
return -EINVAL;
}
{
switch (m->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return lustre_msg_buf_v1(m, n - 1, min_size);
case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED:
return lustre_msg_buf_v2(m, n, min_size);
default:
- LASSERTF(0, "incorrect message magic: %08x\n", m->lm_magic);
+ CERROR("incorrect message magic: %08x\n", m->lm_magic);
return NULL;
}
}
RETURN(-EINVAL);
}
- flipped = lustre_msg_swabbed((struct lustre_msg *)m);
-
+ flipped = m->lm_magic == LUSTRE_MSG_MAGIC_V1_SWABBED;
if (flipped) {
+ __swab32s(&m->lm_magic);
__swab32s(&m->lm_type);
__swab32s(&m->lm_version);
__swab32s(&m->lm_opc);
RETURN(-EINVAL);
}
- flipped = lustre_msg_swabbed(m);
-
+ flipped = m->lm_magic == LUSTRE_MSG_MAGIC_V2_SWABBED;
if (flipped) {
+ __swab32s(&m->lm_magic);
__swab32s(&m->lm_bufcount);
__swab32s(&m->lm_secflvr);
__swab32s(&m->lm_repsize);
return 0;
}
+/*
+ * return 1 if some endianness conversions are needed for the req buffers,
+ * 0 if not neeed, or
+ * -EINVAL if message has wrong magic
+ */
int lustre_unpack_msg(struct lustre_msg *m, int len)
{
int required_len, rc;
+ int swab_needed;
ENTRY;
/* We can provide a slightly better error log, if we check the
RETURN(-EINVAL);
}
+ swab_needed = lustre_msg_need_swab(m);
+
switch (m->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
case LUSTRE_MSG_MAGIC_V1_SWABBED:
rc = lustre_unpack_msg_v2(m, len);
break;
default:
- CERROR("bad lustre msg magic: %#08X\n", m->lm_magic);
+ CERROR("incorrect message magic: %08x\n", m->lm_magic);
return -EINVAL;
}
+ if (!rc)
+ rc = swab_needed;
+
RETURN(rc);
}
static inline int lustre_unpack_ptlrpc_body_v2(struct lustre_msg_v2 *m,
- int offset)
+ int offset, int swab_needed)
{
struct ptlrpc_body *pb;
CERROR("error unpacking ptlrpc body\n");
return -EFAULT;
}
- if (lustre_msg_swabbed(m))
+ if (swab_needed)
lustre_swab_ptlrpc_body(pb);
if ((pb->pb_version & ~LUSTRE_VERSION_MASK) != PTLRPC_MSG_VERSION) {
{
switch (req->rq_reqmsg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return 0;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED:
+ case LUSTRE_MSG_MAGIC_V2: {
+ int swab_needed = ptlrpc_reqbuf_need_swab(req, offset);
lustre_set_req_swabbed(req, offset);
- return lustre_unpack_ptlrpc_body_v2(req->rq_reqmsg, offset);
+ return lustre_unpack_ptlrpc_body_v2(req->rq_reqmsg, offset,
+ swab_needed);
+ }
default:
- CERROR("bad lustre msg magic: %#08X\n",
+ CERROR("incorrect message magic: %08x\n",
req->rq_reqmsg->lm_magic);
return -EINVAL;
}
{
switch (req->rq_repmsg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return 0;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED:
+ case LUSTRE_MSG_MAGIC_V2:{
+ int swab_needed = ptlrpc_repbuf_need_swab(req, offset);
lustre_set_rep_swabbed(req, offset);
- return lustre_unpack_ptlrpc_body_v2(req->rq_repmsg, offset);
+ return lustre_unpack_ptlrpc_body_v2(req->rq_repmsg, offset,
+ swab_needed);
+ }
default:
- CERROR("bad lustre msg magic: %#08X\n",
+ CERROR("incorrect message magic: %08x\n",
req->rq_repmsg->lm_magic);
return -EINVAL;
}
{
switch (m->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return lustre_msg_buflen_v1(m, n - 1);
case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED:
return lustre_msg_buflen_v2(m, n);
default:
CERROR("incorrect message magic: %08x\n", m->lm_magic);
{
switch (m->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return ((struct lustre_msg_v1 *)m)->lm_bufcount + 1;
case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED:
return m->lm_bufcount;
default:
CERROR("incorrect message magic: %08x\n", m->lm_magic);
switch (m->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
str = lustre_msg_buf_v1(m, index - 1, 0);
blen = lustre_msg_buflen_v1(m, index - 1);
break;
case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED:
str = lustre_msg_buf_v2(m, index, 0);
blen = lustre_msg_buflen_v2(m, index);
break;
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
ptr = lustre_msg_buf_v1(msg, index - 1, min_size);
break;
case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED:
ptr = lustre_msg_buf_v2(msg, index, min_size);
break;
default:
if (ptr == NULL)
return NULL;
- if (swabber != NULL && lustre_msg_swabbed(msg))
+ if (swabber != NULL) {
+ CDEBUG(D_NET, "Swab buffer %d\n", index);
((void (*)(void *))swabber)(ptr);
+ }
return ptr;
}
void *lustre_swab_reqbuf(struct ptlrpc_request *req, int index, int min_size,
void *swabber)
{
+ if (!ptlrpc_reqbuf_need_swab(req, index))
+ swabber = NULL;
+
lustre_set_req_swabbed(req, index);
return lustre_swab_buf(req->rq_reqmsg, index, min_size, swabber);
}
void *lustre_swab_repbuf(struct ptlrpc_request *req, int index, int min_size,
void *swabber)
{
+ if (!ptlrpc_repbuf_need_swab(req, index))
+ swabber = NULL;
+
lustre_set_rep_swabbed(req, index);
return lustre_swab_buf(req->rq_repmsg, index, min_size, swabber);
}
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return 0;
case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED:
/* already in host endian */
return msg->lm_flags;
default:
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return ((struct lustre_msg_v1 *)msg)->lm_flags &
MSG_GEN_FLAG_MASK;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
return pb->pb_flags;
}
default:
+ CERROR("Wrong magic %x\n", msg->lm_magic);
/* flags might be printed in debug code while message
* uninitialized */
return 0;
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
((struct lustre_msg_v1 *)msg)->lm_flags &=
~(MSG_GEN_FLAG_MASK & flags);
return;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return ((struct lustre_msg_v1 *)msg)->lm_flags >>
MSG_OP_FLAG_SHIFT;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
return pb->pb_op_flags;
}
default:
+ CERROR("incorrect message magic: %08x\n", msg->lm_magic);
return 0;
}
}
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return &((struct lustre_msg_v1 *)msg)->lm_handle;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return ((struct lustre_msg_v1 *)msg)->lm_type;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return ((struct lustre_msg_v1 *)msg)->lm_version;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return ((struct lustre_msg_v1 *)msg)->lm_opc;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return ((struct lustre_msg_v1 *)msg)->lm_last_xid;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return ((struct lustre_msg_v1 *)msg)->lm_last_committed;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return ((struct lustre_msg_v1 *)msg)->lm_transno;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
return pb->pb_status;
}
default:
+ CERROR("incorrect message magic: %08x\n", msg->lm_magic);
/* status might be printed in debug code while message
* uninitialized */
return -EINVAL;
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return 1;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
return pb->pb_slv;
}
default:
- CERROR("invalid msg magic %x\n", msg->lm_magic);
+ CERROR("incorrect message magic: %08x\n", msg->lm_magic);
return -EINVAL;
}
}
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
return;
}
default:
- CERROR("invalid msg magic %x\n", msg->lm_magic);
+ CERROR("incorrect message magic: %08x\n", msg->lm_magic);
return;
}
}
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return 1;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
return pb->pb_limit;
}
default:
- CERROR("invalid msg magic %x\n", msg->lm_magic);
+ CERROR("incorrect message magic: %08x\n", msg->lm_magic);
return -EINVAL;
}
}
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
return;
}
default:
- CERROR("invalid msg magic %x\n", msg->lm_magic);
+ CERROR("incorrect message magic: %08x\n", msg->lm_magic);
return;
}
}
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return ((struct lustre_msg_v1 *)msg)->lm_conn_cnt;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return 0;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
-
+
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
if (!pb) {
CERROR("invalid msg %p: no ptlrpc body!\n", msg);
return 0;
-
}
return pb->pb_timeout;
}
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return 0;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
-
+
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
if (!pb) {
CERROR("invalid msg %p: no ptlrpc body!\n", msg);
return 0;
-
}
return pb->pb_service_time;
}
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return 0;
case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED:
return msg->lm_cksum;
default:
CERROR("incorrect message magic: %08x\n", msg->lm_magic);
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return 0;
- case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED: {
+ case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
return;
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb;
-
+
pb = lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF, sizeof(*pb));
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
pb->pb_timeout = timeout;
/* uuid endian insensitive */
}
-static void print_lum (struct lov_user_md *lum)
-{
- CDEBUG(D_OTHER, "lov_user_md %p:\n", lum);
- CDEBUG(D_OTHER, "\tlmm_magic: %#x\n", lum->lmm_magic);
- CDEBUG(D_OTHER, "\tlmm_pattern: %#x\n", lum->lmm_pattern);
- CDEBUG(D_OTHER, "\tlmm_object_id: "LPU64"\n", lum->lmm_object_id);
- CDEBUG(D_OTHER, "\tlmm_object_gr: "LPU64"\n", lum->lmm_object_gr);
- CDEBUG(D_OTHER, "\tlmm_stripe_size: %#x\n", lum->lmm_stripe_size);
- CDEBUG(D_OTHER, "\tlmm_stripe_count: %#x\n", lum->lmm_stripe_count);
- CDEBUG(D_OTHER, "\tlmm_stripe_offset: %#x\n", lum->lmm_stripe_offset);
-}
void lustre_swab_lov_user_md(struct lov_user_md *lum)
{
__swab32s(&lum->lmm_stripe_size);
__swab16s(&lum->lmm_stripe_count);
__swab16s(&lum->lmm_stripe_offset);
- print_lum(lum);
EXIT;
}
-static void print_lumj (struct lov_user_md_join *lumj)
-{
- CDEBUG(D_OTHER, "lov_user_md %p:\n", lumj);
- CDEBUG(D_OTHER, "\tlmm_magic: %#x\n", lumj->lmm_magic);
- CDEBUG(D_OTHER, "\tlmm_pattern: %#x\n", lumj->lmm_pattern);
- CDEBUG(D_OTHER, "\tlmm_object_id: "LPU64"\n", lumj->lmm_object_id);
- CDEBUG(D_OTHER, "\tlmm_object_gr: "LPU64"\n", lumj->lmm_object_gr);
- CDEBUG(D_OTHER, "\tlmm_stripe_size: %#x\n", lumj->lmm_stripe_size);
- CDEBUG(D_OTHER, "\tlmm_stripe_count: %#x\n", lumj->lmm_stripe_count);
- CDEBUG(D_OTHER, "\tlmm_extent_count: %#x\n", lumj->lmm_extent_count);
-}
-
void lustre_swab_lov_user_md_join(struct lov_user_md_join *lumj)
{
ENTRY;
__swab32s(&lumj->lmm_stripe_size);
__swab32s(&lumj->lmm_stripe_count);
__swab32s(&lumj->lmm_extent_count);
- print_lumj(lumj);
- EXIT;
-}
-
-static void print_lum_objs(struct lov_user_md *lum)
-{
- struct lov_user_ost_data *lod;
- int i;
- ENTRY;
- if (!(libcfs_debug & D_OTHER)) /* don't loop on nothing */
- return;
- CDEBUG(D_OTHER, "lov_user_md_objects: %p\n", lum);
- for (i = 0; i < lum->lmm_stripe_count; i++) {
- lod = &lum->lmm_objects[i];
- CDEBUG(D_OTHER, "(%i) lod->l_object_id: "LPX64"\n", i, lod->l_object_id);
- CDEBUG(D_OTHER, "(%i) lod->l_object_gr: "LPX64"\n", i, lod->l_object_gr);
- CDEBUG(D_OTHER, "(%i) lod->l_ost_gen: %#x\n", i, lod->l_ost_gen);
- CDEBUG(D_OTHER, "(%i) lod->l_ost_idx: %#x\n", i, lod->l_ost_idx);
- }
EXIT;
}
__swab32s(&lod->l_ost_gen);
__swab32s(&lod->l_ost_idx);
}
- print_lum_objs(lum);
EXIT;
}
switch (req->rq_reqmsg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return 1;
case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED:
return lustre_req_swabbed(req, MSG_PTLRPC_BODY_OFF);
default:
- CERROR("bad lustre msg magic: %#08X\n",
+ CERROR("incorrect message magic: %08x\n",
req->rq_reqmsg->lm_magic);
}
return 0;
switch (req->rq_repmsg->lm_magic) {
case LUSTRE_MSG_MAGIC_V1:
- case LUSTRE_MSG_MAGIC_V1_SWABBED:
return 1;
case LUSTRE_MSG_MAGIC_V2:
- case LUSTRE_MSG_MAGIC_V2_SWABBED:
return lustre_rep_swabbed(req, MSG_PTLRPC_BODY_OFF);
default:
- /* uninitialized yet */
+ CERROR("incorrect message magic: %08x\n",
+ req->rq_repmsg->lm_magic);
return 0;
}
}
{
va_list args;
+ int opc = -1;
+ int req_fl = 0;
+ int rep_fl = 0;
+ int rep_status = 0;
+
+ if (req->rq_reqmsg &&
+ (!lustre_msg_need_swab(req->rq_reqmsg) ||
+ lustre_req_need_swab(req))) {
+ opc = lustre_msg_get_opc(req->rq_reqmsg);
+ req_fl = lustre_msg_get_flags(req->rq_reqmsg);
+ }
+
+ if (req->rq_repmsg &&
+ (!lustre_msg_need_swab(req->rq_repmsg) ||
+ lustre_rep_need_swab(req))) {
+ rep_fl = lustre_msg_get_flags(req->rq_repmsg);
+ rep_status = lustre_msg_get_status(req->rq_repmsg);
+ }
va_start(args, fmt);
libcfs_debug_vmsg2(data->msg_cdls, data->msg_subsys, mask, data->msg_file,
" req@%p x"LPD64"/t"LPD64" o%d->%s@%s:%d/%d "
"lens %d/%d e %d to %d dl %ld ref %d "
"fl "REQ_FLAGS_FMT"/%x/%x rc %d/%d\n",
- req, req->rq_xid, req->rq_transno,
- req->rq_reqmsg ? lustre_msg_get_opc(req->rq_reqmsg) : -1,
+ req, req->rq_xid, req->rq_transno, opc,
req->rq_import ? obd2cli_tgt(req->rq_import->imp_obd) :
req->rq_export ?
(char*)req->rq_export->exp_client_uuid.uuid : "<?>",
req->rq_reqlen, req->rq_replen,
req->rq_early_count, req->rq_timeout, req->rq_deadline,
atomic_read(&req->rq_refcount), DEBUG_REQ_FLAGS(req),
- req->rq_reqmsg ? lustre_msg_get_flags(req->rq_reqmsg) : 0,
- req->rq_repmsg ? lustre_msg_get_flags(req->rq_repmsg) : 0,
- req->rq_status,
- req->rq_repmsg ? lustre_msg_get_status(req->rq_repmsg) : 0);
+ req_fl, rep_fl, req->rq_status, rep_status);
va_end(args);
}
+
EXPORT_SYMBOL(_debug_req);