Lines Matching refs:batch

799 static int gntdev_get_page(struct gntdev_copy_batch *batch, void __user *virt,  in gntdev_get_page()  argument
807 ret = pin_user_pages_fast(addr, 1, batch->writeable ? FOLL_WRITE : 0, &page); in gntdev_get_page()
811 batch->pages[batch->nr_pages++] = page; in gntdev_get_page()
819 static void gntdev_put_pages(struct gntdev_copy_batch *batch) in gntdev_put_pages() argument
821 unpin_user_pages_dirty_lock(batch->pages, batch->nr_pages, batch->writeable); in gntdev_put_pages()
822 batch->nr_pages = 0; in gntdev_put_pages()
823 batch->writeable = false; in gntdev_put_pages()
826 static int gntdev_copy(struct gntdev_copy_batch *batch) in gntdev_copy() argument
830 gnttab_batch_copy(batch->ops, batch->nr_ops); in gntdev_copy()
831 gntdev_put_pages(batch); in gntdev_copy()
837 for (i = 0; i < batch->nr_ops; i++) { in gntdev_copy()
838 s16 status = batch->ops[i].status; in gntdev_copy()
844 if (__get_user(old_status, batch->status[i])) in gntdev_copy()
850 if (__put_user(status, batch->status[i])) in gntdev_copy()
854 batch->nr_ops = 0; in gntdev_copy()
858 static int gntdev_grant_copy_seg(struct gntdev_copy_batch *batch, in gntdev_grant_copy_seg() argument
892 if (batch->nr_ops >= GNTDEV_COPY_BATCH) { in gntdev_grant_copy_seg()
893 ret = gntdev_copy(batch); in gntdev_grant_copy_seg()
900 op = &batch->ops[batch->nr_ops]; in gntdev_grant_copy_seg()
912 batch->writeable = false; in gntdev_grant_copy_seg()
914 ret = gntdev_get_page(batch, virt, &gfn); in gntdev_grant_copy_seg()
932 batch->writeable = true; in gntdev_grant_copy_seg()
934 ret = gntdev_get_page(batch, virt, &gfn); in gntdev_grant_copy_seg()
946 batch->status[batch->nr_ops] = status; in gntdev_grant_copy_seg()
947 batch->nr_ops++; in gntdev_grant_copy_seg()
956 struct gntdev_copy_batch batch; in gntdev_ioctl_grant_copy() local
963 batch.nr_ops = 0; in gntdev_ioctl_grant_copy()
964 batch.nr_pages = 0; in gntdev_ioctl_grant_copy()
974 ret = gntdev_grant_copy_seg(&batch, &seg, &copy.segments[i].status); in gntdev_ioctl_grant_copy()
980 if (batch.nr_ops) in gntdev_ioctl_grant_copy()
981 ret = gntdev_copy(&batch); in gntdev_ioctl_grant_copy()
985 gntdev_put_pages(&batch); in gntdev_ioctl_grant_copy()