File tree 1 file changed +15
-5
lines changed
1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 39
39
*
40
40
* The definition of buffer state components is below.
41
41
*/
42
+ #define BUF_REFCOUNT_BITS 18
43
+ #define BUF_USAGECOUNT_BITS 4
44
+ #define BUF_FLAG_BITS 10
45
+
46
+ StaticAssertDecl (BUF_REFCOUNT_BITS + BUF_USAGECOUNT_BITS + BUF_FLAG_BITS == 32 ,
47
+ "parts of buffer state space need to equal 32" );
48
+
42
49
#define BUF_REFCOUNT_ONE 1
43
- #define BUF_REFCOUNT_MASK ((1U << 18 ) - 1)
44
- #define BUF_USAGECOUNT_MASK 0x003C0000U
45
- #define BUF_USAGECOUNT_ONE (1U << 18 )
46
- #define BUF_USAGECOUNT_SHIFT 18
47
- #define BUF_FLAG_MASK 0xFFC00000U
50
+ #define BUF_REFCOUNT_MASK ((1U << BUF_REFCOUNT_BITS ) - 1)
51
+ #define BUF_USAGECOUNT_MASK (((1U << BUF_USAGECOUNT_BITS) - 1) << (BUF_REFCOUNT_BITS))
52
+ #define BUF_USAGECOUNT_ONE (1U << BUF_REFCOUNT_BITS )
53
+ #define BUF_USAGECOUNT_SHIFT BUF_REFCOUNT_BITS
54
+ #define BUF_FLAG_MASK (((1U << BUF_FLAG_BITS) - 1) << (BUF_REFCOUNT_BITS + BUF_USAGECOUNT_BITS))
48
55
49
56
/* Get refcount and usagecount from buffer state */
50
57
#define BUF_STATE_GET_REFCOUNT (state ) ((state) & BUF_REFCOUNT_MASK)
77
84
*/
78
85
#define BM_MAX_USAGE_COUNT 5
79
86
87
+ StaticAssertDecl (BM_MAX_USAGE_COUNT < (1 << BUF_USAGECOUNT_BITS ),
88
+ "BM_MAX_USAGE_COUNT doesn't fit in BUF_USAGECOUNT_BITS bits" );
89
+
80
90
/*
81
91
* Buffer tag identifies which disk block the buffer contains.
82
92
*
You can’t perform that action at this time.
0 commit comments