Page MenuHomeFreeBSD

D49974.diff
No OneTemporary

D49974.diff

diff --git a/sys/sys/queue.h b/sys/sys/queue.h
--- a/sys/sys/queue.h
+++ b/sys/sys/queue.h
@@ -248,18 +248,18 @@
*/
#ifdef QUEUE_MACRO_DEBUG_ASSERTIONS
#define QMD_SLIST_CHECK_PREVPTR(prevp, elm) do { \
- if (*(prevp) != (elm)) \
+ if (__predict_false(*(prevp) != (elm))) \
QMD_PANIC("Bad prevptr *(%p) == %p != %p", \
(prevp), *(prevp), (elm)); \
} while (0)
#define SLIST_ASSERT_EMPTY(head) do { \
- if (!SLIST_EMPTY((head))) \
+ if (__predict_false(!SLIST_EMPTY((head)))) \
QMD_PANIC("slist %p is not empty", (head)); \
} while (0)
#define SLIST_ASSERT_NONEMPTY(head) do { \
- if (SLIST_EMPTY((head))) \
+ if (__predict_false(SLIST_EMPTY((head)))) \
QMD_PANIC("slist %p is empty", (head)); \
} while (0)
#else
@@ -412,7 +412,7 @@
* actually points to the head's first element pointer field.
*/
#define QMD_STAILQ_CHECK_EMPTY(head) do { \
- if ((head)->stqh_last != &(head)->stqh_first) \
+ if (__predict_false((head)->stqh_last != &(head)->stqh_first)) \
QMD_PANIC("Empty stailq %p->stqh_last is %p, " \
"not head's first field address", \
(head), (head)->stqh_last); \
@@ -424,18 +424,18 @@
* Validates that the stailq's last element's next pointer is NULL.
*/
#define QMD_STAILQ_CHECK_TAIL(head) do { \
- if (*(head)->stqh_last != NULL) \
+ if (__predict_false(*(head)->stqh_last != NULL)) \
QMD_PANIC("Stailq %p last element's next pointer is " \
"%p, not NULL", (head), *(head)->stqh_last); \
} while (0)
#define STAILQ_ASSERT_EMPTY(head) do { \
- if (!STAILQ_EMPTY((head))) \
+ if (__predict_false(!STAILQ_EMPTY((head)))) \
QMD_PANIC("stailq %p is not empty", (head)); \
} while (0)
#define STAILQ_ASSERT_NONEMPTY(head) do { \
- if (STAILQ_EMPTY((head))) \
+ if (__predict_false(STAILQ_EMPTY((head)))) \
QMD_PANIC("stailq %p is empty", (head)); \
} while (0)
@@ -612,9 +612,9 @@
* points back at 'head.'
*/
#define QMD_LIST_CHECK_HEAD(head, field) do { \
- if (LIST_FIRST((head)) != NULL && \
+ if (__predict_false(LIST_FIRST((head)) != NULL && \
LIST_FIRST((head))->field.le_prev != \
- &LIST_FIRST((head))) \
+ &LIST_FIRST((head)))) \
QMD_PANIC("Bad list head %p first->prev != head", \
(head)); \
} while (0)
@@ -626,9 +626,9 @@
* points back at 'elm.'
*/
#define QMD_LIST_CHECK_NEXT(elm, field) do { \
- if (LIST_NEXT((elm), field) != NULL && \
+ if (__predict_false(LIST_NEXT((elm), field) != NULL && \
LIST_NEXT((elm), field)->field.le_prev != \
- &((elm)->field.le_next)) \
+ &((elm)->field.le_next))) \
QMD_PANIC("Bad link elm %p next->prev != elm", (elm)); \
} while (0)
@@ -638,17 +638,17 @@
* Validates that the previous element (or head of the list) points to 'elm.'
*/
#define QMD_LIST_CHECK_PREV(elm, field) do { \
- if (*(elm)->field.le_prev != (elm)) \
+ if (__predict_false(*(elm)->field.le_prev != (elm))) \
QMD_PANIC("Bad link elm %p prev->next != elm", (elm)); \
} while (0)
#define LIST_ASSERT_EMPTY(head) do { \
- if (!LIST_EMPTY((head))) \
+ if (__predict_false(!LIST_EMPTY((head)))) \
QMD_PANIC("list %p is not empty", (head)); \
} while (0)
#define LIST_ASSERT_NONEMPTY(head) do { \
- if (LIST_EMPTY((head))) \
+ if (__predict_false(LIST_EMPTY((head)))) \
QMD_PANIC("list %p is empty", (head)); \
} while (0)
@@ -840,9 +840,9 @@
* points back at 'head.'
*/
#define QMD_TAILQ_CHECK_HEAD(head, field) do { \
- if (!TAILQ_EMPTY(head) && \
+ if (__predict_false(!TAILQ_EMPTY(head) && \
TAILQ_FIRST((head))->field.tqe_prev != \
- &TAILQ_FIRST((head))) \
+ &TAILQ_FIRST((head)))) \
QMD_PANIC("Bad tailq head %p first->prev != head", \
(head)); \
} while (0)
@@ -853,7 +853,7 @@
* Validates that the tail of the tailq is a pointer to pointer to NULL.
*/
#define QMD_TAILQ_CHECK_TAIL(head, field) do { \
- if (*(head)->tqh_last != NULL) \
+ if (__predict_false(*(head)->tqh_last != NULL)) \
QMD_PANIC("Bad tailq NEXT(%p->tqh_last) != NULL", \
(head)); \
} while (0)
@@ -865,9 +865,9 @@
* points back at 'elm.'
*/
#define QMD_TAILQ_CHECK_NEXT(elm, field) do { \
- if (TAILQ_NEXT((elm), field) != NULL && \
+ if (__predict_false(TAILQ_NEXT((elm), field) != NULL && \
TAILQ_NEXT((elm), field)->field.tqe_prev != \
- &((elm)->field.tqe_next)) \
+ &((elm)->field.tqe_next))) \
QMD_PANIC("Bad link elm %p next->prev != elm", (elm)); \
} while (0)
@@ -877,17 +877,17 @@
* Validates that the previous element (or head of the tailq) points to 'elm.'
*/
#define QMD_TAILQ_CHECK_PREV(elm, field) do { \
- if (*(elm)->field.tqe_prev != (elm)) \
+ if (__predict_false(*(elm)->field.tqe_prev != (elm))) \
QMD_PANIC("Bad link elm %p prev->next != elm", (elm)); \
} while (0)
#define TAILQ_ASSERT_EMPTY(head) do { \
- if (!TAILQ_EMPTY((head))) \
+ if (__predict_false(!TAILQ_EMPTY((head)))) \
QMD_PANIC("tailq %p is not empty", (head)); \
} while (0)
#define TAILQ_ASSERT_NONEMPTY(head) do { \
- if (TAILQ_EMPTY((head))) \
+ if (__predict_false(TAILQ_EMPTY((head)))) \
QMD_PANIC("tailq %p is empty", (head)); \
} while (0)

File Metadata

Mime Type
text/plain
Expires
Thu, Apr 24, 4:06 PM (19 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17755459
Default Alt Text
D49974.diff (5 KB)

Event Timeline