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:
Alexander Motin
2023-06-09 13:12:52 -04:00
committed by GitHub
parent 55b1842f92
commit b3ad3f48d9
20 changed files with 34 additions and 76 deletions
+2 -5
View File
@@ -1203,8 +1203,7 @@ zvol_create_minors_recursive(const char *name)
* Prefetch is completed, we can do zvol_os_create_minor
* sequentially.
*/
while ((job = list_head(&minors_list)) != NULL) {
list_remove(&minors_list, job);
while ((job = list_remove_head(&minors_list)) != NULL) {
if (!job->error)
(void) zvol_os_create_minor(job->name);
kmem_strfree(job->name);
@@ -1311,10 +1310,8 @@ zvol_remove_minors_impl(const char *name)
rw_exit(&zvol_state_lock);
/* Drop zvol_state_lock before calling zvol_free() */
while ((zv = list_head(&free_list)) != NULL) {
list_remove(&free_list, zv);
while ((zv = list_remove_head(&free_list)) != NULL)
zvol_os_free(zv);
}
}
/* Remove minor for this specific volume only */