Lines Matching refs:wdata
2419 struct cifs_writedata *wdata = container_of(refcount,
2422 if (wdata->mr) {
2423 smbd_deregister_mr(wdata->mr);
2424 wdata->mr = NULL;
2428 if (wdata->cfile)
2429 cifsFileInfo_put(wdata->cfile);
2431 kfree(wdata);
2439 cifs_writev_requeue(struct cifs_writedata *wdata)
2442 struct inode *inode = d_inode(wdata->cfile->dentry);
2444 unsigned int rest_len = wdata->bytes;
2445 loff_t fpos = wdata->offset;
2447 server = tlink_tcon(wdata->cfile->tlink)->ses->server;
2469 wdata2->sync_mode = wdata->sync_mode;
2472 wdata2->iter = wdata->iter;
2474 iov_iter_advance(&wdata2->iter, fpos - wdata->offset);
2511 /* Clean up remaining pages from the original wdata */
2512 if (iov_iter_is_xarray(&wdata->iter))
2517 kref_put(&wdata->refcount, cifs_writedata_release);
2523 struct cifs_writedata *wdata = container_of(work,
2525 struct inode *inode = d_inode(wdata->cfile->dentry);
2527 if (wdata->result == 0) {
2529 cifs_update_eof(CIFS_I(inode), wdata->offset, wdata->bytes);
2531 cifs_stats_bytes_written(tlink_tcon(wdata->cfile->tlink),
2532 wdata->bytes);
2533 } else if (wdata->sync_mode == WB_SYNC_ALL && wdata->result == -EAGAIN)
2534 return cifs_writev_requeue(wdata);
2536 if (wdata->result == -EAGAIN)
2537 cifs_pages_write_redirty(inode, wdata->offset, wdata->bytes);
2538 else if (wdata->result < 0)
2539 cifs_pages_write_failed(inode, wdata->offset, wdata->bytes);
2541 cifs_pages_written_back(inode, wdata->offset, wdata->bytes);
2543 if (wdata->result != -EAGAIN)
2544 mapping_set_error(inode->i_mapping, wdata->result);
2545 kref_put(&wdata->refcount, cifs_writedata_release);
2550 struct cifs_writedata *wdata;
2552 wdata = kzalloc(sizeof(*wdata), GFP_NOFS);
2553 if (wdata != NULL) {
2554 kref_init(&wdata->refcount);
2555 INIT_LIST_HEAD(&wdata->list);
2556 init_completion(&wdata->done);
2557 INIT_WORK(&wdata->work, complete);
2559 return wdata;
2743 struct cifs_writedata *wdata;
2775 wdata = cifs_writedata_alloc(cifs_writev_complete);
2776 if (!wdata) {
2781 wdata->sync_mode = wbc->sync_mode;
2782 wdata->offset = folio_pos(folio);
2783 wdata->pid = cfile->pid;
2784 wdata->credits = credits_on_stack;
2785 wdata->cfile = cfile;
2786 wdata->server = server;
2823 wdata->bytes = len;
2826 iov_iter_xarray(&wdata->iter, ITER_SOURCE, &mapping->i_pages,
2829 rc = adjust_credits(wdata->server, &wdata->credits, wdata->bytes);
2833 if (wdata->cfile->invalidHandle)
2836 rc = wdata->server->ops->async_writev(wdata,
2839 kref_put(&wdata->refcount, cifs_writedata_release);
2849 kref_put(&wdata->refcount, cifs_writedata_release);
3263 struct cifs_writedata *wdata = container_of(refcount,
3266 kref_put(&wdata->ctx->refcount, cifs_aio_ctx_release);
3275 struct cifs_writedata *wdata = container_of(work,
3277 struct inode *inode = d_inode(wdata->cfile->dentry);
3281 cifs_update_eof(cifsi, wdata->offset, wdata->bytes);
3286 complete(&wdata->done);
3287 collect_uncached_write_data(wdata->ctx);
3289 kref_put(&wdata->refcount, cifs_uncached_writedata_release);
3293 cifs_resend_wdata(struct cifs_writedata *wdata, struct list_head *wdata_list,
3299 struct TCP_Server_Info *server = wdata->server;
3302 if (wdata->cfile->invalidHandle) {
3303 rc = cifs_reopen_file(wdata->cfile, false);
3312 * Wait for credits to resend this wdata.
3313 * Note: we are attempting to resend the whole wdata not in
3317 rc = server->ops->wait_mtu_credits(server, wdata->bytes,
3322 if (wsize < wdata->bytes) {
3326 } while (wsize < wdata->bytes);
3327 wdata->credits = credits;
3329 rc = adjust_credits(server, &wdata->credits, wdata->bytes);
3332 if (wdata->cfile->invalidHandle)
3336 if (wdata->mr) {
3337 wdata->mr->need_invalidate = true;
3338 smbd_deregister_mr(wdata->mr);
3339 wdata->mr = NULL;
3342 rc = server->ops->async_writev(wdata,
3349 list_add_tail(&wdata->list, wdata_list);
3354 add_credits_and_wake_if(server, &wdata->credits, 0);
3358 kref_put(&wdata->refcount, cifs_uncached_writedata_release);
3410 struct cifs_writedata *wdata;
3467 wdata = cifs_writedata_alloc(cifs_uncached_writev_complete);
3468 if (!wdata) {
3474 wdata->sync_mode = WB_SYNC_ALL;
3475 wdata->offset = (__u64)fpos;
3476 wdata->cfile = cifsFileInfo_get(open_file);
3477 wdata->server = server;
3478 wdata->pid = pid;
3479 wdata->bytes = cur_len;
3480 wdata->credits = credits_on_stack;
3481 wdata->iter = *from;
3482 wdata->ctx = ctx;
3485 iov_iter_truncate(&wdata->iter, cur_len);
3487 rc = adjust_credits(server, &wdata->credits, wdata->bytes);
3490 if (wdata->cfile->invalidHandle)
3493 rc = server->ops->async_writev(wdata,
3498 add_credits_and_wake_if(server, &wdata->credits, 0);
3499 kref_put(&wdata->refcount,
3506 list_add_tail(&wdata->list, wdata_list);
3518 struct cifs_writedata *wdata, *tmp;
3541 list_for_each_entry_safe(wdata, tmp, &ctx->list, list) {
3543 if (!try_wait_for_completion(&wdata->done)) {
3548 if (wdata->result)
3549 rc = wdata->result;
3551 ctx->total_len += wdata->bytes;
3559 list_del_init(&wdata->list);
3563 wdata, &tmp_list, ctx);
3566 wdata->offset - ctx->pos);
3568 rc = cifs_write_from_iter(wdata->offset,
3569 wdata->bytes, &tmp_from,
3573 kref_put(&wdata->refcount,
3581 list_del_init(&wdata->list);
3582 kref_put(&wdata->refcount, cifs_uncached_writedata_release);