Lines Matching refs:batch

623 	struct gntdev_copy_batch *batch;  in gntdev_release()  local
637 while (priv->batch) { in gntdev_release()
638 batch = priv->batch; in gntdev_release()
639 priv->batch = batch->next; in gntdev_release()
640 kfree(batch); in gntdev_release()
809 static int gntdev_get_page(struct gntdev_copy_batch *batch, void __user *virt, in gntdev_get_page() argument
817 ret = pin_user_pages_fast(addr, 1, batch->writeable ? FOLL_WRITE : 0, &page); in gntdev_get_page()
821 batch->pages[batch->nr_pages++] = page; in gntdev_get_page()
829 static void gntdev_put_pages(struct gntdev_copy_batch *batch) in gntdev_put_pages() argument
831 unpin_user_pages_dirty_lock(batch->pages, batch->nr_pages, batch->writeable); in gntdev_put_pages()
832 batch->nr_pages = 0; in gntdev_put_pages()
833 batch->writeable = false; in gntdev_put_pages()
836 static int gntdev_copy(struct gntdev_copy_batch *batch) in gntdev_copy() argument
840 gnttab_batch_copy(batch->ops, batch->nr_ops); in gntdev_copy()
841 gntdev_put_pages(batch); in gntdev_copy()
847 for (i = 0; i < batch->nr_ops; i++) { in gntdev_copy()
848 s16 status = batch->ops[i].status; in gntdev_copy()
854 if (__get_user(old_status, batch->status[i])) in gntdev_copy()
860 if (__put_user(status, batch->status[i])) in gntdev_copy()
864 batch->nr_ops = 0; in gntdev_copy()
868 static int gntdev_grant_copy_seg(struct gntdev_copy_batch *batch, in gntdev_grant_copy_seg() argument
902 if (batch->nr_ops >= GNTDEV_COPY_BATCH) { in gntdev_grant_copy_seg()
903 ret = gntdev_copy(batch); in gntdev_grant_copy_seg()
910 op = &batch->ops[batch->nr_ops]; in gntdev_grant_copy_seg()
922 batch->writeable = false; in gntdev_grant_copy_seg()
924 ret = gntdev_get_page(batch, virt, &gfn); in gntdev_grant_copy_seg()
942 batch->writeable = true; in gntdev_grant_copy_seg()
944 ret = gntdev_get_page(batch, virt, &gfn); in gntdev_grant_copy_seg()
956 batch->status[batch->nr_ops] = status; in gntdev_grant_copy_seg()
957 batch->nr_ops++; in gntdev_grant_copy_seg()
966 struct gntdev_copy_batch *batch; in gntdev_ioctl_grant_copy() local
974 if (!priv->batch) { in gntdev_ioctl_grant_copy()
975 batch = kmalloc(sizeof(*batch), GFP_KERNEL); in gntdev_ioctl_grant_copy()
977 batch = priv->batch; in gntdev_ioctl_grant_copy()
978 priv->batch = batch->next; in gntdev_ioctl_grant_copy()
981 if (!batch) in gntdev_ioctl_grant_copy()
984 batch->nr_ops = 0; in gntdev_ioctl_grant_copy()
985 batch->nr_pages = 0; in gntdev_ioctl_grant_copy()
992 gntdev_put_pages(batch); in gntdev_ioctl_grant_copy()
996 ret = gntdev_grant_copy_seg(batch, &seg, &copy.segments[i].status); in gntdev_ioctl_grant_copy()
998 gntdev_put_pages(batch); in gntdev_ioctl_grant_copy()
1004 if (batch->nr_ops) in gntdev_ioctl_grant_copy()
1005 ret = gntdev_copy(batch); in gntdev_ioctl_grant_copy()
1009 batch->next = priv->batch; in gntdev_ioctl_grant_copy()
1010 priv->batch = batch; in gntdev_ioctl_grant_copy()