@@ -915,28 +918,31 @@ static void ploop_free_piwb(struct ploop_index_wb *piwb)
        kfree(piwb);
  }
+
+static void ploop_bat_write_finish(struct pio *pio, void *piwb_ptr,
+                                    blk_status_t bi_status);
  static void ploop_put_piwb(struct ploop_index_wb *piwb)
  {
        if (atomic_dec_and_test(&piwb->count)) {
-               struct ploop *ploop = piwb->ploop;
-               /*
-                * Index wb failed. Mark clusters as unallocated again.
-                * piwb->count is zero, so all data writers compeleted.
-                */
-               if (piwb->bi_status)
-                       ploop_advance_local_after_bat_wb(ploop, piwb, false);
+
+               ploop_bat_write_finish(piwb->pio, piwb, piwb->bi_status);
if (piwb->comp) {
                        if (piwb->comp_bi_status)
                                *piwb->comp_bi_status = piwb->bi_status;
                        complete(piwb->comp);
                }
+               /*
+                * Status is set from first call to ploop_bat_write_complete
+                * zero keeps it as is
+                */

It looks like this comment belongs to ploop_bat_write_complete.

+
                ploop_free_piwb(piwb);
        }
  }
/* This handler is called after BAT is updated. */
-static void ploop_bat_write_complete(struct pio *pio, void *piwb_ptr,
+static void ploop_bat_write_finish(struct pio *pio, void *piwb_ptr,
                                     blk_status_t bi_status)
  {
        struct ploop_index_wb *piwb = piwb_ptr;
...
@@ -1000,11 +1006,17 @@ static void ploop_bat_write_complete(struct pio *pio, 
void *piwb_ptr,
                        ploop_dispatch_pios(ploop, flush_pio, NULL);
                piwb->flush_pio = NULL;
        }
+}
+
+static void ploop_bat_write_complete(struct pio *pio, void *piwb_ptr,
+                                    blk_status_t bi_status)
+
+{
+       struct ploop_index_wb *piwb = piwb_ptr;
+

For instance here, where we have piwb status update when have pio error.

+       if (bi_status)
+               piwb->bi_status = bi_status;
- /*
-        * In case of update BAT is failed, dst_clusters will be
-        * set back to holes_bitmap on last put_piwb().
-        */
        ploop_put_piwb(piwb);
  }
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to