Lines Matching defs:batch
625 struct gntdev_copy_batch *batch;
639 while (priv->batch) {
640 batch = priv->batch;
641 priv->batch = batch->next;
642 kfree(batch);
811 static int gntdev_get_page(struct gntdev_copy_batch *batch, void __user *virt,
819 ret = pin_user_pages_fast(addr, 1, batch->writeable ? FOLL_WRITE : 0, &page);
823 batch->pages[batch->nr_pages++] = page;
831 static void gntdev_put_pages(struct gntdev_copy_batch *batch)
833 unpin_user_pages_dirty_lock(batch->pages, batch->nr_pages, batch->writeable);
834 batch->nr_pages = 0;
835 batch->writeable = false;
838 static int gntdev_copy(struct gntdev_copy_batch *batch)
842 gnttab_batch_copy(batch->ops, batch->nr_ops);
843 gntdev_put_pages(batch);
849 for (i = 0; i < batch->nr_ops; i++) {
850 s16 status = batch->ops[i].status;
856 if (__get_user(old_status, batch->status[i]))
862 if (__put_user(status, batch->status[i]))
866 batch->nr_ops = 0;
870 static int gntdev_grant_copy_seg(struct gntdev_copy_batch *batch,
878 * batch->pages for one page per-op and this would be a very
904 if (batch->nr_ops >= GNTDEV_COPY_BATCH) {
905 ret = gntdev_copy(batch);
912 op = &batch->ops[batch->nr_ops];
924 batch->writeable = false;
926 ret = gntdev_get_page(batch, virt, &gfn);
944 batch->writeable = true;
946 ret = gntdev_get_page(batch, virt, &gfn);
958 batch->status[batch->nr_ops] = status;
959 batch->nr_ops++;
968 struct gntdev_copy_batch *batch;
976 if (!priv->batch) {
977 batch = kmalloc(sizeof(*batch), GFP_KERNEL);
979 batch = priv->batch;
980 priv->batch = batch->next;
983 if (!batch)
986 batch->nr_ops = 0;
987 batch->nr_pages = 0;
994 gntdev_put_pages(batch);
998 ret = gntdev_grant_copy_seg(batch, &seg, ©.segments[i].status);
1000 gntdev_put_pages(batch);
1006 if (batch->nr_ops)
1007 ret = gntdev_copy(batch);
1011 batch->next = priv->batch;
1012 priv->batch = batch;