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