| 4018 | |
| 4019 | |
| 4020 | static int get_related(BufferDesc* bdb, PagesArray &lowPages, int limit, const ULONG mark) |
| 4021 | { |
| 4022 | /************************************** |
| 4023 | * |
| 4024 | * g e t _ r e l a t e d |
| 4025 | * |
| 4026 | ************************************** |
| 4027 | * |
| 4028 | * Functional description |
| 4029 | * Recursively walk low part of precedence graph of given buffer and put |
| 4030 | * low pages numbers into array. |
| 4031 | * |
| 4032 | **************************************/ |
| 4033 | BufferControl* bcb = bdb->bdb_bcb; |
| 4034 | fb_assert(bcb->bcb_syncPrecedence.ourExclusiveLock()); |
| 4035 | |
| 4036 | const struct que* base = &bdb->bdb_lower; |
| 4037 | for (const struct que* que_inst = base->que_forward; que_inst != base; |
| 4038 | que_inst = que_inst->que_forward) |
| 4039 | { |
| 4040 | const Precedence* precedence = BLOCK(que_inst, Precedence, pre_lower); |
| 4041 | if (precedence->pre_flags & PRE_cleared) |
| 4042 | continue; |
| 4043 | |
| 4044 | BufferDesc* low = precedence->pre_low; |
| 4045 | if (low->bdb_prec_walk_mark == mark) |
| 4046 | continue; |
| 4047 | |
| 4048 | if (!--limit) |
| 4049 | return 0; |
| 4050 | |
| 4051 | const SLONG lowPage = low->bdb_page.getPageNum(); |
| 4052 | FB_SIZE_T pos; |
| 4053 | if (!lowPages.find(lowPage, pos)) |
| 4054 | lowPages.insert(pos, lowPage); |
| 4055 | |
| 4056 | if (QUE_NOT_EMPTY(low->bdb_lower)) |
| 4057 | { |
| 4058 | limit = get_related(low, lowPages, limit, mark); |
| 4059 | if (!limit) |
| 4060 | return 0; |
| 4061 | } |
| 4062 | else |
| 4063 | low->bdb_prec_walk_mark = mark; |
| 4064 | } |
| 4065 | |
| 4066 | bdb->bdb_prec_walk_mark = mark; |
| 4067 | return limit; |
| 4068 | } |
| 4069 | |
| 4070 | |
| 4071 | static LockState lock_buffer(thread_db* tdbb, BufferDesc* bdb, const SSHORT wait, |
no test coverage detected