bt_open.c (14287) | bt_open.c (17141) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Mike Olson. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 111 unchanged lines hidden (view full) --- 120 121 /* 122 * Page size must be indx_t aligned and >= MINPSIZE. Default 123 * page size is set farther on, based on the underlying file 124 * transfer size. 125 */ 126 if (b.psize && 127 (b.psize < MINPSIZE || b.psize > MAX_PAGE_OFFSET + 1 || | 1/*- 2 * Copyright (c) 1990, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Mike Olson. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 111 unchanged lines hidden (view full) --- 120 121 /* 122 * Page size must be indx_t aligned and >= MINPSIZE. Default 123 * page size is set farther on, based on the underlying file 124 * transfer size. 125 */ 126 if (b.psize && 127 (b.psize < MINPSIZE || b.psize > MAX_PAGE_OFFSET + 1 || |
128 b.psize & sizeof(indx_t) - 1)) | 128 b.psize & (sizeof(indx_t) - 1) )) |
129 goto einval; 130 131 /* Minimum number of keys per page; absolute minimum is 2. */ 132 if (b.minkeypage) { 133 if (b.minkeypage < 2) 134 goto einval; 135 } else 136 b.minkeypage = DEFMINKEYPAGE; --- 103 unchanged lines hidden (view full) --- 240 M_32_SWAP(m.psize); 241 M_32_SWAP(m.free); 242 M_32_SWAP(m.nrecs); 243 M_32_SWAP(m.flags); 244 } 245 if (m.magic != BTREEMAGIC || m.version != BTREEVERSION) 246 goto eftype; 247 if (m.psize < MINPSIZE || m.psize > MAX_PAGE_OFFSET + 1 || | 129 goto einval; 130 131 /* Minimum number of keys per page; absolute minimum is 2. */ 132 if (b.minkeypage) { 133 if (b.minkeypage < 2) 134 goto einval; 135 } else 136 b.minkeypage = DEFMINKEYPAGE; --- 103 unchanged lines hidden (view full) --- 240 M_32_SWAP(m.psize); 241 M_32_SWAP(m.free); 242 M_32_SWAP(m.nrecs); 243 M_32_SWAP(m.flags); 244 } 245 if (m.magic != BTREEMAGIC || m.version != BTREEVERSION) 246 goto eftype; 247 if (m.psize < MINPSIZE || m.psize > MAX_PAGE_OFFSET + 1 || |
248 m.psize & sizeof(indx_t) - 1) | 248 m.psize & (sizeof(indx_t) - 1) ) |
249 goto eftype; 250 if (m.flags & ~SAVEMETA) 251 goto eftype; 252 b.psize = m.psize; 253 F_SET(t, m.flags); 254 t->bt_free = m.free; 255 t->bt_nrecs = m.nrecs; 256 } else { --- 16 unchanged lines hidden (view full) --- 273 t->bt_free = P_INVALID; 274 t->bt_nrecs = 0; 275 F_SET(t, B_METADIRTY); 276 } 277 278 t->bt_psize = b.psize; 279 280 /* Set the cache size; must be a multiple of the page size. */ | 249 goto eftype; 250 if (m.flags & ~SAVEMETA) 251 goto eftype; 252 b.psize = m.psize; 253 F_SET(t, m.flags); 254 t->bt_free = m.free; 255 t->bt_nrecs = m.nrecs; 256 } else { --- 16 unchanged lines hidden (view full) --- 273 t->bt_free = P_INVALID; 274 t->bt_nrecs = 0; 275 F_SET(t, B_METADIRTY); 276 } 277 278 t->bt_psize = b.psize; 279 280 /* Set the cache size; must be a multiple of the page size. */ |
281 if (b.cachesize && b.cachesize & b.psize - 1) 282 b.cachesize += (~b.cachesize & b.psize - 1) + 1; | 281 if (b.cachesize && b.cachesize & (b.psize - 1) ) 282 b.cachesize += (~b.cachesize & (b.psize - 1) ) + 1; |
283 if (b.cachesize < b.psize * MINCACHE) 284 b.cachesize = b.psize * MINCACHE; 285 286 /* Calculate number of pages to cache. */ 287 ncache = (b.cachesize + t->bt_psize - 1) / t->bt_psize; 288 289 /* 290 * The btree data structure requires that at least two keys can fit on --- 154 unchanged lines hidden --- | 283 if (b.cachesize < b.psize * MINCACHE) 284 b.cachesize = b.psize * MINCACHE; 285 286 /* Calculate number of pages to cache. */ 287 ncache = (b.cachesize + t->bt_psize - 1) / t->bt_psize; 288 289 /* 290 * The btree data structure requires that at least two keys can fit on --- 154 unchanged lines hidden --- |