Lines Matching refs:batch

734 static int gntdev_get_page(struct gntdev_copy_batch *batch, void __user *virt,  in gntdev_get_page()  argument
742 ret = pin_user_pages_fast(addr, 1, batch->writeable ? FOLL_WRITE : 0, &page); in gntdev_get_page()
746 batch->pages[batch->nr_pages++] = page; in gntdev_get_page()
754 static void gntdev_put_pages(struct gntdev_copy_batch *batch) in gntdev_put_pages() argument
756 unpin_user_pages_dirty_lock(batch->pages, batch->nr_pages, batch->writeable); in gntdev_put_pages()
757 batch->nr_pages = 0; in gntdev_put_pages()
758 batch->writeable = false; in gntdev_put_pages()
761 static int gntdev_copy(struct gntdev_copy_batch *batch) in gntdev_copy() argument
765 gnttab_batch_copy(batch->ops, batch->nr_ops); in gntdev_copy()
766 gntdev_put_pages(batch); in gntdev_copy()
772 for (i = 0; i < batch->nr_ops; i++) { in gntdev_copy()
773 s16 status = batch->ops[i].status; in gntdev_copy()
779 if (__get_user(old_status, batch->status[i])) in gntdev_copy()
785 if (__put_user(status, batch->status[i])) in gntdev_copy()
789 batch->nr_ops = 0; in gntdev_copy()
793 static int gntdev_grant_copy_seg(struct gntdev_copy_batch *batch, in gntdev_grant_copy_seg() argument
827 if (batch->nr_ops >= GNTDEV_COPY_BATCH) { in gntdev_grant_copy_seg()
828 ret = gntdev_copy(batch); in gntdev_grant_copy_seg()
835 op = &batch->ops[batch->nr_ops]; in gntdev_grant_copy_seg()
847 batch->writeable = false; in gntdev_grant_copy_seg()
849 ret = gntdev_get_page(batch, virt, &gfn); in gntdev_grant_copy_seg()
867 batch->writeable = true; in gntdev_grant_copy_seg()
869 ret = gntdev_get_page(batch, virt, &gfn); in gntdev_grant_copy_seg()
881 batch->status[batch->nr_ops] = status; in gntdev_grant_copy_seg()
882 batch->nr_ops++; in gntdev_grant_copy_seg()
891 struct gntdev_copy_batch batch; in gntdev_ioctl_grant_copy() local
898 batch.nr_ops = 0; in gntdev_ioctl_grant_copy()
899 batch.nr_pages = 0; in gntdev_ioctl_grant_copy()
909 ret = gntdev_grant_copy_seg(&batch, &seg, &copy.segments[i].status); in gntdev_ioctl_grant_copy()
915 if (batch.nr_ops) in gntdev_ioctl_grant_copy()
916 ret = gntdev_copy(&batch); in gntdev_ioctl_grant_copy()
920 gntdev_put_pages(&batch); in gntdev_ioctl_grant_copy()