staging: lustre: put constant on the right of binary operator
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sat, 29 Aug 2015 17:30:12 +0000 (19:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Sep 2015 01:24:13 +0000 (18:24 -0700)
Move constants to the right of binary operators.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
constant c;
expression e;
binary operator b = {==,!=,&,|};
@@

(
- c
+ e
b
- e
+ c
|
- c < e
+ e > c
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/ptlrpc/client.c
drivers/staging/lustre/lustre/ptlrpc/import.c
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c

index c83a34a01e659cea3b2d583d1d1711e97f2d953b..865c8a2dd1c9c3063465b486bd3971415dfa2124 100644 (file)
@@ -2954,7 +2954,7 @@ void ptlrpc_init_xid(void)
        }
 
        /* Always need to be aligned to a power-of-two for multi-bulk BRW */
-       CLASSERT((PTLRPC_BULK_OPS_COUNT & (PTLRPC_BULK_OPS_COUNT - 1)) == 0);
+       CLASSERT(((PTLRPC_BULK_OPS_COUNT - 1) & PTLRPC_BULK_OPS_COUNT) == 0);
        ptlrpc_last_xid &= PTLRPC_BULK_OPS_MASK;
 }
 
index 1fd85104bd9d5a4d35baffed87c6bc07a159ecd1..f5b324539a073132887ce434e88d3c32433c056b 100644 (file)
@@ -899,7 +899,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
        }
 
        /* Determine what recovery state to move the import to. */
-       if (MSG_CONNECT_RECONNECT & msg_flags) {
+       if (msg_flags & MSG_CONNECT_RECONNECT) {
                memset(&old_hdl, 0, sizeof(old_hdl));
                if (!memcmp(&old_hdl, lustre_msg_get_handle(request->rq_repmsg),
                            sizeof(old_hdl))) {
@@ -924,7 +924,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
                         * eviction. If it is in recovery - we are safe to
                         * participate since we can reestablish all of our state
                         * with server again */
-                       if ((MSG_CONNECT_RECOVERING & msg_flags)) {
+                       if ((msg_flags & MSG_CONNECT_RECOVERING)) {
                                CDEBUG(level, "%s@%s changed server handle from %#llx to %#llx but is still in recovery\n",
                                       obd2cli_tgt(imp->imp_obd),
                                       imp->imp_connection->c_remote_uuid.uuid,
@@ -945,7 +945,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
                        imp->imp_remote_handle =
                                     *lustre_msg_get_handle(request->rq_repmsg);
 
-                       if (!(MSG_CONNECT_RECOVERING & msg_flags)) {
+                       if (!(msg_flags & MSG_CONNECT_RECOVERING)) {
                                IMPORT_SET_STATE(imp, LUSTRE_IMP_EVICTED);
                                rc = 0;
                                goto finish;
@@ -961,7 +961,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
                        CDEBUG(D_HA, "%s: reconnected but import is invalid; marking evicted\n",
                               imp->imp_obd->obd_name);
                        IMPORT_SET_STATE(imp, LUSTRE_IMP_EVICTED);
-               } else if (MSG_CONNECT_RECOVERING & msg_flags) {
+               } else if (msg_flags & MSG_CONNECT_RECOVERING) {
                        CDEBUG(D_HA, "%s: reconnected to %s during replay\n",
                               imp->imp_obd->obd_name,
                               obd2cli_tgt(imp->imp_obd));
@@ -974,7 +974,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
                } else {
                        IMPORT_SET_STATE(imp, LUSTRE_IMP_RECOVER);
                }
-       } else if ((MSG_CONNECT_RECOVERING & msg_flags) && !imp->imp_invalid) {
+       } else if ((msg_flags & MSG_CONNECT_RECOVERING) && !imp->imp_invalid) {
                LASSERT(imp->imp_replayable);
                imp->imp_remote_handle =
                                *lustre_msg_get_handle(request->rq_repmsg);
index 84937ad905709633f9d33ffb456e5ccd006c9f2e..e9f8aa0df97860137f6f6a51c2dee5922092ea01 100644 (file)
@@ -883,7 +883,7 @@ void lustre_msg_clear_flags(struct lustre_msg *msg, int flags)
        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_flags &= ~(MSG_GEN_FLAG_MASK & flags);
+               pb->pb_flags &= ~(flags & MSG_GEN_FLAG_MASK);
                return;
        }
        default: