Decrease sp->unsync_children after clear unsync_child_bitmap bit
Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
                                        return -ENOSPC;
 
                                ret = __mmu_unsync_walk(child, pvec);
-                               if (!ret)
+                               if (!ret) {
                                        __clear_bit(i, sp->unsync_child_bitmap);
-                               else if (ret > 0)
+                                       sp->unsync_children--;
+                                       WARN_ON((int)sp->unsync_children < 0);
+                               } else if (ret > 0)
                                        nr_unsync_leaf += ret;
                                else
                                        return ret;
                }
        }
 
-       if (find_first_bit(sp->unsync_child_bitmap, 512) == 512)
-               sp->unsync_children = 0;
 
        return nr_unsync_leaf;
 }