]> git.saurik.com Git - apple/libc.git/blob - db/mpool/FreeBSD/mpool.c.patch
2193284c01ecf6ee5a725d1d547666fb70ec5577
[apple/libc.git] / db / mpool / FreeBSD / mpool.c.patch
1 --- mpool.c.orig 2009-11-06 12:36:03.000000000 -0800
2 +++ mpool.c 2009-11-06 12:36:15.000000000 -0800
3 @@ -119,7 +119,7 @@ mpool_new(mp, pgnoaddr)
4
5 if (mp->npages == MAX_PAGE_NUMBER) {
6 (void)fprintf(stderr, "mpool_new: page allocation overflow.\n");
7 - abort();
8 + LIBC_ABORT("page allocation overflow");
9 }
10 #ifdef STATISTICS
11 ++mp->pagenew;
12 @@ -170,7 +170,7 @@ mpool_get(MPOOL *mp, pgno_t pgno,
13 if (bp->flags & MPOOL_PINNED) {
14 (void)fprintf(stderr,
15 "mpool_get: page %d already pinned\n", bp->pgno);
16 - abort();
17 + LIBC_ABORT("page %d already pinned", bp->pgno);
18 }
19 #endif
20 /*
21 @@ -241,7 +241,7 @@ mpool_put(MPOOL *mp, void *page, u_int f
22 if (!(bp->flags & MPOOL_PINNED)) {
23 (void)fprintf(stderr,
24 "mpool_put: page %d not pinned\n", bp->pgno);
25 - abort();
26 + LIBC_ABORT("page %d not pinned", bp->pgno);
27 }
28 #endif
29 bp->flags &= ~MPOOL_PINNED;
30 @@ -280,10 +280,16 @@ mpool_sync(MPOOL *mp)
31 BKT *bp;
32
33 /* Walk the lru chain, flushing any dirty pages to disk. */
34 - TAILQ_FOREACH(bp, &mp->lqh, q)
35 - if (bp->flags & MPOOL_DIRTY &&
36 - mpool_write(mp, bp) == RET_ERROR)
37 - return (RET_ERROR);
38 + TAILQ_FOREACH(bp, &mp->lqh, q) {
39 + if (bp->flags & MPOOL_DIRTY)
40 + if (mpool_write(mp, bp) == RET_ERROR) {
41 + return (RET_ERROR);
42 + } else {
43 + /* 4874757: Re-run through the user's pgin filter. */
44 + if (mp->pgin != NULL)
45 + (mp->pgin)(mp->pgcookie, bp->pgno, bp->page);
46 + }
47 + }
48
49 /* Sync the file descriptor. */
50 return (_fsync(mp->fd) ? RET_ERROR : RET_SUCCESS);