.ad 8
.bm 8
.fm 4
.bt $Copyright by   SAP AG, 2000$$Page %$
.tm 12
.hm 6
.hs 3
.tt 1 $SQL$Project Distributed Database System$VBD76$
.tt 2 $$$
.tt 3 $TorstenS$tree_requestlist$2000-08-01$
***********************************************************
.nf


    ========== licence begin  GPL
    Copyright (C) 2000 SAP AG

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    ========== licence end

.fo
.nf
.sp
Module  : tree_requestlist
=========
.sp
Purpose : managing lock requests on trees and leaves
.CM *-END-* purpose -------------------------------------
.sp
.cp 3
Define  :
 
        PROCEDURE
              b76delete_requestentries;
 
        PROCEDURE
              b76index_writers_start (VAR root_desc : tbd7_root_desc;
                    VAR resumed : boolean;
                    pid         : tsp00_TaskId);
 
        PROCEDURE
              b76insert_requestentry (
                    pid             : tsp00_TaskId;
                    VAR root_desc   : tbd7_root_desc;
                    leaf            : tsp00_PageNo;
                    indexnode       : tsp00_PageNo;
                    lockstate       : tbd_treelock;
                    ignore_svp      : boolean;
                    excl_lock_exist : boolean);
 
        PROCEDURE
              b76istart_index (VAR root_desc : tbd7_root_desc;
                    indexnode        : tsp00_PageNo;
                    lockstate        : tbd_treelock;
                    VAR splitt_found : boolean;
                    VAR resumed      : boolean);
 
        FUNCTION
              b76is_empty_requestlist
                    (VAR root_desc : tbd7_root_desc) : boolean;
 
        FUNCTION
              b76is_leaf_requested (VAR root_desc : tbd7_root_desc;
                    leaf      : tsp00_PageNo;
                    lockstate : tbd_treelock) : boolean;
 
        FUNCTION
              b76is_tree_requested (VAR root_desc : tbd7_root_desc;
                    lockstate : tbd_treelock) : boolean;
 
        FUNCTION
              b76last_request (root_ptr : tbd7_entry_ptr) : tbd7_entry_ptr;
 
        PROCEDURE
              b76leaf_writers_start (VAR root_desc : tbd7_root_desc;
                    VAR resumed : boolean);
 
        PROCEDURE
              b76lrstart_read_leaf (VAR root_desc : tbd7_root_desc;
                    leaf        : tsp00_PageNo;
                    VAR resumed : boolean);
 
        PROCEDURE
              b76lwstart_write_leaf (VAR root_desc : tbd7_root_desc;
                    leaf            : tsp00_PageNo;
                    VAR resumed     : boolean);
 
        PROCEDURE
              b76readers_start (VAR root_desc : tbd7_root_desc;
                    VAR resumed : boolean);
 
        PROCEDURE
              b76resume_after_svp (
                    TaskId    : tsp00_TaskId;
                    partition : tsp00_Int2);
 
        PROCEDURE
              b76riconv_to_index_req (
                    VAR root_desc   : tbd7_root_desc;
                    pid             : tsp00_TaskId;
                    indexnode       : tsp00_PageNo;
                    lockstate       : tbd_treelock;
                    excl_lock_exist : boolean);
 
        PROCEDURE
              b76start_tree (VAR root_desc : tbd7_root_desc;
                    lockstate   : tbd_treelock;
                    VAR found   : boolean;
                    VAR resumed : boolean);
 
        FUNCTION
              b76is_index_requested (
                    VAR root_desc : tbd7_root_desc;
                    indexnode     : tsp00_PageNo;
                    lockstate     : tbd_treelock) : boolean;
 
.CM *-END-* define --------------------------------------
.sp;.cp 3
Use     :
 
        FROM
              Configuration_Parameter : VGG01;
 
        VAR
              g01vtrace : tgg_vtrace_state;
 
        PROCEDURE
              g01abort (msg_no : tsp_int4;
                    msg_label  : tsp_c8;
                    msg_text   : tsp_c24;
                    bad_value  : tsp_int4);
 
        PROCEDURE
              g01check (msg_no : tsp_int4;
                    msg_label  : tsp_c8;
                    msg_text   : tsp_c24;
                    bad_value  : tsp_int4;
                    constraint : boolean);
 
      ------------------------------ 
 
        FROM
              concurrency : VBD75;
 
        VAR
              b75region_cnt : tsp00_Int4;
 
      ------------------------------ 
 
        FROM
              tree_locklist : VBD77;
 
        VAR
              b77locklist : tbd7_locklist_array;
 
        FUNCTION
              b77exist_lock_within_subtree (
                    pid           : tsp00_TaskId;
                    VAR root_desc : tbd7_root_desc;
                    indexnode     : tsp00_PageNo) : boolean;
 
        FUNCTION
              b77first_lock (VAR root_desc : tbd7_root_desc;
                    VAR root_ptr : tbd7_entry_ptr) : boolean;
 
        FUNCTION
              b77is_empty_locklist (VAR root_desc : tbd7_root_desc)
                    : boolean;
 
        FUNCTION
              b77leaf_in_locklist (VAR root_desc : tbd7_root_desc;
                    leaf : tsp00_PageNo;
                    pid  : tsp00_TaskId) : boolean;
 
        PROCEDURE
              b77pid_check (pid : tsp00_TaskId;
                    root : tsp00_PageNo);
&       ifdef TRACE
 
        PROCEDURE
              b77pointer_check (pointer : tbd7_entry_ptr;
                    root : tsp00_PageNo);
 
        PROCEDURE
              b77print_tree_locklist;
&       endif
 
        PROCEDURE
              b77root_description (root : tsp00_PageNo;
                    VAR root_desc : tbd7_root_desc);
 
      ------------------------------ 
 
        FROM
              RTE_kernel : VEN101;
 
        PROCEDURE
              vresume (pid : tsp_process_id;
                    suspend_level : tsp_int1);
&       ifdef TRACE
 
      ------------------------------ 
 
        FROM
              Test_Procedures  : VTA01;
 
        PROCEDURE
              t01int4 (layer : tgg00_Debug;
                    nam : tsp00_Sname;
                    int : tsp00_Int4);
&       endif
 
.CM *-END-* use -----------------------------------------
.sp;.cp 3
Synonym :
 
.CM *-END-* synonym -------------------------------------
.sp;.cp 3
Author  : TorstenS
.sp
.cp 3
Created : 1982-02-19
.sp
.cp 3
Version : 2000-08-01
.sp
.cp 3
Release :      Date : 2000-08-01
.sp
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Specification:
General information:
It is assumed that ROOT_DESC always points to the first entry
within the vertical double chained list, independend on lockmode.
 
.sp;.cp 7
B76DELETE_REQUESTENTRIES
.sp
This procedure removes all requestentries from the treelocklist.
Node that this concerns to all B*trees, independent on lockstate
(for instance r_lock_tree, w_lock_leaf etc.) or root number.
 
.sp;.cp 11
B76INDEX_WRITERS_START
.sp
This procedure triggers all tasks which may resides with lock_mode
requested in the treelocklist and wants to set a w_lock_index on any
indexnode of a B*tree, which is identified by ROOT_DESC. Additional the
lock_mode is converted from requested to locked. The output parameter
RESUMED indicates the calling procedure whether any processes are
resumed. In the latter case the paramter is true; otherwise false.
Node that a process will not be resumed, when the requirements are
not accomplished!
 
.sp;.cp 8
B76INSERT_REQUESTENTRY
.sp
This procedure inserts a requestentry into the treelocklist,
in consideration of chronological dependencies relative to the
separated requestentries of the corresponding B*tree. Node that the
procedure causes a vabort if there is not enought storage in the
treelocklist!
 
.sp;.cp 14
B76ISTART_INDEX
.sp
This procedure either triggers the first process which may resides
with lock_mode requested in the treelocklist and wishes to set a
w_lock_index or all processes with lockstate r_lock_index (dependent
on the input parameter LOCKSTATE) on the INDEXNODE of ROOT_DESC.
Additional the lock_mode is converted from requested to locked.
The output parameter SPLITT_FOUND indicates whether a requestentry
with lockstate w_lock_index is found. RESUMED indicates the
calling procedure whether that process is resumed. During the prepare
savepoint phase no splitt operation is allowed. So SPLITT_FOUND could
be true and resumed false.
 
.sp;.cp 7
B76IS_EMPTY_REQUESTLIST
.sp
This function checks whether there is a requestentry on a
B*tree, independent on a certain lockstate. The tree is
identified by ROOT_DESC. If a requestentry exists the function
provides false; otherwise true.
 
.sp;.cp 8
B76IS_LEAF_REQUESTED
.sp
This function checks whether there is a requestentry with lockstate
r_lock_leaf or w_lock_leaf (dependent on the input parameter)
on a leaf of a B*tree, identified by LEAF and ROOT_DESC for the
corresponding leaf respectively root. If a requestentry exists
the function provides true; otherwise false.
 
.sp;.cp 8
B76IS_TREE_REQUESTED
.sp
This function checks whether there is a requestentry with
LOCKSTATE s_lock_tree or w_lock_tree (dependent on the input
parameter) on a B*tree, identified by ROOT_DESC, within the
treelocklist. The function provides true if a requestentry
exists otherwise false.
 
B76LAST_REQUEST
.sp
This function provides a pointer referencing the last requestentry
with the same root. If no request exists then resultpointer references
the first entry within the double chained list. It is assumed that
the input paramter points to the first entry within the double chained
list!
 
.sp;.cp 11
B76LEAF_WRITERS_START
.sp
This procedure triggers all processes which may resides with lock_mode
requested in the treelocklist and wishes to set a w_lock_leaf on any
leaf of a B*tree, which is identified by ROOT_DESC. Additional the
lock_mode is converted from requested to locked. The output parameter
RESUMED indicates the calling procedure whether any processes are
resumed. In the latter case the paramter is true; otherwise false.
Node that a process will not be resumed, when the corresponding
leaf is still locked!
 
.sp;.cp 9
B76LRSTART_READ_LEAF
.sp
This procedure triggers all processes which may resides with lock_mode
requested in the treelocklist and wishes to set a r_lock_leaf
on a leaf, which is identified by ROOT_DESC and LEAF. Additional the
lock_mode is converted from requested to locked. The output parameter
RESUMED indicates the calling procedure whether any processes
are resumed. In the latter case the paramter is true; otherwise false.
 
.sp;.cp 9
B76LWSTART_WRITE_LEAF
.sp
This procedure triggers all processes which may resides with lock_mode
requested in the treelocklist and wishes to set a w_lock_leaf
on a leaf, which is identified by ROOT_DESC and LEAF. Additional the
lock_mode is converted from requested to locked. The output parameter
RESUMED indicates the calling procedure whether any processes
are resumed. In the latter case the paramter is true; otherwise false.
 
.sp;.cp 9
B76READERS_START
.sp
This procedure triggers all processes which may resides with lock_mode
requested in the treelocklist and wishes to set a r_lock_tree
on a B*tree, which is identified by ROOT_DESC. Additional the lock_mode
turns from requested to locked. The output parameter RESUMED
indicates the calling procedure whether any processes are resumed.
In the latter case the paramter is true; otherwise false.
 
.sp;.cp 8
B76RESUME_AFTER_SVP
.sp
This procedure triggers all processes which resides with lock_mode
requested and lockstate w_lock_tree in the treelocklist.
All these processes became runable during the savepointphase.
But during this phase no treesplittoperations are allowed, so the
processes were not triggered.
 
.sp;.cp 9
B76RICONV_TO_INDEX_REQ
.sp
This procedure converts either a locked r_lock_tree to a requested
r_lock_index or a locked w_lock_leaf to a requested w_lock_index.
The destination lock is identified by the parameter LOCKSTATE.
Node that this will not affect the position of the entry within
the chain, but it makes a reorganization of the next-request and
next-lock chain necessary.
 
.sp;.cp 13
B76START_TREE
.sp
This procedure either triggers the first process which may resides
with lock_mode requested in the treelocklist and wishes to set a
w_lock_tree, a d_lock_tree or  all processes with lockstate
s_lock_tree (dependent on the input parameter lockstate). Additional
the lock_mode is converted from requested to locked. The output
parameter SPLITT_FOUND indicates whether a requestenrty
with lockstate w_lock_tree or d_lock_tree is found. RESUMED indicates
the calling procedure whether that process is resumed. During the
prepare savepoint phase no splitt operation is allowed. So
SPLITT_FOUND could be true and resumed false.
 
.sp;.cp 8
B76IS_INDEX_REQUESTED
.sp
This function checks whether there is a requestentry with lockstate
w_lock_index or r_lock_index on the INDEXNODE of a B*tree which is
identified by ROOT_DESC. If INDEXNODE is equal to NIL_PAGE_NO_GG00
then the function checks whether there are any requestentries with
lockstate w_lock_index. The function provides true if a requestentry
exists otherwise false.
 
 
.CM *-END-* specification -------------------------------
.sp
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Description:
 
.CM *-END-* description ---------------------------------
.sp
***********************************************************
.sp
.cp 10
.nf
.oc _/1
Structure:
 
.CM *-END-* structure -----------------------------------
.sp 2
**********************************************************
.sp
.cp 10
.nf
.oc _/1
.CM -lll-
Code    :
 
 
(*------------------------------*) 
 
PROCEDURE
      b76delete_requestentries;
 
VAR
      partition          : integer;
      remove_first       : boolean;
      hashaddress        : integer;
      entry_ptr, jumper  : tbd7_entry_ptr;
      hlp, prev_diff_ptr : tbd7_entry_ptr;
      first_lock         : tbd7_entry_ptr;
 
BEGIN
FOR partition := 0 TO b75region_cnt - 1 DO
    FOR hashaddress := 1 TO b77locklist [partition].tll_hashsize DO
        BEGIN
        entry_ptr := b77locklist [partition].tll_anchor^ [hashaddress];
        prev_diff_ptr := entry_ptr;
        WHILE (entry_ptr <> NIL) DO
            BEGIN
            jumper := entry_ptr;
            IF  jumper^.lle_mode = bd7lm_requested
            THEN
                BEGIN
                remove_first := true;
                first_lock   := jumper^.lle_next_lock
                END
            ELSE
                BEGIN
                remove_first := false;
                first_lock   := jumper
                END;
            (*ENDIF*) 
            REPEAT
                IF  jumper^.lle_mode = bd7lm_requested
                THEN
                    BEGIN
                    IF  remove_first
                    THEN
                        BEGIN
                        entry_ptr^.lle_next_lock^.lle_next_diff_root :=
                              entry_ptr^.lle_next_diff_root;
                        entry_ptr^.lle_next_lock^.lle_prev_eq_root := NIL;
                        IF  prev_diff_ptr = entry_ptr
                        THEN
                            b77locklist [partition].tll_anchor^ [hashaddress] :=
                                  entry_ptr^.lle_next_lock
                        ELSE
                            prev_diff_ptr^.lle_next_diff_root :=
                                  entry_ptr^.lle_next_lock;
                        (*ENDIF*) 
                        entry_ptr^.lle_first_request := NIL;
                        entry_ptr^.lle_next_lock     := NIL;
                        remove_first                 := false
                        END;
                    (*ENDIF*) 
                    WITH jumper^ DO
                        BEGIN
                        lle_root             := NIL_PAGE_NO_GG00;
                        lle_leaf             := NIL_PAGE_NO_GG00;
                        lle_resume_after_svp := false;
                        lle_prev_eq_root     := NIL;
                        lle_next_request     := NIL;
                        lle_next_diff_root   :=
                              b77locklist [partition].tll_free_entry;
                        b77locklist [partition].tll_free_entry := jumper;
                        hlp              := lle_next_eq_root;
                        lle_next_eq_root := NIL;
                        vresume (lle_pid, cgg_suspend_lvl_0)
                        END
                    (*ENDWITH*) 
                    END
                ELSE
                    BEGIN
                    hlp := jumper^.lle_next_eq_root;
                    IF  jumper^.lle_next_lock <> NIL
                    THEN
                        BEGIN
                        jumper^.lle_next_eq_root := jumper^.lle_next_lock;
                        jumper^.lle_next_eq_root^.lle_prev_eq_root := jumper
                        END
                    ELSE
                        jumper^.lle_next_eq_root := NIL;
                    (*ENDIF*) 
                    END;
                (*ENDIF*) 
                jumper := hlp;
            UNTIL
                jumper = NIL;
            (*ENDREPEAT*) 
            prev_diff_ptr := first_lock;
            entry_ptr := first_lock^.lle_next_diff_root
            END
        (*ENDWHILE*) 
        END;
    (*ENDFOR*) 
(*ENDFOR*) 
b77locklist [partition].tll_resume_counter := 0;
END;
 
(*------------------------------*) 
 
PROCEDURE
      b76index_writers_start (VAR root_desc : tbd7_root_desc;
            VAR resumed : boolean;
            pid         : tsp00_TaskId);
 
VAR
      stop     : boolean;
      prev_ptr : tbd7_entry_ptr;
      root_ptr : tbd7_entry_ptr;
 
BEGIN
IF  bd76first_request (root_desc, root_ptr)
THEN
    WITH b77locklist [root_desc.rd_partition] DO
        BEGIN
        stop     := false;
        prev_ptr := root_desc.rd_ptr;
        REPEAT
            IF  (root_ptr^.lle_state = w_lock_index)
                AND
                (NOT b77exist_lock_within_subtree (pid, root_desc, root_ptr^.lle_index))
            THEN
                BEGIN
                IF  tll_prevent_split
                    AND
                    NOT  root_ptr^.lle_excl_lock_exist  (* PTS 1106058 TS 2000-03-28 *)
                THEN
                    BEGIN
                    stop := true;
                    IF  NOT root_desc.rd_ptr^.lle_resume_after_svp
                    THEN
                        BEGIN
                        tll_resume_counter := succ (tll_resume_counter);
                        root_desc.rd_ptr^.lle_resume_after_svp := true
                        END
                    (*ENDIF*) 
                    END
                ELSE
                    BEGIN
                    resumed            := true;
                    tll_split_counter := succ (tll_split_counter);
                    bd76conv_req_to_lock (prev_ptr, root_ptr);
                    IF  prev_ptr^.lle_first_request <> NIL
                    THEN
                        root_ptr := prev_ptr^.lle_first_request
                    ELSE
                        IF  prev_ptr^.lle_mode = bd7lm_requested
                        THEN
                            root_ptr := prev_ptr
                        ELSE
                            root_ptr := prev_ptr^.lle_next_request
                        (*ENDIF*) 
                    (*ENDIF*) 
                    END
                (*ENDIF*) 
                END
            ELSE
                BEGIN
                prev_ptr := root_ptr;
                root_ptr := root_ptr^.lle_next_request
                END
            (*ENDIF*) 
        UNTIL
            (root_ptr = NIL) OR stop;
        (*ENDREPEAT*) 
        END
    (*ENDWITH*) 
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      b76insert_requestentry (
            pid             : tsp00_TaskId;
            VAR root_desc   : tbd7_root_desc;
            leaf            : tsp00_PageNo;
            indexnode       : tsp00_PageNo;
            lockstate       : tbd_treelock;
            ignore_svp      : boolean;
            excl_lock_exist : boolean);
 
VAR
      inserted                   : boolean;
      entry_ptr                  : tbd7_entry_ptr;
      new_entry_ptr, prev_eq_ptr : tbd7_entry_ptr;
 
BEGIN
&ifdef TRACE
b77print_tree_locklist;
&endif
WITH root_desc DO
    BEGIN
    (* TEST TEST TEST *)
    b77pid_check (pid,  rd_root);
    (* TEST TEST TEST *)
    IF  b77locklist [rd_partition].tll_free_entry = NIL
    THEN
        g01abort (csp3_b76x1_request_overflow, csp3_n_treelock,
              'request overflow   (pid)', pid);
    (*ENDIF*) 
    inserted      := false;
    entry_ptr     := rd_ptr;
    (* PTS 1106058 TS 2000-03-28 *)
    new_entry_ptr := bd76insert_requestentry (pid, rd_root,
          rd_partition, leaf, indexnode, lockstate, ignore_svp,
          excl_lock_exist);
    (* PTS 1106058  *)
    (* --- Establish next-request chain --- *)
    prev_eq_ptr := b76last_request (entry_ptr);
&   ifdef TRACE
    b77pointer_check (prev_eq_ptr, rd_root);
&   endif
    IF  prev_eq_ptr^.lle_mode = bd7lm_locked
    THEN
        prev_eq_ptr^.lle_first_request := new_entry_ptr
    ELSE
        prev_eq_ptr^.lle_next_request := new_entry_ptr;
    (*ENDIF*) 
    prev_eq_ptr := entry_ptr;
    REPEAT
        IF  entry_ptr = NIL
        THEN
            BEGIN
            (* Add a new requestentry to the end of *)
            (* the vertical double chained list.    *)
            prev_eq_ptr^.lle_next_eq_root   := new_entry_ptr;
            new_entry_ptr^.lle_prev_eq_root := prev_eq_ptr;
            inserted := true
            END
        ELSE
            (* Add a new requestentry within the *)
            (* vertical double chained list.     *)
            IF  leaf <= entry_ptr^.lle_leaf
            THEN
                BEGIN
                (* The requestentry substitutes the present  *)
                (* head of the vertical double chained list. *)
                IF  prev_eq_ptr = entry_ptr
                THEN
                    BEGIN
                    (* --- Establish horizontal chain --- *)
                    IF  rd_prev_ptr = entry_ptr
                    THEN
                        BEGIN
                        b77locklist [rd_partition].tll_anchor^ [rd_hash] :=
                              new_entry_ptr;
                        rd_prev_ptr := new_entry_ptr
                        END
                    ELSE
                        rd_prev_ptr^.lle_next_diff_root :=
                              new_entry_ptr;
                    (*ENDIF*) 
                    rd_ptr := new_entry_ptr;
                    IF  entry_ptr^.lle_next_diff_root <> NIL
                    THEN
                        BEGIN
                        new_entry_ptr^.lle_next_diff_root :=
                              entry_ptr^.lle_next_diff_root;
                        entry_ptr^.lle_next_diff_root := NIL
                        END;
                    (* --- Establish vertical chain --- *)
                    (*ENDIF*) 
                    new_entry_ptr^.lle_next_eq_root := entry_ptr;
                    entry_ptr^.lle_prev_eq_root := new_entry_ptr;
                    (* --- Revive resume_after_svp --- *)
                    IF  entry_ptr^.lle_resume_after_svp
                    THEN
                        BEGIN
                        entry_ptr^.lle_resume_after_svp     := false;
                        new_entry_ptr^.lle_resume_after_svp := true
                        END;
                    (* --- Establish next-lock chain --- *)
                    (*ENDIF*) 
                    IF  entry_ptr^.lle_mode = bd7lm_locked
                    THEN
                        new_entry_ptr^.lle_next_lock := entry_ptr
                    ELSE
                        IF  entry_ptr^.lle_next_lock <> NIL
                        THEN
                            BEGIN
                            new_entry_ptr^.lle_next_lock :=
                                  entry_ptr^.lle_next_lock;
                            entry_ptr^.lle_next_lock := NIL
                            END;
                        (* --- Establish first-request chain --- *)
                        (*ENDIF*) 
                    (*ENDIF*) 
                    IF  entry_ptr^.lle_first_request <> NIL
                    THEN
                        BEGIN
                        IF  (entry_ptr^.lle_first_request <>
                            new_entry_ptr)
                        THEN
                            new_entry_ptr^.lle_first_request :=
                                  entry_ptr^.lle_first_request;
                        (*ENDIF*) 
                        entry_ptr^.lle_first_request := NIL
                        END
                    ELSE
                        IF  entry_ptr^.lle_mode = bd7lm_requested
                        THEN
                            new_entry_ptr^.lle_first_request :=entry_ptr
                        (*ENDIF*) 
                    (*ENDIF*) 
                    END
                ELSE
                    (* The requestentry will not be added to the first*)
                    (* position of the vertical double chained list.  *)
                    BEGIN
                    WHILE  entry_ptr^.lle_leaf >= leaf DO
                        entry_ptr := entry_ptr^.lle_prev_eq_root;
                    (*ENDWHILE*) 
                    (* --- Establish vertical chain --- *)
                    new_entry_ptr^.lle_next_eq_root :=
                          entry_ptr^.lle_next_eq_root;
                    IF  entry_ptr^.lle_next_eq_root <> NIL
                    THEN
                        entry_ptr^.lle_next_eq_root^.lle_prev_eq_root :=
                              new_entry_ptr;
                    (*ENDIF*) 
                    entry_ptr^.lle_next_eq_root     := new_entry_ptr;
                    new_entry_ptr^.lle_prev_eq_root := entry_ptr
                    END;
                (*ENDIF*) 
                inserted := true
                END
            ELSE
                BEGIN
                prev_eq_ptr := entry_ptr;
                IF  entry_ptr^.lle_next_lock <> NIL
                THEN
                    entry_ptr := entry_ptr^.lle_next_lock
                ELSE
                    entry_ptr := entry_ptr^.lle_next_eq_root
                (*ENDIF*) 
                END;
            (*ENDIF*) 
        (*ENDIF*) 
    UNTIL
        inserted
    (*ENDREPEAT*) 
    END;
(*ENDWITH*) 
&ifdef TRACE
b77print_tree_locklist;
&endif
END;
 
(*------------------------------*) 
 
PROCEDURE
      b76istart_index (VAR root_desc : tbd7_root_desc;
            indexnode        : tsp00_PageNo;
            lockstate        : tbd_treelock;
            VAR splitt_found : boolean;
            VAR resumed      : boolean);
 
VAR
      root_ptr : tbd7_entry_ptr;
      prev_ptr : tbd7_entry_ptr;
 
BEGIN
IF  bd76first_request (root_desc, root_ptr)
THEN
    BEGIN
    prev_ptr := root_desc.rd_ptr;
    IF  lockstate = r_lock_index
    THEN
        REPEAT
            IF  (root_ptr^.lle_state = r_lock_index) AND
                (root_ptr^.lle_index = indexnode)
            THEN
                BEGIN
                resumed := true;
                bd76conv_req_to_lock (prev_ptr, root_ptr);
                IF  prev_ptr^.lle_first_request <> NIL
                THEN
                    root_ptr := prev_ptr^.lle_first_request
                ELSE
                    IF  prev_ptr^.lle_mode = bd7lm_requested
                    THEN
                        root_ptr := prev_ptr
                    ELSE
                        root_ptr := prev_ptr^.lle_next_request
                    (*ENDIF*) 
                (*ENDIF*) 
                END
            ELSE
                BEGIN
                prev_ptr := root_ptr;
                root_ptr := root_ptr^.lle_next_request
                END;
            (*ENDIF*) 
        UNTIL
            (root_ptr = NIL)
        (*ENDREPEAT*) 
    ELSE
        REPEAT
            IF  (root_ptr^.lle_state = w_lock_index) AND
                (root_ptr^.lle_index = indexnode)
            THEN
                WITH b77locklist [root_desc.rd_partition] DO
                    BEGIN
                    splitt_found := true;
                    IF  tll_prevent_split
                        AND
                        NOT root_ptr^.lle_excl_lock_exist (* PTS 1106058 TS 2000-03-28 *)
                    THEN
                        BEGIN
                        IF  NOT root_desc.rd_ptr^.lle_resume_after_svp
                        THEN
                            BEGIN
                            tll_resume_counter := succ (tll_resume_counter);
                            root_desc.rd_ptr^.lle_resume_after_svp := true
                            END
                        (*ENDIF*) 
                        END
                    ELSE
                        BEGIN
                        resumed           := true;
                        tll_split_counter := succ (tll_split_counter);
                        bd76conv_req_to_lock (prev_ptr, root_ptr)
                        END
                    (*ENDIF*) 
                    END;
                (*ENDWITH*) 
            (*ENDIF*) 
            prev_ptr := root_ptr;
            root_ptr := root_ptr^.lle_next_request;
        UNTIL
            splitt_found OR (root_ptr = NIL)
        (*ENDREPEAT*) 
    (*ENDIF*) 
    END
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
FUNCTION
      b76is_empty_requestlist
            (VAR root_desc : tbd7_root_desc) : boolean;
 
VAR
      empty    : boolean;
      root_ptr : tbd7_entry_ptr;
 
BEGIN
empty := true;
IF  bd76first_request (root_desc, root_ptr)
THEN
    empty := false;
(*ENDIF*) 
b76is_empty_requestlist := empty
END;
 
(*------------------------------*) 
 
FUNCTION
      b76is_leaf_requested (VAR root_desc : tbd7_root_desc;
            leaf      : tsp00_PageNo;
            lockstate : tbd_treelock) : boolean;
 
VAR
      found    : boolean;
      root_ptr : tbd7_entry_ptr;
 
BEGIN
found := false;
IF  bd76first_request (root_desc, root_ptr)
THEN
    REPEAT
        IF  (root_ptr^.lle_leaf  =  leaf) AND
            (root_ptr^.lle_state = lockstate)
        THEN
            BEGIN
            root_desc.rd_collision_ptr := root_ptr;
            found := true
            END
        ELSE
            root_ptr := root_ptr^.lle_next_request;
        (*ENDIF*) 
    UNTIL
        found OR (root_ptr = NIL);
    (*ENDREPEAT*) 
(*ENDIF*) 
b76is_leaf_requested := found
END;
 
(* PTS 1107109 TS 2000-07-07 *)
(*------------------------------*) 
 
FUNCTION
      b76is_index_requested (
            VAR root_desc : tbd7_root_desc;
            indexnode     : tsp00_PageNo;
            lockstate     : tbd_treelock) : boolean;
 
VAR
      found    : boolean;
      root_ptr : tbd7_entry_ptr;
 
BEGIN
found := false;
IF  bd76first_request (root_desc, root_ptr)
THEN
    REPEAT
        IF  (root_ptr^.lle_state = lockstate)
            AND
            ((indexnode = root_ptr^.lle_index) OR (indexnode = NIL_PAGE_NO_GG00))
        THEN
            BEGIN
            root_desc.rd_collision_ptr := root_ptr;
            found := true
            END
        ELSE
            root_ptr := root_ptr^.lle_next_request;
        (*ENDIF*) 
    UNTIL
        found OR (root_ptr = NIL);
    (*ENDREPEAT*) 
(*ENDIF*) 
b76is_index_requested := found
END;
 
(* PTS 1107109 *)
(*------------------------------*) 
 
FUNCTION
      b76is_tree_requested (VAR root_desc : tbd7_root_desc;
            lockstate : tbd_treelock) : boolean;
 
VAR
      found    : boolean;
      root_ptr : tbd7_entry_ptr;
 
BEGIN
found := false;
IF  bd76first_request (root_desc, root_ptr)
THEN
    REPEAT
        IF  root_ptr^.lle_state = lockstate
        THEN
            BEGIN
            root_desc.rd_collision_ptr := root_ptr;
            found := true
            END
        ELSE
            root_ptr := root_ptr^.lle_next_request;
        (*ENDIF*) 
    UNTIL
        found OR (root_ptr = NIL);
    (*ENDREPEAT*) 
(*ENDIF*) 
b76is_tree_requested := found
END;
 
(*------------------------------*) 
 
FUNCTION
      b76last_request (root_ptr : tbd7_entry_ptr) : tbd7_entry_ptr;
 
BEGIN
IF  root_ptr^.lle_first_request <> NIL
THEN
    root_ptr := root_ptr^.lle_first_request
ELSE
    IF  root_ptr^.lle_next_request <> NIL
    THEN
        root_ptr := root_ptr^.lle_next_request;
    (*ENDIF*) 
(*ENDIF*) 
WHILE (root_ptr^.lle_next_request <> NIL) DO
    root_ptr := root_ptr^.lle_next_request;
(*ENDWHILE*) 
b76last_request := root_ptr
END;
 
(*------------------------------*) 
 
PROCEDURE
      b76leaf_writers_start (VAR root_desc : tbd7_root_desc;
            VAR resumed : boolean);
 
VAR
      prev_ptr, root_ptr : tbd7_entry_ptr;
 
BEGIN
IF  bd76first_request (root_desc, root_ptr)
THEN
    BEGIN
    prev_ptr := root_desc.rd_ptr;
    REPEAT
        IF  (root_ptr^.lle_state = w_lock_leaf) AND NOT
            b77leaf_in_locklist (root_desc, root_ptr^.lle_leaf,
            root_ptr^.lle_pid)
        THEN
            BEGIN
            resumed := true;
            bd76conv_req_to_lock (prev_ptr, root_ptr);
            IF  prev_ptr^.lle_first_request <> NIL
            THEN
                root_ptr := prev_ptr^.lle_first_request
            ELSE
                IF  prev_ptr^.lle_mode = bd7lm_requested
                THEN
                    root_ptr := prev_ptr
                ELSE
                    root_ptr := prev_ptr^.lle_next_request
                (*ENDIF*) 
            (*ENDIF*) 
            END
        ELSE
            BEGIN
            prev_ptr := root_ptr;
            root_ptr := root_ptr^.lle_next_request
            END
        (*ENDIF*) 
    UNTIL
        (root_ptr = NIL)
    (*ENDREPEAT*) 
    END
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      b76lrstart_read_leaf (VAR root_desc : tbd7_root_desc;
            leaf        : tsp00_PageNo;
            VAR resumed : boolean);
 
VAR
      prev_ptr, root_ptr : tbd7_entry_ptr;
 
BEGIN
IF  bd76first_request (root_desc, root_ptr)
THEN
    BEGIN
    prev_ptr := root_desc.rd_ptr;
    REPEAT
        IF  (root_ptr^.lle_leaf  = leaf) AND
            (root_ptr^.lle_state = r_lock_leaf)
        THEN
            BEGIN
            resumed            := true;
            bd76conv_req_to_lock (prev_ptr, root_ptr);
            IF  prev_ptr^.lle_first_request <> NIL
            THEN
                root_ptr := prev_ptr^.lle_first_request
            ELSE
                IF  prev_ptr^.lle_mode = bd7lm_requested
                THEN
                    root_ptr := prev_ptr
                ELSE
                    root_ptr := prev_ptr^.lle_next_request
                (*ENDIF*) 
            (*ENDIF*) 
            END
        ELSE
            BEGIN
            prev_ptr := root_ptr;
            root_ptr := root_ptr^.lle_next_request
            END;
        (*ENDIF*) 
    UNTIL
        root_ptr = NIL
    (*ENDREPEAT*) 
    END
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      b76lwstart_write_leaf (VAR root_desc : tbd7_root_desc;
            leaf            : tsp00_PageNo;
            VAR resumed     : boolean);
 
VAR
      prev_ptr, root_ptr : tbd7_entry_ptr;
 
BEGIN
IF  bd76first_request (root_desc, root_ptr)
THEN
    BEGIN
    prev_ptr := root_desc.rd_ptr;
    REPEAT
        IF  (root_ptr^.lle_leaf  = leaf) AND
            (root_ptr^.lle_state = w_lock_leaf)
        THEN
            BEGIN
            resumed := true;
            bd76conv_req_to_lock (prev_ptr, root_ptr)
            END
        ELSE
            BEGIN
            prev_ptr := root_ptr;
            root_ptr := root_ptr^.lle_next_request
            END
        (*ENDIF*) 
    UNTIL
        resumed OR (root_ptr = NIL)
    (*ENDREPEAT*) 
    END
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      b76readers_start (VAR root_desc : tbd7_root_desc;
            VAR resumed : boolean);
 
VAR
      prev_ptr, root_ptr : tbd7_entry_ptr;
 
BEGIN
IF  bd76first_request (root_desc, root_ptr)
THEN
    BEGIN
    prev_ptr := root_desc.rd_ptr;
    REPEAT
        IF  root_ptr^.lle_state = r_lock_tree
        THEN
            BEGIN
            resumed := true;
            bd76conv_req_to_lock (prev_ptr, root_ptr);
            IF  prev_ptr^.lle_first_request <> NIL
            THEN
                root_ptr := prev_ptr^.lle_first_request
            ELSE
                IF  prev_ptr^.lle_mode = bd7lm_requested
                THEN
                    root_ptr := prev_ptr
                ELSE
                    root_ptr := prev_ptr^.lle_next_request
                (*ENDIF*) 
            (*ENDIF*) 
            END
        ELSE
            BEGIN
            prev_ptr := root_ptr;
            root_ptr := root_ptr^.lle_next_request
            END;
        (*ENDIF*) 
    UNTIL
        root_ptr = NIL
    (*ENDREPEAT*) 
    END
(*ENDIF*) 
END;
 
(* PTS 1107109 TS 2000-07-20 *)
(*------------------------------*) 
 
PROCEDURE
      b76resume_after_svp (
            TaskId    : tsp00_TaskId;
            partition : tsp00_Int2);
 
VAR
      resumed      : boolean;
      split_found  : boolean;
      root_desc    : tbd7_root_desc;
      hashaddress  : tsp00_Int4;
      head_ptr     : tbd7_entry_ptr;
 
BEGIN
WITH b77locklist [partition] DO
    BEGIN
&   ifdef TRACE
    t01int4 (bd_lock, 'resume_count', tll_resume_counter);
&   endif
    IF  g01vtrace.vtrCheck_gg00
    THEN
        g01check (csp3_b76c1_invalid_resume_cnt, csp3_n_treelock,
              'B76: RESUMECOUNTER < 0  ', tll_resume_counter,
              (tll_resume_counter >= 0));
    (*ENDIF*) 
    resumed     := false;
    split_found := false;
    hashaddress := 1;
    WHILE (hashaddress <= tll_hashsize) AND (tll_resume_counter <> 0) DO
        BEGIN
        head_ptr := tll_anchor ^[hashaddress];
        WHILE (head_ptr <> NIL) AND (tll_resume_counter <> 0) DO
            BEGIN
            IF  head_ptr^.lle_resume_after_svp
            THEN
                BEGIN
                b77root_description (head_ptr^.lle_root, root_desc);
                b76index_writers_start (root_desc, resumed, TaskId);
                IF  (NOT resumed) AND b77is_empty_locklist (root_desc)
                THEN
                    BEGIN
                    b76start_tree (root_desc, w_lock_tree, split_found, resumed);
                    IF  (NOT split_found) AND (NOT resumed)
                    THEN
                        b76start_tree (root_desc, d_lock_tree, split_found, resumed);
                    (*ENDIF*) 
                    END;
                (*ENDIF*) 
                head_ptr^.lle_resume_after_svp := false;
                tll_resume_counter             := pred (tll_resume_counter)
                END;
            (*ENDIF*) 
            head_ptr := head_ptr^.lle_next_diff_root
            END;
        (*ENDWHILE*) 
        hashaddress := succ (hashaddress)
        END;
    (*ENDWHILE*) 
    IF  g01vtrace.vtrCheck_gg00
    THEN
        g01check (csp3_b76c2_invalid_resume_cnt, csp3_n_treelock,
              'B76: RESUMECOUNT <> 0   ', 0, tll_resume_counter = 0)
    (*ENDIF*) 
    END
(*ENDWITH*) 
END;
 
(* PTS 1107109 *)
(*------------------------------*) 
 
PROCEDURE
      b76riconv_to_index_req (
            VAR root_desc   : tbd7_root_desc;
            pid             : tsp00_TaskId;
            indexnode       : tsp00_PageNo;
            lockstate       : tbd_treelock;
            excl_lock_exist : boolean);
 
VAR
      found        : boolean;
      entry_ptr    : tbd7_entry_ptr;
      last_req_ptr : tbd7_entry_ptr;
      prev_eq_ptr  : tbd7_entry_ptr;
 
BEGIN
found := false;
(* --- Search lockentry with his predecessor in next-lock chain --- *)
IF  b77first_lock (root_desc, entry_ptr)
THEN
    BEGIN
    prev_eq_ptr := root_desc.rd_ptr;
    REPEAT
        IF  entry_ptr^.lle_pid = pid
        THEN
            found := true
        ELSE
            BEGIN
            prev_eq_ptr := entry_ptr;
            entry_ptr   := entry_ptr^.lle_next_lock
            END;
        (*ENDIF*) 
    UNTIL
        found OR (entry_ptr = NIL)
    (*ENDREPEAT*) 
    END;
(*ENDIF*) 
IF  NOT found
THEN
    g01abort (csp3_b76x1_lockentry_not_found, csp3_n_treelock,
          'lckentry not found (pid)', pid);
(* --- Establish next-lock chain --- *)
(*ENDIF*) 
IF  entry_ptr^.lle_prev_eq_root <> NIL
THEN
    BEGIN
    prev_eq_ptr^.lle_next_lock := entry_ptr^.lle_next_lock;
    entry_ptr^.lle_next_lock   := NIL
    END;
(* --- Establish first-request chain --- *)
(*ENDIF*) 
last_req_ptr := b76last_request (root_desc.rd_ptr);
&ifdef TRACE
b77pointer_check (last_req_ptr, root_desc.rd_root);
&endif
IF  entry_ptr^.lle_prev_eq_root <> NIL
THEN
    BEGIN
    (* Converted entry isn't the first entry within the *)
    (* vertical chain.                                  *)
    IF  last_req_ptr^.lle_mode = bd7lm_locked
    THEN
        (* There is no request entry. *)
        last_req_ptr^.lle_first_request := entry_ptr
    ELSE
        last_req_ptr^.lle_next_request  := entry_ptr
    (*ENDIF*) 
    END
ELSE
    BEGIN
    IF  last_req_ptr <> entry_ptr
    THEN
        (* There is already one request entry. *)
        last_req_ptr^.lle_next_request := entry_ptr
    (*ENDIF*) 
    END;
(*ENDIF*) 
entry_ptr^.lle_mode  := bd7lm_requested;
entry_ptr^.lle_state := lockstate;
entry_ptr^.lle_index := indexnode;
(* PTS 1106058 TS 2000-03-28 *)
entry_ptr^.lle_excl_lock_exist := excl_lock_exist;
(* PTS 1106055 *)
END;
 
(*------------------------------*) 
 
PROCEDURE
      b76start_tree (VAR root_desc : tbd7_root_desc;
            lockstate   : tbd_treelock;
            VAR found   : boolean;
            VAR resumed : boolean);
 
VAR
      prev_ptr : tbd7_entry_ptr;
      root_ptr : tbd7_entry_ptr;
 
BEGIN
IF  bd76first_request (root_desc, root_ptr)
THEN
    BEGIN
    prev_ptr := root_desc.rd_ptr;
    IF  lockstate = s_lock_tree
    THEN
        REPEAT
            IF  root_ptr^.lle_state = s_lock_tree
            THEN
                BEGIN
                resumed := true;
                bd76conv_req_to_lock (prev_ptr, root_ptr);
                IF  prev_ptr^.lle_first_request <> NIL
                THEN
                    root_ptr := prev_ptr^.lle_first_request
                ELSE
                    IF  prev_ptr^.lle_mode = bd7lm_requested
                    THEN
                        root_ptr := prev_ptr
                    ELSE
                        root_ptr := prev_ptr^.lle_next_request
                    (*ENDIF*) 
                (*ENDIF*) 
                END
            ELSE
                BEGIN
                prev_ptr := root_ptr;
                root_ptr := root_ptr^.lle_next_request;
                END
            (*ENDIF*) 
        UNTIL
            (root_ptr = NIL)
        (*ENDREPEAT*) 
    ELSE
        BEGIN
        REPEAT
            IF  root_ptr^.lle_state = lockstate
            THEN
                WITH b77locklist [root_desc.rd_partition] DO
                    BEGIN
                    found := true;
                    IF  tll_prevent_split AND          (* PTS 1106058 TS 2000-03-28 *)
                        NOT (root_ptr^.lle_ignore_svp OR root_ptr^.lle_excl_lock_exist)
                    THEN
                        BEGIN
                        IF  NOT root_desc.rd_ptr^.lle_resume_after_svp
                        THEN
                            BEGIN
                            tll_resume_counter := succ (tll_resume_counter);
                            root_desc.rd_ptr^.lle_resume_after_svp := true
                            END
                        (*ENDIF*) 
                        END
                    ELSE
                        BEGIN
                        resumed := true;
                        IF  (lockstate = d_lock_tree) AND
                            root_ptr^.lle_ignore_svp
                        THEN
                            tll_svp_ignore_cnt := succ (tll_svp_ignore_cnt);
                        (*ENDIF*) 
                        tll_split_counter := succ (tll_split_counter);
                        bd76conv_req_to_lock (prev_ptr, root_ptr)
                        END
                    (*ENDIF*) 
                    END;
                (*ENDWITH*) 
            (*ENDIF*) 
            prev_ptr := root_ptr;
            root_ptr := root_ptr^.lle_next_request;
        UNTIL
            found OR (root_ptr = NIL)
        (*ENDREPEAT*) 
        END
    (*ENDIF*) 
    END
(*ENDIF*) 
END;
 
(*------------------------------*) 
 
PROCEDURE
      bd76conv_req_to_lock (prev_request : tbd7_entry_ptr;
            convert : tbd7_entry_ptr);
 
VAR
      found     : boolean;
      prev_lock : tbd7_entry_ptr;
 
BEGIN
found     := false;
prev_lock := convert;
(* Search previous lockentry. If no one exists then *)
(* provide the requestentry on first position.      *)
WHILE (prev_lock <> NIL) AND NOT found DO
    IF  (prev_lock^.lle_mode = bd7lm_locked) OR
        (prev_lock^.lle_prev_eq_root = NIL)
    THEN
        found := true
    ELSE
        prev_lock := prev_lock^.lle_prev_eq_root;
    (*ENDIF*) 
(*ENDWHILE*) 
(* --- Establish next-lock chain --- *)
IF  (prev_lock^.lle_mode = bd7lm_locked) OR (prev_lock <> convert)
THEN
    BEGIN
    convert^.lle_next_lock   := prev_lock^.lle_next_lock;
    prev_lock^.lle_next_lock := convert
    END;
(* --- Establish next-request chain --- *)
(*ENDIF*) 
IF  prev_request^.lle_mode = bd7lm_locked
THEN
    prev_request^.lle_first_request := convert^.lle_next_request
ELSE
    IF  prev_request^.lle_next_request = convert
    THEN
        (* Converted entry was referenced by next-request chain. *)
        prev_request^.lle_next_request := convert^.lle_next_request
    ELSE
        IF  prev_request = convert
        THEN
            (* Converted entry is the first entry within ver- *)
            (* tical chain. A following requestentry must be  *)
            (* referenced by the first-request chain.         *)
            prev_request^.lle_first_request :=
                  prev_request^.lle_next_request
        ELSE
            (* Converted entry was referenced by first-request chain.*)
            IF  prev_request = convert^.lle_next_request
            THEN
                prev_request^.lle_first_request := NIL
            ELSE
                prev_request^.lle_first_request := convert^.lle_next_request;
            (*ENDIF*) 
        (*ENDIF*) 
    (*ENDIF*) 
(*ENDIF*) 
convert^.lle_mode         := bd7lm_locked;
convert^.lle_next_request := NIL;
vresume (convert^.lle_pid, cgg_suspend_lvl_0)
END;
 
(*------------------------------*) 
 
FUNCTION
      bd76first_request (VAR root_desc : tbd7_root_desc;
            VAR root_ptr : tbd7_entry_ptr) : boolean;
 
VAR
      found : boolean;
 
BEGIN
found := false;
IF  root_desc.rd_exist
THEN
    BEGIN
    root_ptr := root_desc.rd_ptr;
    IF  root_ptr^.lle_first_request <> NIL
    THEN
        BEGIN
        found    := true;
        root_ptr := root_ptr^.lle_first_request
        END
    ELSE
        IF  root_ptr^.lle_mode = bd7lm_requested
        THEN
            found := true
        (*ENDIF*) 
    (*ENDIF*) 
    END;
&ifdef TRACE
(*ENDIF*) 
IF  found
THEN
    b77pointer_check (root_ptr, root_desc.rd_root);
&endif
(*ENDIF*) 
bd76first_request := found
END;
 
(*------------------------------*) 
 
FUNCTION
      bd76insert_requestentry (
            pid             : tsp00_TaskId;
            root            : tsp00_PageNo;
            partition       : integer;
            leaf            : tsp00_PageNo;
            indexnode       : tsp00_PageNo;
            lockstate       : tbd_treelock;
            ignore_svp      : boolean;
            excl_lock_exist : boolean) : tbd7_entry_ptr;
 
VAR
      new_entry_ptr : tbd7_entry_ptr;
 
BEGIN
WITH b77locklist [partition] DO
    BEGIN
&   ifdef TRACE
    b77pointer_check (tll_free_entry, root);
&   endif
    new_entry_ptr                      := tll_free_entry;
    tll_free_entry                     := tll_free_entry^.lle_next_diff_root;
    new_entry_ptr^.lle_next_diff_root  := NIL;
    new_entry_ptr^.lle_pid             := pid;
    new_entry_ptr^.lle_root            := root;
    new_entry_ptr^.lle_leaf            := leaf;
    new_entry_ptr^.lle_index           := indexnode;
    new_entry_ptr^.lle_state           := lockstate;
    new_entry_ptr^.lle_mode            := bd7lm_requested;
    new_entry_ptr^.lle_ignore_svp      := ignore_svp;
    (* PTS 1106058 TS 2000-03-28 *)
    new_entry_ptr^.lle_excl_lock_exist := excl_lock_exist;
    (* PTS 1106058 *)
    END;
(*ENDWITH*) 
bd76insert_requestentry := new_entry_ptr
END;
 
.CM *-END-* code ----------------------------------------
.SP 2 
***********************************************************
*-PRETTY-*  statements    :        353
*-PRETTY-*  lines of code :       1147        PRETTYX 3.10 
*-PRETTY-*  lines in file :       1575         1997-12-10 
.PA 
