aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/postmaster/autovacuum.c17
-rw-r--r--src/backend/postmaster/postmaster.c4
-rw-r--r--src/backend/utils/cache/catcache.c8
-rw-r--r--src/include/lib/ilist.h45
-rw-r--r--src/include/utils/catcache.h1
5 files changed, 27 insertions, 48 deletions
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index afd15aac973..6977bcf75e4 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -580,7 +580,6 @@ AutoVacLauncherMain(int argc, char *argv[])
struct timeval nap;
TimestampTz current_time = 0;
bool can_launch;
- avl_dbase *avdb;
int rc;
/*
@@ -725,7 +724,8 @@ AutoVacLauncherMain(int argc, char *argv[])
worker->wi_tableoid = InvalidOid;
worker->wi_proc = NULL;
worker->wi_launchtime = 0;
- dlist_push_head(&AutoVacuumShmem->av_freeWorkers, &worker->wi_links);
+ dlist_push_head(&AutoVacuumShmem->av_freeWorkers,
+ &worker->wi_links);
AutoVacuumShmem->av_startingWorker = NULL;
elog(WARNING, "worker took too long to start; canceled");
}
@@ -760,6 +760,8 @@ AutoVacLauncherMain(int argc, char *argv[])
* distant adl_next_worker first, we obtain our database from the
* tail of the list.
*/
+ avl_dbase *avdb;
+
avdb = dlist_tail_element(avl_dbase, adl_node, &DatabaseList);
/*
@@ -790,8 +792,6 @@ AutoVacLauncherMain(int argc, char *argv[])
static void
launcher_determine_sleep(bool canlaunch, bool recursing, struct timeval * nap)
{
- avl_dbase *avdb;
-
/*
* We sleep until the next scheduled vacuum. We trust that when the
* database list was built, care was taken so that no entries have times
@@ -807,6 +807,7 @@ launcher_determine_sleep(bool canlaunch, bool recursing, struct timeval * nap)
{
TimestampTz current_time = GetCurrentTimestamp();
TimestampTz next_wakeup;
+ avl_dbase *avdb;
long secs;
int usecs;
@@ -1677,7 +1678,7 @@ FreeWorkerInfo(int code, Datum arg)
*/
AutovacuumLauncherPid = AutoVacuumShmem->av_launcherpid;
- dlist_delete(&AutoVacuumShmem->av_runningWorkers, &MyWorkerInfo->wi_links);
+ dlist_delete(&MyWorkerInfo->wi_links);
MyWorkerInfo->wi_dboid = InvalidOid;
MyWorkerInfo->wi_tableoid = InvalidOid;
MyWorkerInfo->wi_proc = NULL;
@@ -1685,7 +1686,8 @@ FreeWorkerInfo(int code, Datum arg)
MyWorkerInfo->wi_cost_delay = 0;
MyWorkerInfo->wi_cost_limit = 0;
MyWorkerInfo->wi_cost_limit_base = 0;
- dlist_push_head(&AutoVacuumShmem->av_freeWorkers, &MyWorkerInfo->wi_links);
+ dlist_push_head(&AutoVacuumShmem->av_freeWorkers,
+ &MyWorkerInfo->wi_links);
/* not mine anymore */
MyWorkerInfo = NULL;
@@ -2863,7 +2865,8 @@ AutoVacuumShmemInit(void)
/* initialize the WorkerInfo free list */
for (i = 0; i < autovacuum_max_workers; i++)
- dlist_push_head(&AutoVacuumShmem->av_freeWorkers, &worker[i].wi_links);
+ dlist_push_head(&AutoVacuumShmem->av_freeWorkers,
+ &worker[i].wi_links);
}
else
Assert(found);
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index c8a80f038c4..b223feefbab 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -2696,7 +2696,7 @@ CleanupBackend(int pid,
ShmemBackendArrayRemove(bp);
#endif
}
- dlist_delete(&BackendList, iter.cur);
+ dlist_delete(iter.cur);
free(bp);
break;
}
@@ -2744,7 +2744,7 @@ HandleChildCrash(int pid, int exitstatus, const char *procname)
ShmemBackendArrayRemove(bp);
#endif
}
- dlist_delete(&BackendList, iter.cur);
+ dlist_delete(iter.cur);
free(bp);
/* Keep looping so we can signal remaining backends */
}
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index 05ceff51cdf..a293f570e1b 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -370,7 +370,7 @@ CatCacheRemoveCTup(CatCache *cache, CatCTup *ct)
return; /* nothing left to do */
}
- dlist_delete(ct->cache_bucket, &ct->cache_elem);
+ dlist_delete(&ct->cache_elem);
/* free associated tuple data */
if (ct->tuple.t_data != NULL)
@@ -413,7 +413,7 @@ CatCacheRemoveCList(CatCache *cache, CatCList *cl)
}
/* delink from linked list */
- dlist_delete(&cache->cc_lists, &cl->cache_elem);
+ dlist_delete(&cl->cache_elem);
/* free associated tuple data */
if (cl->tuple.t_data != NULL)
@@ -1664,15 +1664,13 @@ CatalogCacheCreateEntry(CatCache *cache, HeapTuple ntp,
*/
ct->ct_magic = CT_MAGIC;
ct->my_cache = cache;
- ct->cache_bucket = &cache->cc_bucket[hashIndex];
-
ct->c_list = NULL;
ct->refcount = 0; /* for the moment */
ct->dead = false;
ct->negative = negative;
ct->hash_value = hashValue;
- dlist_push_head(ct->cache_bucket, &ct->cache_elem);
+ dlist_push_head(&cache->cc_bucket[hashIndex], &ct->cache_elem);
cache->cc_ntup++;
CacheHdr->ch_ntup++;
diff --git a/src/include/lib/ilist.h b/src/include/lib/ilist.h
index 22cd270659a..bc684b84af6 100644
--- a/src/include/lib/ilist.h
+++ b/src/include/lib/ilist.h
@@ -89,7 +89,7 @@
* continue; // don't touch this one
*
* // unlink the current table from the linked list
- * dlist_delete(&db->tables, miter.cur);
+ * dlist_delete(miter.cur);
* // as these lists never manage memory, we can still access the table
* // after it's been unlinked
* drop_table(db, tbl);
@@ -271,11 +271,9 @@ extern void dlist_init(dlist_head *head);
extern bool dlist_is_empty(dlist_head *head);
extern void dlist_push_head(dlist_head *head, dlist_node *node);
extern void dlist_push_tail(dlist_head *head, dlist_node *node);
-extern void dlist_insert_after(dlist_head *head,
- dlist_node *after, dlist_node *node);
-extern void dlist_insert_before(dlist_head *head,
- dlist_node *before, dlist_node *node);
-extern void dlist_delete(dlist_head *head, dlist_node *node);
+extern void dlist_insert_after(dlist_node *after, dlist_node *node);
+extern void dlist_insert_before(dlist_node *before, dlist_node *node);
+extern void dlist_delete(dlist_node *node);
extern dlist_node *dlist_pop_head_node(dlist_head *head);
extern void dlist_move_head(dlist_head *head, dlist_node *node);
extern bool dlist_has_next(dlist_head *head, dlist_node *node);
@@ -352,50 +350,34 @@ dlist_push_tail(dlist_head *head, dlist_node *node)
* Insert a node after another *in the same list*
*/
STATIC_IF_INLINE void
-dlist_insert_after(dlist_head *head, dlist_node *after, dlist_node *node)
+dlist_insert_after(dlist_node *after, dlist_node *node)
{
- dlist_check(head);
- /* XXX: assert 'after' is in 'head'? */
-
node->prev = after;
node->next = after->next;
after->next = node;
node->next->prev = node;
-
- dlist_check(head);
}
/*
* Insert a node before another *in the same list*
*/
STATIC_IF_INLINE void
-dlist_insert_before(dlist_head *head, dlist_node *before, dlist_node *node)
+dlist_insert_before(dlist_node *before, dlist_node *node)
{
- dlist_check(head);
- /* XXX: assert 'before' is in 'head'? */
-
node->prev = before->prev;
node->next = before;
before->prev = node;
node->prev->next = node;
-
- dlist_check(head);
}
/*
- * Delete 'node' from list.
- *
- * It is not allowed to delete a 'node' which is is not in the list 'head'
+ * Delete 'node' from its list (it must be in one).
*/
STATIC_IF_INLINE void
-dlist_delete(dlist_head *head, dlist_node *node)
+dlist_delete(dlist_node *node)
{
- dlist_check(head);
-
node->prev->next = node->next;
node->next->prev = node->prev;
-
- dlist_check(head);
}
/*
@@ -408,7 +390,7 @@ dlist_pop_head_node(dlist_head *head)
Assert(!dlist_is_empty(head));
node = head->head.next;
- dlist_delete(head, node);
+ dlist_delete(node);
return node;
}
@@ -425,7 +407,7 @@ dlist_move_head(dlist_head *head, dlist_node *node)
if (head->head.next == node)
return;
- dlist_delete(head, node);
+ dlist_delete(node);
dlist_push_head(head, node);
dlist_check(head);
@@ -591,8 +573,7 @@ dlist_tail_node(dlist_head *head)
extern void slist_init(slist_head *head);
extern bool slist_is_empty(slist_head *head);
extern void slist_push_head(slist_head *head, slist_node *node);
-extern void slist_insert_after(slist_head *head,
- slist_node *after, slist_node *node);
+extern void slist_insert_after(slist_node *after, slist_node *node);
extern slist_node *slist_pop_head_node(slist_head *head);
extern bool slist_has_next(slist_head *head, slist_node *node);
extern slist_node *slist_next_node(slist_head *head, slist_node *node);
@@ -640,12 +621,10 @@ slist_push_head(slist_head *head, slist_node *node)
* Insert a node after another *in the same list*
*/
STATIC_IF_INLINE void
-slist_insert_after(slist_head *head, slist_node *after, slist_node *node)
+slist_insert_after(slist_node *after, slist_node *node)
{
node->next = after->next;
after->next = node;
-
- slist_check(head);
}
/*
diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h
index cc6dab24649..36886843233 100644
--- a/src/include/utils/catcache.h
+++ b/src/include/utils/catcache.h
@@ -82,7 +82,6 @@ typedef struct catctup
* lookups.
*/
dlist_node cache_elem; /* list member of per-bucket list */
- dlist_head *cache_bucket; /* containing bucket dlist */
/*
* The tuple may also be a member of at most one CatCList. (If a single