--- initial
+++ final
@@ -1,90 +1,90 @@
 int ubifs_find_dirty_leb(struct ubifs_info *c, struct ubifs_lprops *ret_lp, int min_space, int pick_free) {
   int err = 0, sum, exclude_index = pick_free == 2 ? 1 : 0;
   const struct ubifs_lprops *lp = NULL, *idx_lp = NULL;
   struct ubifs_lpt_heap *heap, *idx_heap;
   ubifs_get_lprops(c);
   if (pick_free) {
     int lebs, rsvd_idx_lebs = 0;
     spin_lock(&c->space_lock);
     lebs = c->lst.empty_lebs + c->idx_gc_cnt;
     lebs += c->freeable_cnt - c->lst.taken_empty_lebs;
     /*
      * Note, the index may consume more LEBs than have been reserved
      * for it. It is OK because it might be consolidated by GC.
      * But if the index takes fewer LEBs than it is reserved for it,
      * this function must avoid picking those reserved LEBs.
      */
     if (c->bi.min_idx_lebs >= c->lst.idx_lebs) {
       rsvd_idx_lebs = c->bi.min_idx_lebs - c->lst.idx_lebs;
       exclude_index = 1;
     }
     spin_unlock(&c->space_lock);
     /* Check if there are enough free LEBs for the index */
     if (rsvd_idx_lebs < lebs) {
       /* OK, try to find an empty LEB */
       lp = ubifs_fast_find_empty(c);
       if (lp) goto found;
       /* Or a freeable LEB */
       lp = ubifs_fast_find_freeable(c);
       if (lp) goto found;
     } else
       /*
        * We cannot pick free/freeable LEBs in the below code.
        */
       pick_free = 0;
   } else {
     spin_lock(&c->space_lock);
     exclude_index = (c->bi.min_idx_lebs >= c->lst.idx_lebs);
     spin_unlock(&c->space_lock);
   }
   /* Look on the dirty and dirty index heaps */
   heap = &c->lpt_heap[LPROPS_DIRTY - 1];
   idx_heap = &c->lpt_heap[LPROPS_DIRTY_IDX - 1];
   if (idx_heap->cnt && !exclude_index) {
     idx_lp = idx_heap->arr[0];
     sum = idx_lp->free + idx_lp->dirty;
     /*
      * Since we reserve thrice as much space for the index than it
      * actually takes, it does not make sense to pick indexing LEBs
      * with less than, say, half LEB of dirty space. May be half is
      * not the optimal boundary - this should be tested and
      * checked. This boundary should determine how much we use
      * in-the-gaps to consolidate the index comparing to how much
      * we use garbage collector to consolidate it. The "half"
      * criteria just feels to be fine.
      */
     if (sum < min_space || sum < c->half_leb_size) idx_lp = NULL;
   }
   if (heap->cnt) {
     lp = heap->arr[0];
     if (lp->dirty + lp->free < min_space) lp = NULL;
   }
   /* Pick the LEB with most space */
   if (idx_lp && lp) {
     if (idx_lp->free + idx_lp->dirty >= lp->free + lp->dirty) lp = idx_lp;
   } else if (idx_lp && !lp)
     lp = idx_lp;
   if (lp) {
-    ubifs_assert(lp->free + lp->dirty >= c->dead_wm);
+    ubifs_assert(c, lp->free + lp->dirty >= c->dead_wm);
     goto found;
   }
   /* Did not find a dirty LEB on the dirty heaps, have to scan */
   dbg_find("scanning LPT for a dirty LEB");
   lp = scan_for_dirty(c, min_space, pick_free, exclude_index);
   if (IS_ERR(lp)) {
     err = PTR_ERR(lp);
     goto out;
   }
-  ubifs_assert(lp->dirty >= c->dead_wm || (pick_free && lp->free + lp->dirty == c->leb_size));
+  ubifs_assert(c, lp->dirty >= c->dead_wm || (pick_free && lp->free + lp->dirty == c->leb_size));
 found:
   dbg_find("found LEB %d, free %d, dirty %d, flags %#x", lp->lnum, lp->free, lp->dirty, lp->flags);
   lp = ubifs_change_lp(c, lp, LPROPS_NC, LPROPS_NC, lp->flags | LPROPS_TAKEN, 0);
   if (IS_ERR(lp)) {
     err = PTR_ERR(lp);
     goto out;
   }
   memcpy(ret_lp, lp, sizeof(struct ubifs_lprops));
 out:
   ubifs_release_lprops(c);
   return err;
 }<sep>@@
identifier f,c;
expression e;
@@

f(...,struct ubifs_info *c,...) {
<...
 ubifs_assert(
+             c,
              e)
...>
}