mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 02:44:41 +03:00
Use list_remove_head() where possible.
... instead of list_head() + list_remove(). On FreeBSD the list functions are not inlined, so in addition to more compact code this also saves another function call. Reviewed-by: Brian Atkinson <batkinson@lanl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #14955
This commit is contained in:
@@ -369,9 +369,7 @@ zfs_agent_consumer_thread(void *arg)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if ((event = (list_head(&agent_events))) != NULL) {
|
||||
list_remove(&agent_events, event);
|
||||
|
||||
if ((event = list_remove_head(&agent_events)) != NULL) {
|
||||
(void) pthread_mutex_unlock(&agent_lock);
|
||||
|
||||
/* dispatch to all event subscribers */
|
||||
@@ -434,8 +432,7 @@ zfs_agent_fini(void)
|
||||
(void) pthread_join(g_agents_tid, NULL);
|
||||
|
||||
/* drain any pending events */
|
||||
while ((event = (list_head(&agent_events))) != NULL) {
|
||||
list_remove(&agent_events, event);
|
||||
while ((event = list_remove_head(&agent_events)) != NULL) {
|
||||
nvlist_free(event->ae_nvl);
|
||||
free(event);
|
||||
}
|
||||
|
||||
@@ -1288,17 +1288,14 @@ zfs_slm_fini(void)
|
||||
tpool_destroy(g_tpool);
|
||||
}
|
||||
|
||||
while ((pool = (list_head(&g_pool_list))) != NULL) {
|
||||
list_remove(&g_pool_list, pool);
|
||||
while ((pool = list_remove_head(&g_pool_list)) != NULL) {
|
||||
zpool_close(pool->uap_zhp);
|
||||
free(pool);
|
||||
}
|
||||
list_destroy(&g_pool_list);
|
||||
|
||||
while ((device = (list_head(&g_device_list))) != NULL) {
|
||||
list_remove(&g_device_list, device);
|
||||
while ((device = list_remove_head(&g_device_list)) != NULL)
|
||||
free(device);
|
||||
}
|
||||
list_destroy(&g_device_list);
|
||||
|
||||
libzfs_fini(g_zfshdl);
|
||||
|
||||
Reference in New Issue
Block a user