summaryrefslogtreecommitdiff
path: root/fs/smb
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2024-06-07 09:02:58 +0100
committerChristian Brauner <brauner@kernel.org>2024-09-05 11:00:41 +0200
commit52d55922e0f1db1f580c9f91c174d2392bfad481 (patch)
treeae3ff22a9764c542c5c914ac200526a270afc27f /fs/smb
parent73425800ac948cb78063b897a0c345d788f3594d (diff)
netfs: Move max_len/max_nr_segs from netfs_io_subrequest to netfs_io_stream
Move max_len/max_nr_segs from struct netfs_io_subrequest to struct netfs_io_stream as we only issue one subreq at a time and then don't need these values again for that subreq unless and until we have to retry it - in which case we want to renegotiate them. Signed-off-by: David Howells <dhowells@redhat.com> cc: Jeff Layton <jlayton@kernel.org> cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org Link: https://lore.kernel.org/r/20240814203850.2240469-8-dhowells@redhat.com/ # v2 Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/smb')
-rw-r--r--fs/smb/client/file.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index 283c9b6d9094..ceef7048cad2 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -49,6 +49,7 @@ static void cifs_prepare_write(struct netfs_io_subrequest *subreq)
struct cifs_io_subrequest *wdata =
container_of(subreq, struct cifs_io_subrequest, subreq);
struct cifs_io_request *req = wdata->req;
+ struct netfs_io_stream *stream = &req->rreq.io_streams[subreq->stream_nr];
struct TCP_Server_Info *server;
struct cifsFileInfo *open_file = req->cfile;
size_t wsize = req->rreq.wsize;
@@ -73,7 +74,7 @@ retry:
}
}
- rc = server->ops->wait_mtu_credits(server, wsize, &wdata->subreq.max_len,
+ rc = server->ops->wait_mtu_credits(server, wsize, &stream->sreq_max_len,
&wdata->credits);
if (rc < 0) {
subreq->error = rc;
@@ -92,7 +93,7 @@ retry:
#ifdef CONFIG_CIFS_SMB_DIRECT
if (server->smbd_conn)
- subreq->max_nr_segs = server->smbd_conn->max_frmr_depth;
+ stream->sreq_max_segs = server->smbd_conn->max_frmr_depth;
#endif
}
@@ -150,11 +151,11 @@ static void cifs_netfs_invalidate_cache(struct netfs_io_request *wreq)
static bool cifs_clamp_length(struct netfs_io_subrequest *subreq)
{
struct netfs_io_request *rreq = subreq->rreq;
+ struct netfs_io_stream *stream = &rreq->io_streams[subreq->stream_nr];
struct cifs_io_subrequest *rdata = container_of(subreq, struct cifs_io_subrequest, subreq);
struct cifs_io_request *req = container_of(subreq->rreq, struct cifs_io_request, rreq);
struct TCP_Server_Info *server = req->server;
struct cifs_sb_info *cifs_sb = CIFS_SB(rreq->inode->i_sb);
- size_t rsize;
int rc;
rdata->xid = get_xid();
@@ -168,7 +169,7 @@ static bool cifs_clamp_length(struct netfs_io_subrequest *subreq)
rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize,
- &rsize, &rdata->credits);
+ &stream->sreq_max_len, &rdata->credits);
if (rc) {
subreq->error = rc;
return false;
@@ -184,12 +185,12 @@ static bool cifs_clamp_length(struct netfs_io_subrequest *subreq)
server->credits, server->in_flight, 0,
cifs_trace_rw_credits_read_submit);
- subreq->len = umin(subreq->len, rsize);
+ subreq->len = umin(subreq->len, stream->sreq_max_len);
rdata->actual_len = subreq->len;
#ifdef CONFIG_CIFS_SMB_DIRECT
if (server->smbd_conn)
- subreq->max_nr_segs = server->smbd_conn->max_frmr_depth;
+ stream->sreq_max_segs = server->smbd_conn->max_frmr_depth;
#endif
return true;
}