Lines Matching defs:batch
617 struct gntdev_copy_batch *batch;
631 while (priv->batch) {
632 batch = priv->batch;
633 priv->batch = batch->next;
634 kfree(batch);
807 static int gntdev_get_page(struct gntdev_copy_batch *batch, void __user *virt,
815 ret = pin_user_pages_fast(addr, 1, batch->writeable ? FOLL_WRITE : 0, &page);
819 batch->pages[batch->nr_pages++] = page;
827 static void gntdev_put_pages(struct gntdev_copy_batch *batch)
829 unpin_user_pages_dirty_lock(batch->pages, batch->nr_pages, batch->writeable);
830 batch->nr_pages = 0;
831 batch->writeable = false;
834 static int gntdev_copy(struct gntdev_copy_batch *batch)
838 gnttab_batch_copy(batch->ops, batch->nr_ops);
839 gntdev_put_pages(batch);
845 for (i = 0; i < batch->nr_ops; i++) {
846 s16 status = batch->ops[i].status;
852 if (get_user(old_status, batch->status[i]))
858 if (put_user(status, batch->status[i]))
862 batch->nr_ops = 0;
866 static int gntdev_grant_copy_seg(struct gntdev_copy_batch *batch,
874 * batch->pages for one page per-op and this would be a very
900 if (batch->nr_ops >= GNTDEV_COPY_BATCH) {
901 ret = gntdev_copy(batch);
908 op = &batch->ops[batch->nr_ops];
920 batch->writeable = false;
922 ret = gntdev_get_page(batch, virt, &gfn);
940 batch->writeable = true;
942 ret = gntdev_get_page(batch, virt, &gfn);
954 batch->status[batch->nr_ops] = status;
955 batch->nr_ops++;
964 struct gntdev_copy_batch *batch;
972 if (!priv->batch) {
973 batch = kmalloc_obj(*batch);
975 batch = priv->batch;
976 priv->batch = batch->next;
979 if (!batch)
982 batch->nr_ops = 0;
983 batch->nr_pages = 0;
990 gntdev_put_pages(batch);
994 ret = gntdev_grant_copy_seg(batch, &seg, ©.segments[i].status);
996 gntdev_put_pages(batch);
1002 if (batch->nr_ops)
1003 ret = gntdev_copy(batch);
1007 batch->next = priv->batch;
1008 priv->batch = batch;