Skip to content

Commit f1bf10d

Browse files
sprasad-microsoftSteve French
authored andcommitted
cifs: pick channels for individual subrequests
The netfs library could break down a read request into multiple subrequests. When multichannel is used, there is potential to improve performance when each of these subrequests pick a different channel. Today we call cifs_pick_channel when the main read request is initialized in cifs_init_request. This change moves this to cifs_prepare_read, which is the right place to pick channel since it gets called for each subrequest. Interestingly cifs_prepare_write already does channel selection for individual subreq, but looks like it was missed for read. This is especially important when multichannel is used with increased rasize. In my test setup, with rasize set to 8MB, a sequential read of large file was taking 11.5s without this change. With the change, it completed in 9s. The difference is even more signigicant with bigger rasize. Cc: <[email protected]> Cc: David Howells <[email protected]> Signed-off-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent a64dcfb commit f1bf10d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

fs/smb/client/cifsglob.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,6 @@ struct cifs_io_parms {
15081508
struct cifs_io_request {
15091509
struct netfs_io_request rreq;
15101510
struct cifsFileInfo *cfile;
1511-
struct TCP_Server_Info *server;
15121511
pid_t pid;
15131512
};
15141513

fs/smb/client/file.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static int cifs_prepare_read(struct netfs_io_subrequest *subreq)
147147
struct netfs_io_request *rreq = subreq->rreq;
148148
struct cifs_io_subrequest *rdata = container_of(subreq, struct cifs_io_subrequest, subreq);
149149
struct cifs_io_request *req = container_of(subreq->rreq, struct cifs_io_request, rreq);
150-
struct TCP_Server_Info *server = req->server;
150+
struct TCP_Server_Info *server;
151151
struct cifs_sb_info *cifs_sb = CIFS_SB(rreq->inode->i_sb);
152152
size_t size;
153153
int rc = 0;
@@ -156,6 +156,8 @@ static int cifs_prepare_read(struct netfs_io_subrequest *subreq)
156156
rdata->xid = get_xid();
157157
rdata->have_xid = true;
158158
}
159+
160+
server = cifs_pick_channel(tlink_tcon(req->cfile->tlink)->ses);
159161
rdata->server = server;
160162

161163
if (cifs_sb->ctx->rsize == 0)
@@ -198,7 +200,7 @@ static void cifs_issue_read(struct netfs_io_subrequest *subreq)
198200
struct netfs_io_request *rreq = subreq->rreq;
199201
struct cifs_io_subrequest *rdata = container_of(subreq, struct cifs_io_subrequest, subreq);
200202
struct cifs_io_request *req = container_of(subreq->rreq, struct cifs_io_request, rreq);
201-
struct TCP_Server_Info *server = req->server;
203+
struct TCP_Server_Info *server = rdata->server;
202204
int rc = 0;
203205

204206
cifs_dbg(FYI, "%s: op=%08x[%x] mapping=%p len=%zu/%zu\n",
@@ -266,7 +268,6 @@ static int cifs_init_request(struct netfs_io_request *rreq, struct file *file)
266268
open_file = file->private_data;
267269
rreq->netfs_priv = file->private_data;
268270
req->cfile = cifsFileInfo_get(open_file);
269-
req->server = cifs_pick_channel(tlink_tcon(req->cfile->tlink)->ses);
270271
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)
271272
req->pid = req->cfile->pid;
272273
} else if (rreq->origin != NETFS_WRITEBACK) {

0 commit comments

Comments
 (0)