]> git.karo-electronics.de Git - linux-beck.git/commitdiff
libceph: evaluate osd_req_op_data() arguments only once
authorIoana Ciornei <ciorneiioana@gmail.com>
Thu, 22 Oct 2015 15:06:07 +0000 (18:06 +0300)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 2 Nov 2015 22:36:49 +0000 (23:36 +0100)
This patch changes the osd_req_op_data() macro to not evaluate
arguments more than once in order to follow the kernel coding style.

Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
[idryomov@gmail.com: changelog, formatting]
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
net/ceph/osd_client.c

index a362d7e94cf3605e4b605e4cca8902c2a36f6011..191bc21cecea7dfd15090219b458423abfcbd469 100644 (file)
@@ -120,11 +120,13 @@ static void ceph_osd_data_bio_init(struct ceph_osd_data *osd_data,
 }
 #endif /* CONFIG_BLOCK */
 
-#define osd_req_op_data(oreq, whch, typ, fld)  \
-       ({                                              \
-               BUG_ON(whch >= (oreq)->r_num_ops);      \
-               &(oreq)->r_ops[whch].typ.fld;           \
-       })
+#define osd_req_op_data(oreq, whch, typ, fld)                          \
+({                                                                     \
+       struct ceph_osd_request *__oreq = (oreq);                       \
+       unsigned int __whch = (whch);                                   \
+       BUG_ON(__whch >= __oreq->r_num_ops);                            \
+       &__oreq->r_ops[__whch].typ.fld;                                 \
+})
 
 static struct ceph_osd_data *
 osd_req_op_raw_data_in(struct ceph_osd_request *osd_req, unsigned int which)