| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
#if defined(LIBC_SCCS) && !defined(lint) |
| 38 |
static char sccsid[] = "@(#)bt_delete.c 8.13 (Berkeley) 7/28/94"; |
| 39 |
#endif |
| 40 |
|
| 41 |
#include <sys/types.h> |
| 42 |
|
| 43 |
#include <errno.h> |
| 44 |
#include <stdio.h> |
| 45 |
#include <string.h> |
| 46 |
|
| 47 |
#include "../include/db.h" |
| 48 |
#include "btree.h" |
| 49 |
|
| 50 |
static int __bt_bdelete __P((BTREE *, const DBT *)); |
| 51 |
static int __bt_curdel __P((BTREE *, const DBT *, PAGE *, u_int)); |
| 52 |
static int __bt_pdelete __P((BTREE *, PAGE *)); |
| 53 |
static int __bt_relink __P((BTREE *, PAGE *)); |
| 54 |
static int __bt_stkacq __P((BTREE *, PAGE **, CURSOR *)); |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
int |
| 63 |
__bt_delete(dbp, key, flags) |
| 64 |
const DB *dbp; |
| 65 |
const DBT *key; |
| 66 |
u_int flags; |
| 67 |
{ |
| 68 |
BTREE *t; |
| 69 |
CURSOR *c; |
| 70 |
PAGE *h; |
| 71 |
int status; |
| 72 |
|
| 73 |
t = dbp->internal; |
| 74 |
|
| 75 |
|
| 76 |
if (t->bt_pinned != NULL) { |
| 77 |
mpool_put(t->bt_mp, t->bt_pinned, 0); |
| 78 |
t->bt_pinned = NULL; |
| 79 |
} |
| 80 |
|
| 81 |
|
| 82 |
if (F_ISSET(t, B_RDONLY)) { |
| 83 |
errno = EPERM; |
| 84 |
return (RET_ERROR); |
| 85 |
} |
| 86 |
|
| 87 |
switch (flags) { |
| 88 |
case 0: |
| 89 |
status = __bt_bdelete(t, key); |
| 90 |
break; |
| 91 |
case R_CURSOR: |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
c = &t->bt_cursor; |
| 97 |
if (F_ISSET(c, CURS_INIT)) { |
| 98 |
if (F_ISSET(c, CURS_ACQUIRE | CURS_AFTER | CURS_BEFORE)) |
| 99 |
return (RET_SPECIAL); |
| 100 |
if ((h = mpool_get(t->bt_mp, c->pg.pgno, 0)) == NULL) |
| 101 |
return (RET_ERROR); |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
if (NEXTINDEX(h) == 1) |
| 108 |
if (__bt_stkacq(t, &h, &t->bt_cursor)) |
| 109 |
return (RET_ERROR); |
| 110 |
|
| 111 |
status = __bt_dleaf(t, NULL, h, c->pg.index); |
| 112 |
|
| 113 |
if (NEXTINDEX(h) == 0 && status == RET_SUCCESS) { |
| 114 |
if (__bt_pdelete(t, h)) |
| 115 |
return (RET_ERROR); |
| 116 |
} else |
| 117 |
mpool_put(t->bt_mp, |
| 118 |
h, status == RET_SUCCESS ? MPOOL_DIRTY : 0); |
| 119 |
break; |
| 120 |
} |
| 121 |
|
| 122 |
default: |
| 123 |
errno = EINVAL; |
| 124 |
return (RET_ERROR); |
| 125 |
} |
| 126 |
if (status == RET_SUCCESS) |
| 127 |
F_SET(t, B_MODIFIED); |
| 128 |
return (status); |
| 129 |
} |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
static int |
| 144 |
__bt_stkacq(t, hp, c) |
| 145 |
BTREE *t; |
| 146 |
PAGE **hp; |
| 147 |
CURSOR *c; |
| 148 |
{ |
| 149 |
BINTERNAL *bi; |
| 150 |
EPG *e; |
| 151 |
EPGNO *parent; |
| 152 |
PAGE *h; |
| 153 |
indx_t idx = 0; |
| 154 |
pgno_t pgno; |
| 155 |
recno_t nextpg, prevpg; |
| 156 |
int exact, level; |
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
h = *hp; |
| 163 |
mpool_put(t->bt_mp, h, 0); |
| 164 |
if ((e = __bt_search(t, &c->key, &exact)) == NULL) |
| 165 |
return (1); |
| 166 |
h = e->page; |
| 167 |
|
| 168 |
|
| 169 |
if (h->pgno == c->pg.pgno) |
| 170 |
goto ret; |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
while (h->pgno != c->pg.pgno) { |
| 179 |
if ((nextpg = h->nextpg) == P_INVALID) |
| 180 |
break; |
| 181 |
mpool_put(t->bt_mp, h, 0); |
| 182 |
|
| 183 |
|
| 184 |
for (level = 0; (parent = BT_POP(t)) != NULL; ++level) { |
| 185 |
|
| 186 |
if ((h = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL) |
| 187 |
return (1); |
| 188 |
|
| 189 |
|
| 190 |
if (parent->index != NEXTINDEX(h) - 1) { |
| 191 |
idx = parent->index + 1; |
| 192 |
BT_PUSH(t, h->pgno, idx); |
| 193 |
break; |
| 194 |
} |
| 195 |
mpool_put(t->bt_mp, h, 0); |
| 196 |
} |
| 197 |
|
| 198 |
|
| 199 |
while (level--) { |
| 200 |
|
| 201 |
bi = GETBINTERNAL(h, idx); |
| 202 |
pgno = bi->pgno; |
| 203 |
BT_PUSH(t, pgno, 0); |
| 204 |
|
| 205 |
|
| 206 |
mpool_put(t->bt_mp, h, 0); |
| 207 |
|
| 208 |
|
| 209 |
if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL) |
| 210 |
return (1); |
| 211 |
idx = 0; |
| 212 |
} |
| 213 |
mpool_put(t->bt_mp, h, 0); |
| 214 |
if ((h = mpool_get(t->bt_mp, nextpg, 0)) == NULL) |
| 215 |
return (1); |
| 216 |
} |
| 217 |
|
| 218 |
if (h->pgno == c->pg.pgno) |
| 219 |
goto ret; |
| 220 |
|
| 221 |
|
| 222 |
mpool_put(t->bt_mp, h, 0); |
| 223 |
if ((e = __bt_search(t, &c->key, &exact)) == NULL) |
| 224 |
return (1); |
| 225 |
h = e->page; |
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
while (h->pgno != c->pg.pgno) { |
| 234 |
if ((prevpg = h->prevpg) == P_INVALID) |
| 235 |
break; |
| 236 |
mpool_put(t->bt_mp, h, 0); |
| 237 |
|
| 238 |
|
| 239 |
for (level = 0; (parent = BT_POP(t)) != NULL; ++level) { |
| 240 |
|
| 241 |
if ((h = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL) |
| 242 |
return (1); |
| 243 |
|
| 244 |
|
| 245 |
if (parent->index != 0) { |
| 246 |
idx = parent->index - 1; |
| 247 |
BT_PUSH(t, h->pgno, idx); |
| 248 |
break; |
| 249 |
} |
| 250 |
mpool_put(t->bt_mp, h, 0); |
| 251 |
} |
| 252 |
|
| 253 |
|
| 254 |
while (level--) { |
| 255 |
|
| 256 |
bi = GETBINTERNAL(h, idx); |
| 257 |
pgno = bi->pgno; |
| 258 |
|
| 259 |
|
| 260 |
mpool_put(t->bt_mp, h, 0); |
| 261 |
|
| 262 |
|
| 263 |
if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL) |
| 264 |
return (1); |
| 265 |
|
| 266 |
idx = NEXTINDEX(h) - 1; |
| 267 |
BT_PUSH(t, pgno, idx); |
| 268 |
} |
| 269 |
mpool_put(t->bt_mp, h, 0); |
| 270 |
if ((h = mpool_get(t->bt_mp, prevpg, 0)) == NULL) |
| 271 |
return (1); |
| 272 |
} |
| 273 |
|
| 274 |
|
| 275 |
ret: mpool_put(t->bt_mp, h, 0); |
| 276 |
return ((*hp = mpool_get(t->bt_mp, c->pg.pgno, 0)) == NULL); |
| 277 |
} |
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
static int |
| 291 |
__bt_bdelete(t, key) |
| 292 |
BTREE *t; |
| 293 |
const DBT *key; |
| 294 |
{ |
| 295 |
EPG *e; |
| 296 |
PAGE *h; |
| 297 |
int deleted, exact, redo; |
| 298 |
|
| 299 |
deleted = 0; |
| 300 |
|
| 301 |
|
| 302 |
loop: if ((e = __bt_search(t, key, &exact)) == NULL) |
| 303 |
return (deleted ? RET_SUCCESS : RET_ERROR); |
| 304 |
if (!exact) { |
| 305 |
mpool_put(t->bt_mp, e->page, 0); |
| 306 |
return (deleted ? RET_SUCCESS : RET_SPECIAL); |
| 307 |
} |
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
redo = 0; |
| 315 |
h = e->page; |
| 316 |
do { |
| 317 |
if (__bt_dleaf(t, key, h, e->index)) { |
| 318 |
mpool_put(t->bt_mp, h, 0); |
| 319 |
return (RET_ERROR); |
| 320 |
} |
| 321 |
if (F_ISSET(t, B_NODUPS)) { |
| 322 |
if (NEXTINDEX(h) == 0) { |
| 323 |
if (__bt_pdelete(t, h)) |
| 324 |
return (RET_ERROR); |
| 325 |
} else |
| 326 |
mpool_put(t->bt_mp, h, MPOOL_DIRTY); |
| 327 |
return (RET_SUCCESS); |
| 328 |
} |
| 329 |
deleted = 1; |
| 330 |
} while (e->index < NEXTINDEX(h) && __bt_cmp(t, key, e) == 0); |
| 331 |
|
| 332 |
|
| 333 |
if (e->index == NEXTINDEX(h)) |
| 334 |
redo = 1; |
| 335 |
|
| 336 |
|
| 337 |
while (e->index-- > 0) { |
| 338 |
if (__bt_cmp(t, key, e) != 0) |
| 339 |
break; |
| 340 |
if (__bt_dleaf(t, key, h, e->index) == RET_ERROR) { |
| 341 |
mpool_put(t->bt_mp, h, 0); |
| 342 |
return (RET_ERROR); |
| 343 |
} |
| 344 |
if (e->index == 0) |
| 345 |
redo = 1; |
| 346 |
} |
| 347 |
|
| 348 |
|
| 349 |
if (NEXTINDEX(h) == 0) { |
| 350 |
if (__bt_pdelete(t, h)) |
| 351 |
return (RET_ERROR); |
| 352 |
goto loop; |
| 353 |
} |
| 354 |
|
| 355 |
|
| 356 |
mpool_put(t->bt_mp, h, MPOOL_DIRTY); |
| 357 |
|
| 358 |
if (redo) |
| 359 |
goto loop; |
| 360 |
return (RET_SUCCESS); |
| 361 |
} |
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
static int |
| 378 |
__bt_pdelete(t, h) |
| 379 |
BTREE *t; |
| 380 |
PAGE *h; |
| 381 |
{ |
| 382 |
BINTERNAL *bi; |
| 383 |
PAGE *pg; |
| 384 |
EPGNO *parent; |
| 385 |
indx_t cnt, idx, *ip, offset; |
| 386 |
u_int32_t nksize; |
| 387 |
char *from; |
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
while ((parent = BT_POP(t)) != NULL) { |
| 402 |
|
| 403 |
if ((pg = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL) |
| 404 |
return (RET_ERROR); |
| 405 |
|
| 406 |
idx = parent->index; |
| 407 |
bi = GETBINTERNAL(pg, idx); |
| 408 |
|
| 409 |
|
| 410 |
if (bi->flags & P_BIGKEY && |
| 411 |
__ovfl_delete(t, bi->bytes) == RET_ERROR) { |
| 412 |
mpool_put(t->bt_mp, pg, 0); |
| 413 |
return (RET_ERROR); |
| 414 |
} |
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
if (NEXTINDEX(pg) == 1) { |
| 422 |
if (pg->pgno == P_ROOT) { |
| 423 |
pg->lower = BTDATAOFF; |
| 424 |
pg->upper = t->bt_psize; |
| 425 |
pg->flags = P_BLEAF; |
| 426 |
} else { |
| 427 |
if (__bt_relink(t, pg) || __bt_free(t, pg)) |
| 428 |
return (RET_ERROR); |
| 429 |
continue; |
| 430 |
} |
| 431 |
} else { |
| 432 |
|
| 433 |
nksize = NBINTERNAL(bi->ksize); |
| 434 |
from = (char *)pg + pg->upper; |
| 435 |
memmove(from + nksize, from, (char *)bi - from); |
| 436 |
pg->upper += nksize; |
| 437 |
|
| 438 |
|
| 439 |
offset = pg->linp[idx]; |
| 440 |
for (cnt = idx, ip = &pg->linp[0]; cnt--; ++ip) |
| 441 |
if (ip[0] < offset) |
| 442 |
ip[0] += nksize; |
| 443 |
for (cnt = NEXTINDEX(pg) - idx; --cnt; ++ip) |
| 444 |
ip[0] = ip[1] < offset ? ip[1] + nksize : ip[1]; |
| 445 |
pg->lower -= sizeof(indx_t); |
| 446 |
} |
| 447 |
|
| 448 |
mpool_put(t->bt_mp, pg, MPOOL_DIRTY); |
| 449 |
break; |
| 450 |
} |
| 451 |
|
| 452 |
|
| 453 |
if (h->pgno == P_ROOT) { |
| 454 |
mpool_put(t->bt_mp, h, MPOOL_DIRTY); |
| 455 |
return (RET_SUCCESS); |
| 456 |
} |
| 457 |
return (__bt_relink(t, h) || __bt_free(t, h)); |
| 458 |
} |
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
|
| 473 |
int |
| 474 |
__bt_dleaf(t, key, h, idx) |
| 475 |
BTREE *t; |
| 476 |
const DBT *key; |
| 477 |
PAGE *h; |
| 478 |
u_int idx; |
| 479 |
{ |
| 480 |
BLEAF *bl; |
| 481 |
indx_t cnt, *ip, offset; |
| 482 |
u_int32_t nbytes; |
| 483 |
void *to; |
| 484 |
char *from; |
| 485 |
|
| 486 |
|
| 487 |
if (F_ISSET(&t->bt_cursor, CURS_INIT) && |
| 488 |
!F_ISSET(&t->bt_cursor, CURS_ACQUIRE) && |
| 489 |
t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index == idx && |
| 490 |
__bt_curdel(t, key, h, idx)) |
| 491 |
return (RET_ERROR); |
| 492 |
|
| 493 |
|
| 494 |
to = bl = GETBLEAF(h, idx); |
| 495 |
if (bl->flags & P_BIGKEY && __ovfl_delete(t, bl->bytes) == RET_ERROR) |
| 496 |
return (RET_ERROR); |
| 497 |
if (bl->flags & P_BIGDATA && |
| 498 |
__ovfl_delete(t, bl->bytes + bl->ksize) == RET_ERROR) |
| 499 |
return (RET_ERROR); |
| 500 |
|
| 501 |
|
| 502 |
nbytes = NBLEAF(bl); |
| 503 |
from = (char *)h + h->upper; |
| 504 |
memmove(from + nbytes, from, (char *)to - from); |
| 505 |
h->upper += nbytes; |
| 506 |
|
| 507 |
|
| 508 |
offset = h->linp[idx]; |
| 509 |
for (cnt = idx, ip = &h->linp[0]; cnt--; ++ip) |
| 510 |
if (ip[0] < offset) |
| 511 |
ip[0] += nbytes; |
| 512 |
for (cnt = NEXTINDEX(h) - idx; --cnt; ++ip) |
| 513 |
ip[0] = ip[1] < offset ? ip[1] + nbytes : ip[1]; |
| 514 |
h->lower -= sizeof(indx_t); |
| 515 |
|
| 516 |
|
| 517 |
if (F_ISSET(&t->bt_cursor, CURS_INIT) && |
| 518 |
!F_ISSET(&t->bt_cursor, CURS_ACQUIRE) && |
| 519 |
t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index > idx) |
| 520 |
--t->bt_cursor.pg.index; |
| 521 |
|
| 522 |
return (RET_SUCCESS); |
| 523 |
} |
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
static int |
| 539 |
__bt_curdel(t, key, h, idx) |
| 540 |
BTREE *t; |
| 541 |
const DBT *key; |
| 542 |
PAGE *h; |
| 543 |
u_int idx; |
| 544 |
{ |
| 545 |
CURSOR *c; |
| 546 |
EPG e; |
| 547 |
PAGE *pg; |
| 548 |
int curcopy, status; |
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
c = &t->bt_cursor; |
| 555 |
F_CLR(c, CURS_AFTER | CURS_BEFORE | CURS_ACQUIRE); |
| 556 |
|
| 557 |
curcopy = 0; |
| 558 |
if (!F_ISSET(t, B_NODUPS)) { |
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
if (key == NULL) { |
| 565 |
e.page = h; |
| 566 |
e.index = idx; |
| 567 |
if ((status = __bt_ret(t, &e, |
| 568 |
&c->key, &c->key, NULL, NULL, 1)) != RET_SUCCESS) |
| 569 |
return (status); |
| 570 |
curcopy = 1; |
| 571 |
key = &c->key; |
| 572 |
} |
| 573 |
|
| 574 |
if (idx > 0) { |
| 575 |
e.page = h; |
| 576 |
e.index = idx - 1; |
| 577 |
if (__bt_cmp(t, key, &e) == 0) { |
| 578 |
F_SET(c, CURS_BEFORE); |
| 579 |
goto dup2; |
| 580 |
} |
| 581 |
} |
| 582 |
|
| 583 |
if (idx < NEXTINDEX(h) - 1) { |
| 584 |
e.page = h; |
| 585 |
e.index = idx + 1; |
| 586 |
if (__bt_cmp(t, key, &e) == 0) { |
| 587 |
F_SET(c, CURS_AFTER); |
| 588 |
goto dup2; |
| 589 |
} |
| 590 |
} |
| 591 |
|
| 592 |
if (idx == 0 && h->prevpg != P_INVALID) { |
| 593 |
if ((pg = mpool_get(t->bt_mp, h->prevpg, 0)) == NULL) |
| 594 |
return (RET_ERROR); |
| 595 |
e.page = pg; |
| 596 |
e.index = NEXTINDEX(pg) - 1; |
| 597 |
if (__bt_cmp(t, key, &e) == 0) { |
| 598 |
F_SET(c, CURS_BEFORE); |
| 599 |
goto dup1; |
| 600 |
} |
| 601 |
mpool_put(t->bt_mp, pg, 0); |
| 602 |
} |
| 603 |
|
| 604 |
if (idx == NEXTINDEX(h) - 1 && h->nextpg != P_INVALID) { |
| 605 |
if ((pg = mpool_get(t->bt_mp, h->nextpg, 0)) == NULL) |
| 606 |
return (RET_ERROR); |
| 607 |
e.page = pg; |
| 608 |
e.index = 0; |
| 609 |
if (__bt_cmp(t, key, &e) == 0) { |
| 610 |
F_SET(c, CURS_AFTER); |
| 611 |
dup1: mpool_put(t->bt_mp, pg, 0); |
| 612 |
dup2: c->pg.pgno = e.page->pgno; |
| 613 |
c->pg.index = e.index; |
| 614 |
return (RET_SUCCESS); |
| 615 |
} |
| 616 |
mpool_put(t->bt_mp, pg, 0); |
| 617 |
} |
| 618 |
} |
| 619 |
e.page = h; |
| 620 |
e.index = idx; |
| 621 |
if (curcopy || (status = |
| 622 |
__bt_ret(t, &e, &c->key, &c->key, NULL, NULL, 1)) == RET_SUCCESS) { |
| 623 |
F_SET(c, CURS_ACQUIRE); |
| 624 |
return (RET_SUCCESS); |
| 625 |
} |
| 626 |
return (status); |
| 627 |
} |
| 628 |
|
| 629 |
|
| 630 |
|
| 631 |
|
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
static int |
| 638 |
__bt_relink(t, h) |
| 639 |
BTREE *t; |
| 640 |
PAGE *h; |
| 641 |
{ |
| 642 |
PAGE *pg; |
| 643 |
|
| 644 |
if (h->nextpg != P_INVALID) { |
| 645 |
if ((pg = mpool_get(t->bt_mp, h->nextpg, 0)) == NULL) |
| 646 |
return (RET_ERROR); |
| 647 |
pg->prevpg = h->prevpg; |
| 648 |
mpool_put(t->bt_mp, pg, MPOOL_DIRTY); |
| 649 |
} |
| 650 |
if (h->prevpg != P_INVALID) { |
| 651 |
if ((pg = mpool_get(t->bt_mp, h->prevpg, 0)) == NULL) |
| 652 |
return (RET_ERROR); |
| 653 |
pg->nextpg = h->nextpg; |
| 654 |
mpool_put(t->bt_mp, pg, MPOOL_DIRTY); |
| 655 |
} |
| 656 |
return (0); |
| 657 |
} |