int lustre_msg_check_version(struct lustre_msg *msg, __u32 version)
 {
+#define LUSTRE_MSG_MAGIC_V1 0x0BD00BD0
        switch (msg->lm_magic) {
        case LUSTRE_MSG_MAGIC_V1:
                CERROR("msg v1 not supported - please upgrade you system\n");
                CERROR("incorrect message magic: %08x\n", msg->lm_magic);
                return 0;
        }
+#undef LUSTRE_MSG_MAGIC_V1
 }
 EXPORT_SYMBOL(lustre_msg_check_version);
 
        case LUSTRE_MSG_MAGIC_V2:
                return lustre_msg_buf_v2(m, n, min_size);
        default:
-               LASSERTF(0, "incorrect message magic: %08x(msg:%p)\n", m->lm_magic, m);
+               LASSERTF(0, "incorrect message magic: %08x (msg:%p)\n",
+                        m->lm_magic, m);
                return NULL;
        }
 }
 __u32 lustre_msghdr_get_flags(struct lustre_msg *msg)
 {
        switch (msg->lm_magic) {
-       case LUSTRE_MSG_MAGIC_V1:
-       case LUSTRE_MSG_MAGIC_V1_SWABBED:
-               return 0;
        case LUSTRE_MSG_MAGIC_V2:
                /* already in host endian */
                return msg->lm_flags;
        default:
-               LASSERTF(0, "incorrect message magic: %08x\n", msg->lm_magic);
+               CERROR("incorrect message magic: %08x\n", msg->lm_magic);
                return 0;
        }
 }
 void lustre_msghdr_set_flags(struct lustre_msg *msg, __u32 flags)
 {
        switch (msg->lm_magic) {
-       case LUSTRE_MSG_MAGIC_V1:
-               return;
        case LUSTRE_MSG_MAGIC_V2:
                msg->lm_flags = flags;
                return;
        switch (msg->lm_magic) {
        case LUSTRE_MSG_MAGIC_V2: {
                struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
-               if (!pb) {
-                       CERROR("invalid msg %p: no ptlrpc body!\n", msg);
-                       return 0;
-               }
-               return pb->pb_flags;
+               if (pb)
+                       return pb->pb_flags;
+
+               CERROR("invalid msg %p: no ptlrpc body!\n", msg);
        }
+       /* no break */
        default:
                /* flags might be printed in debug code while message
                 * uninitialized */
        switch (msg->lm_magic) {
        case LUSTRE_MSG_MAGIC_V2: {
                struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
-               if (!pb) {
-                       CERROR("invalid msg %p: no ptlrpc body!\n", msg);
-                       return 0;
-               }
-               return pb->pb_op_flags;
+               if (pb)
+                       return pb->pb_op_flags;
+
+               CERROR("invalid msg %p: no ptlrpc body!\n", msg);
        }
+       /* no break */
        default:
                return 0;
        }
 }
 EXPORT_SYMBOL(lustre_msg_add_op_flags);
 
-void lustre_msg_set_op_flags(struct lustre_msg *msg, int flags)
-{
-       switch (msg->lm_magic) {
-       case LUSTRE_MSG_MAGIC_V2: {
-               struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
-               LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
-               pb->pb_op_flags |= flags;
-               return;
-       }
-       default:
-               LASSERTF(0, "incorrect message magic: %08x\n", msg->lm_magic);
-       }
-}
-EXPORT_SYMBOL(lustre_msg_set_op_flags);
-
 struct lustre_handle *lustre_msg_get_handle(struct lustre_msg *msg)
 {
        switch (msg->lm_magic) {
                return pb->pb_opc;
        }
        default:
-               CERROR("incorrect message magic: %08x(msg:%p)\n", msg->lm_magic, msg);
-               LBUG();
+               CERROR("incorrect message magic: %08x (msg:%p)\n",
+                      msg->lm_magic, msg);
                return 0;
        }
 }
 __u64 *lustre_msg_get_versions(struct lustre_msg *msg)
 {
        switch (msg->lm_magic) {
-       case LUSTRE_MSG_MAGIC_V1:
-               return NULL;
        case LUSTRE_MSG_MAGIC_V2: {
                struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
                if (!pb) {
        switch (msg->lm_magic) {
        case LUSTRE_MSG_MAGIC_V2: {
                struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
-               if (!pb) {
-                       CERROR("invalid msg %p: no ptlrpc body!\n", msg);
-                       return -EINVAL;
-               }
-               return pb->pb_status;
+               if (pb)
+                       return pb->pb_status;
+
+               CERROR("invalid msg %p: no ptlrpc body!\n", msg);
        }
+       /* no break */
        default:
                /* status might be printed in debug code while message
                 * uninitialized */
 }
 EXPORT_SYMBOL(lustre_msg_get_conn_cnt);
 
-int lustre_msg_is_v1(struct lustre_msg *msg)
-{
-       switch (msg->lm_magic) {
-       case LUSTRE_MSG_MAGIC_V1:
-       case LUSTRE_MSG_MAGIC_V1_SWABBED:
-               return 1;
-       default:
-               return 0;
-       }
-}
-EXPORT_SYMBOL(lustre_msg_is_v1);
-
 __u32 lustre_msg_get_magic(struct lustre_msg *msg)
 {
        switch (msg->lm_magic) {
 __u32 lustre_msg_get_timeout(struct lustre_msg *msg)
 {
        switch (msg->lm_magic) {
-       case LUSTRE_MSG_MAGIC_V1:
-       case LUSTRE_MSG_MAGIC_V1_SWABBED:
-               return 0;
        case LUSTRE_MSG_MAGIC_V2: {
                struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
                if (!pb) {
        }
        default:
                CERROR("incorrect message magic: %08x\n", msg->lm_magic);
-               return 0;
+               return -EPROTO;
        }
 }
 
 __u32 lustre_msg_get_service_time(struct lustre_msg *msg)
 {
        switch (msg->lm_magic) {
-       case LUSTRE_MSG_MAGIC_V1:
-       case LUSTRE_MSG_MAGIC_V1_SWABBED:
-               return 0;
        case LUSTRE_MSG_MAGIC_V2: {
                struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
                if (!pb) {
 char *lustre_msg_get_jobid(struct lustre_msg *msg)
 {
        switch (msg->lm_magic) {
-       case LUSTRE_MSG_MAGIC_V1:
-       case LUSTRE_MSG_MAGIC_V1_SWABBED:
-               return NULL;
        case LUSTRE_MSG_MAGIC_V2: {
                struct ptlrpc_body *pb =
                        lustre_msg_buf_v2(msg, MSG_PTLRPC_BODY_OFF,
 void lustre_msg_set_versions(struct lustre_msg *msg, __u64 *versions)
 {
        switch (msg->lm_magic) {
-       case LUSTRE_MSG_MAGIC_V1:
-               return;
        case LUSTRE_MSG_MAGIC_V2: {
                struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
                LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
 void lustre_msg_set_timeout(struct lustre_msg *msg, __u32 timeout)
 {
        switch (msg->lm_magic) {
-       case LUSTRE_MSG_MAGIC_V1:
-               return;
        case LUSTRE_MSG_MAGIC_V2: {
                struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
                LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
 void lustre_msg_set_service_time(struct lustre_msg *msg, __u32 service_time)
 {
        switch (msg->lm_magic) {
-       case LUSTRE_MSG_MAGIC_V1:
-               return;
        case LUSTRE_MSG_MAGIC_V2: {
                struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
                LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
 void lustre_msg_set_jobid(struct lustre_msg *msg, char *jobid)
 {
        switch (msg->lm_magic) {
-       case LUSTRE_MSG_MAGIC_V1:
-               return;
        case LUSTRE_MSG_MAGIC_V2: {
                __u32 opc = lustre_msg_get_opc(msg);
                struct ptlrpc_body *pb;
 void lustre_msg_set_cksum(struct lustre_msg *msg, __u32 cksum)
 {
        switch (msg->lm_magic) {
-       case LUSTRE_MSG_MAGIC_V1:
-               return;
        case LUSTRE_MSG_MAGIC_V2:
                msg->lm_cksum = cksum;
                return;