Use this to cheaply add another assertion.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
ASSERT((x & PGT_count_mask) != 0);
- if ( unlikely((nx & PGT_count_mask) == 0) )
+ switch ( nx & (PGT_locked | PGT_count_mask) )
{
+ case 0:
if ( unlikely((nx & PGT_type_mask) <= PGT_l4_page_table) &&
likely(nx & (PGT_validated|PGT_partial)) )
{
}
else
BUG_ON(!IS_ENABLED(CONFIG_PV_LINEAR_PT));
- }
- else if ( unlikely((nx & (PGT_locked | PGT_count_mask)) ==
- (PGT_locked | 1)) )
- {
+
+ break;
+
+ case PGT_locked:
+ ASSERT_UNREACHABLE();
+ return -EILSEQ;
+
+ case PGT_locked | 1:
/*
* We must not drop the second to last reference when the page is
* locked, as page_unlock() doesn't do any cleanup of the type.