[Devel] [PATCH vz9 v1 05/63] dm-ploop: convert wait_list and wb_batch_llist to use lockless lists
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Mon Feb 10 06:17:49 MSK 2025
On 1/24/25 23:35, Alexander Atanasov wrote:
> @@ -801,11 +799,21 @@ static void ploop_advance_local_after_bat_wb(struct ploop *ploop,
>
> WARN_ON_ONCE(!test_bit(MD_WRITEBACK, &md->status));
> clear_bit(MD_WRITEBACK, &md->status);
> + /* protect piwb */
> + write_lock_irqsave(&ploop->bat_rwlock, flags);
> md->piwb = NULL;
> - list_splice_tail_init(&md->wait_list, &list);
> write_unlock_irqrestore(&ploop->bat_rwlock, flags);
> kunmap_local(dst_clu);
>
> + wait_llist_pending = llist_del_all(&md->wait_llist);
> + if (wait_llist_pending) {
> + wait_llist_pending = llist_reverse_order(wait_llist_pending);
> + llist_for_each_safe(pos, t, wait_llist_pending) {
> + pio = list_entry((struct list_head *)pos, typeof(*pio), list);
Please use llist_for_each_entry_safe.
> + list_add(&pio->list, &list);
> + }
> + }
> +
> if (!list_empty(&list))
> ploop_dispatch_pios(ploop, NULL, &list);
> }
Same thing in other 20 places:
turmoil at fedora:~/devel/kernel-vz/kernel-vz9-second$ git log
rh9-5.14.0-427.44.1.vz9.80.11..rh9-5.14.0-427.44.1.vz9.80.12 -p | grep
llist_for_each | grep -v entry | grep '^+'
+ llist_for_each_safe(pos, t, ll_ready_pios) {
+ llist_for_each_safe(pos, t, ) {
+ llist_for_each_safe(pos, t, list) {
+ llist_for_each_safe(pos, t, llwork) {
+ llist_for_each_safe(pos, t, ll_wb_batch) {
+ llist_for_each_safe(pos, t, ploop->wb_batch_llist.first) {
+ llist_for_each_safe(pos, t, deferred_pios.first) {
+ llist_for_each_safe(pos, t, llist.first) {
+ llist_for_each_safe(pos, t, pios->first) {
+ llist_for_each_safe(pos, t, deferred_pios.first) {
+ llist_for_each_safe(pos, t, list) {
+ llist_for_each_safe(pos, t, lldeferred_pios) {
+ llist_for_each_safe(pos, t, cow_llist) {
+ llist_for_each_safe(pos, t, pios) {
+ llist_for_each_safe(pos, t, discpios) {
+ llist_for_each_safe(pos, t, llpios) {
+ llist_for_each_safe(pos, t, llflush_pios) {
+ llist_for_each_safe(pos, t, llist_reverse_order(lldeferred_pios)) {
+ llist_for_each_safe(pos, t, suspended_pending) {
+ llist_for_each_safe(pos, t, enospc_pending) {
+ llist_for_each_safe(pos, t, wait_llist_pending) {
turmoil at fedora:~/devel/kernel-vz/kernel-vz9-second$ git log
rh9-5.14.0-427.44.1.vz9.80.11..rh9-5.14.0-427.44.1.vz9.80.12 -p | grep
llist_for_each | grep -v entry | grep '^+' | wc -l
21
There is no point in iterating over llist and convert llist_node to
entry manually.
--
Best regards, Tikhomirov Pavel
Senior Software Developer, Virtuozzo.
More information about the Devel
mailing list