Lines Matching refs:batch
789 static int gntdev_get_page(struct gntdev_copy_batch *batch, void __user *virt, in gntdev_get_page() argument
797 ret = pin_user_pages_fast(addr, 1, batch->writeable ? FOLL_WRITE : 0, &page); in gntdev_get_page()
801 batch->pages[batch->nr_pages++] = page; in gntdev_get_page()
809 static void gntdev_put_pages(struct gntdev_copy_batch *batch) in gntdev_put_pages() argument
811 unpin_user_pages_dirty_lock(batch->pages, batch->nr_pages, batch->writeable); in gntdev_put_pages()
812 batch->nr_pages = 0; in gntdev_put_pages()
813 batch->writeable = false; in gntdev_put_pages()
816 static int gntdev_copy(struct gntdev_copy_batch *batch) in gntdev_copy() argument
820 gnttab_batch_copy(batch->ops, batch->nr_ops); in gntdev_copy()
821 gntdev_put_pages(batch); in gntdev_copy()
827 for (i = 0; i < batch->nr_ops; i++) { in gntdev_copy()
828 s16 status = batch->ops[i].status; in gntdev_copy()
834 if (__get_user(old_status, batch->status[i])) in gntdev_copy()
840 if (__put_user(status, batch->status[i])) in gntdev_copy()
844 batch->nr_ops = 0; in gntdev_copy()
848 static int gntdev_grant_copy_seg(struct gntdev_copy_batch *batch, in gntdev_grant_copy_seg() argument
882 if (batch->nr_ops >= GNTDEV_COPY_BATCH) { in gntdev_grant_copy_seg()
883 ret = gntdev_copy(batch); in gntdev_grant_copy_seg()
890 op = &batch->ops[batch->nr_ops]; in gntdev_grant_copy_seg()
902 batch->writeable = false; in gntdev_grant_copy_seg()
904 ret = gntdev_get_page(batch, virt, &gfn); in gntdev_grant_copy_seg()
922 batch->writeable = true; in gntdev_grant_copy_seg()
924 ret = gntdev_get_page(batch, virt, &gfn); in gntdev_grant_copy_seg()
936 batch->status[batch->nr_ops] = status; in gntdev_grant_copy_seg()
937 batch->nr_ops++; in gntdev_grant_copy_seg()
946 struct gntdev_copy_batch batch; in gntdev_ioctl_grant_copy() local
953 batch.nr_ops = 0; in gntdev_ioctl_grant_copy()
954 batch.nr_pages = 0; in gntdev_ioctl_grant_copy()
964 ret = gntdev_grant_copy_seg(&batch, &seg, ©.segments[i].status); in gntdev_ioctl_grant_copy()
970 if (batch.nr_ops) in gntdev_ioctl_grant_copy()
971 ret = gntdev_copy(&batch); in gntdev_ioctl_grant_copy()
975 gntdev_put_pages(&batch); in gntdev_ioctl_grant_copy()