implement free page reuse
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 10 Oct 1992 08:26:11 +0000 (00:26 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 10 Oct 1992 08:26:11 +0000 (00:26 -0800)
SCCS-vsn: lib/libc/db/btree/btree.h 5.8
SCCS-vsn: lib/libc/db/btree/extern.h 5.3
SCCS-vsn: lib/libc/db/btree/bt_close.c 5.5
SCCS-vsn: lib/libc/db/btree/bt_split.c 5.7

usr/src/lib/libc/db/btree/bt_close.c
usr/src/lib/libc/db/btree/bt_split.c
usr/src/lib/libc/db/btree/btree.h
usr/src/lib/libc/db/btree/extern.h

index 5a7b576..ee1c871 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_close.c 5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)bt_close.c 5.5 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
@@ -144,7 +144,7 @@ bt_meta(t)
        m.m_magic = BTREEMAGIC;
        m.m_version = BTREEVERSION;
        m.m_psize = t->bt_psize;
        m.m_magic = BTREEMAGIC;
        m.m_version = BTREEVERSION;
        m.m_psize = t->bt_psize;
-       m.m_free = 0;                           /* XXX */
+       m.m_free = t->bt_free;
        m.m_nrecs = t->bt_nrecs;
        m.m_flags = t->bt_flags & SAVEMETA;
        m.m_lorder = htonl((u_long)t->bt_lorder);
        m.m_nrecs = t->bt_nrecs;
        m.m_flags = t->bt_flags & SAVEMETA;
        m.m_lorder = htonl((u_long)t->bt_lorder);
index cf7ed94..add830f 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_split.c 5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)bt_split.c 5.7 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -295,7 +295,7 @@ bt_page(t, h, lp, rp, skip)
        ++bt_split;
 #endif
        /* Put the new right page for the split into place. */
        ++bt_split;
 #endif
        /* Put the new right page for the split into place. */
-       if ((r = mpool_new(t->bt_mp, &npg)) == NULL)
+       if ((r = __bt_new(t, &npg)) == NULL)
                return (NULL);
        r->pgno = npg;
        r->lower = BTDATAOFF;
                return (NULL);
        r->pgno = npg;
        r->lower = BTDATAOFF;
@@ -396,8 +396,8 @@ bt_root(t, h, lp, rp, skip)
        ++bt_rootsplit;
 #endif
        /* Put the new left and right pages for the split into place. */
        ++bt_rootsplit;
 #endif
        /* Put the new left and right pages for the split into place. */
-       if ((l = mpool_new(t->bt_mp, &lnpg)) == NULL ||
-           (r = mpool_new(t->bt_mp, &rnpg)) == NULL)
+       if ((l = __bt_new(t, &lnpg)) == NULL ||
+           (r = __bt_new(t, &rnpg)) == NULL)
                return (NULL);
        l->pgno = lnpg;
        r->pgno = rnpg;
                return (NULL);
        l->pgno = lnpg;
        r->pgno = rnpg;
index 2cefb3a..b10d0eb 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)btree.h     5.7 (Berkeley) %G%
+ *     @(#)btree.h     5.8 (Berkeley) %G%
  */
 
 #include <mpool.h>
  */
 
 #include <mpool.h>
@@ -262,7 +262,7 @@ typedef struct BTREE {
        FILE    *bt_rfp;                /* R: record FILE pointer */
        int     bt_rfd;                 /* R: record file descriptor */
 
        FILE    *bt_rfp;                /* R: record FILE pointer */
        int     bt_rfd;                 /* R: record file descriptor */
 
-       pgno_t  bt_free;                /* XXX next free page */
+       pgno_t  bt_free;                /* next free page */
        index_t bt_psize;               /* page size */
        index_t bt_ovflsize;            /* cut-off for key/data overflow */
        int     bt_lorder;              /* byte order */
        index_t bt_psize;               /* page size */
        index_t bt_ovflsize;            /* cut-off for key/data overflow */
        int     bt_lorder;              /* byte order */
index b28f626..68cffbb 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)extern.h    5.2 (Berkeley) %G%
+ *     @(#)extern.h    5.3 (Berkeley) %G%
  */
 
 int     __bt_close __P((DB *));
  */
 
 int     __bt_close __P((DB *));
@@ -15,7 +15,9 @@ int    __bt_defpfx __P((const DBT *, const DBT *));
 int     __bt_delete __P((const DB *, const DBT *, u_int));
 int     __bt_dleaf __P((BTREE *, PAGE *, int));
 EPG    *__bt_first __P((BTREE *, const DBT *, int *));
 int     __bt_delete __P((const DB *, const DBT *, u_int));
 int     __bt_dleaf __P((BTREE *, PAGE *, int));
 EPG    *__bt_first __P((BTREE *, const DBT *, int *));
+int     __bt_free __P((BTREE *, PAGE *));
 int     __bt_get __P((const DB *, const DBT *, DBT *, u_int));
 int     __bt_get __P((const DB *, const DBT *, DBT *, u_int));
+PAGE   *__bt_new __P((BTREE *, pgno_t *));
 DB     *__bt_open __P((const char *, int, int, const BTREEINFO *));
 void    __bt_pgin __P((void *, pgno_t, void *));
 void    __bt_pgout __P((void *, pgno_t, void *));
 DB     *__bt_open __P((const char *, int, int, const BTREEINFO *));
 void    __bt_pgin __P((void *, pgno_t, void *));
 void    __bt_pgout __P((void *, pgno_t, void *));