static void nfs_writedata_release(struct nfs_write_data *wdata)
 {
+       put_lseg(wdata->lseg);
        put_nfs_open_context(wdata->args.context);
        nfs_writedata_free(wdata);
 }
                struct nfs_write_data *data,
                const struct rpc_call_ops *call_ops,
                unsigned int count, unsigned int offset,
+               struct pnfs_layout_segment *lseg,
                int how)
 {
        struct inode *inode = req->wb_context->path.dentry->d_inode;
        data->req = req;
        data->inode = inode = req->wb_context->path.dentry->d_inode;
        data->cred = req->wb_context->cred;
+       data->lseg = get_lseg(lseg);
 
        data->args.fh     = NFS_FH(inode);
        data->args.offset = req_offset(req) + offset;
                if (nbytes < wsize)
                        wsize = nbytes;
                ret2 = nfs_write_rpcsetup(req, data, &nfs_write_partial_ops,
-                                  wsize, offset, how);
+                                         wsize, offset, lseg, how);
                if (ret == 0)
                        ret = ret2;
                offset += wsize;
        req = nfs_list_entry(data->pages.next);
 
        /* Set up the argument struct */
-       return nfs_write_rpcsetup(req, data, &nfs_write_full_ops, count, 0, how);
+       return nfs_write_rpcsetup(req, data, &nfs_write_full_ops, count, 0, lseg, how);
  out_bad:
        while (!list_empty(head)) {
                req = nfs_list_entry(head->next);
 
        unsigned int            npages;         /* Max length of pagevec */
        struct nfs_writeargs    args;           /* argument struct */
        struct nfs_writeres     res;            /* result struct */
+       struct pnfs_layout_segment *lseg;
        int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
 #ifdef CONFIG_NFS_V4
        unsigned long           timestamp;      /* For lease renewal */