diff mbox

libceph: re-phrase ceph_decode_need()

Message ID 4FFDF78A.7050606@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Elder July 11, 2012, 10 p.m. UTC
For some reason, the way ceph_decode_need() is written throws
me off whenever I look at it:

	if (!likely(ceph_has_room(p, end, n)))

I read it as "not likely ceph has room," which is not what
it really means.  Despite being a double-negative, which I
normally avoid, I like this better:

	if (unlikely(!ceph_has_room(p, end, n)))

What do you think?

Signed-off-by: Alex Elder <elder@inktank.com>
---
 include/linux/ceph/decode.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

Index: b/include/linux/ceph/decode.h
===================================================================
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -51,10 +51,10 @@  static inline int ceph_has_room(void **p
 	return end >= *p && n <= end - *p;
 }

-#define ceph_decode_need(p, end, n, bad)		\
-	do {						\
-		if (!likely(ceph_has_room(p, end, n)))	\
-			goto bad;			\
+#define ceph_decode_need(p, end, n, bad)			\
+	do {							\
+		if (unlikely(!ceph_has_room(p, end, n)))	\
+			goto bad;				\
 	} while (0)

 #define ceph_decode_64_safe(p, end, v, bad)			\