Lines Matching refs:rdata
2811 struct cifs_readdata *rdata; in cifs_readdata_alloc() local
2813 rdata = kzalloc(sizeof(*rdata) + (sizeof(struct page *) * nr_pages), in cifs_readdata_alloc()
2815 if (rdata != NULL) { in cifs_readdata_alloc()
2816 kref_init(&rdata->refcount); in cifs_readdata_alloc()
2817 INIT_LIST_HEAD(&rdata->list); in cifs_readdata_alloc()
2818 init_completion(&rdata->done); in cifs_readdata_alloc()
2819 INIT_WORK(&rdata->work, complete); in cifs_readdata_alloc()
2822 return rdata; in cifs_readdata_alloc()
2828 struct cifs_readdata *rdata = container_of(refcount, in cifs_readdata_release() local
2831 if (rdata->cfile) in cifs_readdata_release()
2832 cifsFileInfo_put(rdata->cfile); in cifs_readdata_release()
2834 kfree(rdata); in cifs_readdata_release()
2838 cifs_read_allocate_pages(struct cifs_readdata *rdata, unsigned int nr_pages) in cifs_read_allocate_pages() argument
2850 rdata->pages[i] = page; in cifs_read_allocate_pages()
2855 put_page(rdata->pages[i]); in cifs_read_allocate_pages()
2856 rdata->pages[i] = NULL; in cifs_read_allocate_pages()
2865 struct cifs_readdata *rdata = container_of(refcount, in cifs_uncached_readdata_release() local
2869 for (i = 0; i < rdata->nr_pages; i++) { in cifs_uncached_readdata_release()
2870 put_page(rdata->pages[i]); in cifs_uncached_readdata_release()
2871 rdata->pages[i] = NULL; in cifs_uncached_readdata_release()
2886 cifs_readdata_to_iov(struct cifs_readdata *rdata, struct iov_iter *iter) in cifs_readdata_to_iov() argument
2888 size_t remaining = rdata->got_bytes; in cifs_readdata_to_iov()
2891 for (i = 0; i < rdata->nr_pages; i++) { in cifs_readdata_to_iov()
2892 struct page *page = rdata->pages[i]; in cifs_readdata_to_iov()
2913 struct cifs_readdata *rdata = container_of(work, in cifs_uncached_readv_complete() local
2916 complete(&rdata->done); in cifs_uncached_readv_complete()
2917 kref_put(&rdata->refcount, cifs_uncached_readdata_release); in cifs_uncached_readv_complete()
2922 struct cifs_readdata *rdata, unsigned int len) in cifs_uncached_read_into_pages() argument
2926 unsigned int nr_pages = rdata->nr_pages; in cifs_uncached_read_into_pages()
2928 rdata->got_bytes = 0; in cifs_uncached_read_into_pages()
2929 rdata->tailsz = PAGE_SIZE; in cifs_uncached_read_into_pages()
2931 struct page *page = rdata->pages[i]; in cifs_uncached_read_into_pages()
2936 rdata->pages[i] = NULL; in cifs_uncached_read_into_pages()
2937 rdata->nr_pages--; in cifs_uncached_read_into_pages()
2948 rdata->tailsz = len; in cifs_uncached_read_into_pages()
2955 rdata->got_bytes += result; in cifs_uncached_read_into_pages()
2958 return rdata->got_bytes > 0 && result != -ECONNABORTED ? in cifs_uncached_read_into_pages()
2959 rdata->got_bytes : result; in cifs_uncached_read_into_pages()
2966 struct cifs_readdata *rdata; in cifs_send_async_read() local
2990 rdata = cifs_readdata_alloc(npages, in cifs_send_async_read()
2992 if (!rdata) { in cifs_send_async_read()
2998 rc = cifs_read_allocate_pages(rdata, npages); in cifs_send_async_read()
3002 rdata->cfile = cifsFileInfo_get(open_file); in cifs_send_async_read()
3003 rdata->nr_pages = npages; in cifs_send_async_read()
3004 rdata->offset = offset; in cifs_send_async_read()
3005 rdata->bytes = cur_len; in cifs_send_async_read()
3006 rdata->pid = pid; in cifs_send_async_read()
3007 rdata->pagesz = PAGE_SIZE; in cifs_send_async_read()
3008 rdata->read_into_pages = cifs_uncached_read_into_pages; in cifs_send_async_read()
3009 rdata->credits = credits; in cifs_send_async_read()
3011 if (!rdata->cfile->invalidHandle || in cifs_send_async_read()
3012 !(rc = cifs_reopen_file(rdata->cfile, true))) in cifs_send_async_read()
3013 rc = server->ops->async_readv(rdata); in cifs_send_async_read()
3016 add_credits_and_wake_if(server, rdata->credits, 0); in cifs_send_async_read()
3017 kref_put(&rdata->refcount, in cifs_send_async_read()
3024 list_add_tail(&rdata->list, rdata_list); in cifs_send_async_read()
3042 struct cifs_readdata *rdata, *tmp; in cifs_user_readv() local
3069 list_for_each_entry_safe(rdata, tmp, &rdata_list, list) { in cifs_user_readv()
3072 rc = wait_for_completion_killable(&rdata->done); in cifs_user_readv()
3075 else if (rdata->result == -EAGAIN) { in cifs_user_readv()
3078 unsigned int got_bytes = rdata->got_bytes; in cifs_user_readv()
3080 list_del_init(&rdata->list); in cifs_user_readv()
3088 if (got_bytes && got_bytes < rdata->bytes) { in cifs_user_readv()
3089 rc = cifs_readdata_to_iov(rdata, to); in cifs_user_readv()
3091 kref_put(&rdata->refcount, in cifs_user_readv()
3098 rdata->offset + got_bytes, in cifs_user_readv()
3099 rdata->bytes - got_bytes, in cifs_user_readv()
3100 rdata->cfile, cifs_sb, in cifs_user_readv()
3105 kref_put(&rdata->refcount, in cifs_user_readv()
3108 } else if (rdata->result) in cifs_user_readv()
3109 rc = rdata->result; in cifs_user_readv()
3111 rc = cifs_readdata_to_iov(rdata, to); in cifs_user_readv()
3114 if (rdata->got_bytes && rdata->got_bytes < rdata->bytes) in cifs_user_readv()
3117 list_del_init(&rdata->list); in cifs_user_readv()
3118 kref_put(&rdata->refcount, cifs_uncached_readdata_release); in cifs_user_readv()
3327 struct cifs_readdata *rdata = container_of(work, in cifs_readv_complete() local
3330 got_bytes = rdata->got_bytes; in cifs_readv_complete()
3331 for (i = 0; i < rdata->nr_pages; i++) { in cifs_readv_complete()
3332 struct page *page = rdata->pages[i]; in cifs_readv_complete()
3336 if (rdata->result == 0 || in cifs_readv_complete()
3337 (rdata->result == -EAGAIN && got_bytes)) { in cifs_readv_complete()
3344 if (rdata->result == 0 || in cifs_readv_complete()
3345 (rdata->result == -EAGAIN && got_bytes)) in cifs_readv_complete()
3346 cifs_readpage_to_fscache(rdata->mapping->host, page); in cifs_readv_complete()
3351 rdata->pages[i] = NULL; in cifs_readv_complete()
3353 kref_put(&rdata->refcount, cifs_readdata_release); in cifs_readv_complete()
3358 struct cifs_readdata *rdata, unsigned int len) in cifs_readpages_read_into_pages() argument
3364 unsigned int nr_pages = rdata->nr_pages; in cifs_readpages_read_into_pages()
3367 eof = CIFS_I(rdata->mapping->host)->server_eof; in cifs_readpages_read_into_pages()
3371 rdata->got_bytes = 0; in cifs_readpages_read_into_pages()
3372 rdata->tailsz = PAGE_SIZE; in cifs_readpages_read_into_pages()
3374 struct page *page = rdata->pages[i]; in cifs_readpages_read_into_pages()
3382 n = rdata->tailsz = len; in cifs_readpages_read_into_pages()
3399 rdata->pages[i] = NULL; in cifs_readpages_read_into_pages()
3400 rdata->nr_pages--; in cifs_readpages_read_into_pages()
3407 rdata->pages[i] = NULL; in cifs_readpages_read_into_pages()
3408 rdata->nr_pages--; in cifs_readpages_read_into_pages()
3416 rdata->got_bytes += result; in cifs_readpages_read_into_pages()
3419 return rdata->got_bytes > 0 && result != -ECONNABORTED ? in cifs_readpages_read_into_pages()
3420 rdata->got_bytes : result; in cifs_readpages_read_into_pages()
3530 struct cifs_readdata *rdata; in cifs_readpages() local
3556 rdata = cifs_readdata_alloc(nr_pages, cifs_readv_complete); in cifs_readpages()
3557 if (!rdata) { in cifs_readpages()
3570 rdata->cfile = cifsFileInfo_get(open_file); in cifs_readpages()
3571 rdata->mapping = mapping; in cifs_readpages()
3572 rdata->offset = offset; in cifs_readpages()
3573 rdata->bytes = bytes; in cifs_readpages()
3574 rdata->pid = pid; in cifs_readpages()
3575 rdata->pagesz = PAGE_SIZE; in cifs_readpages()
3576 rdata->read_into_pages = cifs_readpages_read_into_pages; in cifs_readpages()
3577 rdata->credits = credits; in cifs_readpages()
3581 rdata->pages[rdata->nr_pages++] = page; in cifs_readpages()
3584 if (!rdata->cfile->invalidHandle || in cifs_readpages()
3585 !(rc = cifs_reopen_file(rdata->cfile, true))) in cifs_readpages()
3586 rc = server->ops->async_readv(rdata); in cifs_readpages()
3588 add_credits_and_wake_if(server, rdata->credits, 0); in cifs_readpages()
3589 for (i = 0; i < rdata->nr_pages; i++) { in cifs_readpages()
3590 page = rdata->pages[i]; in cifs_readpages()
3596 kref_put(&rdata->refcount, cifs_readdata_release); in cifs_readpages()
3600 kref_put(&rdata->refcount, cifs_readdata_release); in cifs_readpages()