skiselkov commented on this pull request.
> +
+ /*
+ * Another pool management task might be currently prevented from
+ * starting and the current txg sync was invoked on its behalf,
+ * so be prepared to postpone autotrim processing.
+ */
+ if (!mutex_tryenter(&spa->spa_auto_trim_lock))
+ return;
+ spa->spa_num_auto_trimming += spa->spa_root_vdev->vdev_children;
+ mutex_exit(&spa->spa_auto_trim_lock);
+
+ for (uint64_t i = 0; i < spa->spa_root_vdev->vdev_children; i++) {
+ vdev_trim_info_t *vti = kmem_zalloc(sizeof (*vti), KM_SLEEP);
+ vti->vti_vdev = spa->spa_root_vdev->vdev_child[i];
+ vti->vti_txg = txg;
+ vti->vti_done_cb = (void (*)(void *))spa_vdev_auto_trim_done;
I don't like tying a generic callback mechanism to its one consumer. If at some
point in the future we try to extend this, it'll be a bunch of extra work to
change it again. I'd like to keep it generic - the one extra cast doesn't cost
us anything. It also neatly avoids having to cast the arguments at the start of
the function (as is done in e.g. the metaslab range tree callbacks).
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/172#discussion_r116135045
------------------------------------------
openzfs-developer
Archives: https://openzfs.topicbox-beta.com/groups/developer/
Powered by Topicbox: https://topicbox-beta.com