Skip to content

Commit 08f70c0

Browse files
dhowellsSteve French
authored andcommitted
cifs: Fix read-performance regression by dropping readahead expansion
cifs_expand_read() is causing a performance regression of around 30% by causing extra pagecache to be allocated for an inode in the readahead path before we begin actually dispatching RPC requests, thereby delaying the actual I/O. The expansion is sized according to the rsize parameter, which seems to be 4MiB on my test system; this is a big step up from the first requests made by the fio test program. Simple repro (look at read bandwidth number): fio --name=writetest --filename=/xfstest.test/foo --time_based --runtime=60 --size=16M --numjobs=1 --rw=read Fix this by removing cifs_expand_readahead(). Readahead expansion is mostly useful for when we're using the local cache if the local cache has a block size greater than PAGE_SIZE, so we can dispense with it when not caching. Fixes: 69c3c02 ("cifs: Implement netfslib hooks") Signed-off-by: David Howells <[email protected]> Acked-by: Paulo Alcantara (Red Hat) <[email protected]> cc: Jeff Layton <[email protected]> cc: Matthew Wilcox <[email protected]> cc: [email protected] cc: [email protected] cc: [email protected] cc: [email protected] Signed-off-by: Steve French <[email protected]>
1 parent 22a40d1 commit 08f70c0

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

fs/smb/client/file.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -245,35 +245,6 @@ static int cifs_init_request(struct netfs_io_request *rreq, struct file *file)
245245
return 0;
246246
}
247247

248-
/*
249-
* Expand the size of a readahead to the size of the rsize, if at least as
250-
* large as a page, allowing for the possibility that rsize is not pow-2
251-
* aligned.
252-
*/
253-
static void cifs_expand_readahead(struct netfs_io_request *rreq)
254-
{
255-
unsigned int rsize = rreq->rsize;
256-
loff_t misalignment, i_size = i_size_read(rreq->inode);
257-
258-
if (rsize < PAGE_SIZE)
259-
return;
260-
261-
if (rsize < INT_MAX)
262-
rsize = roundup_pow_of_two(rsize);
263-
else
264-
rsize = ((unsigned int)INT_MAX + 1) / 2;
265-
266-
misalignment = rreq->start & (rsize - 1);
267-
if (misalignment) {
268-
rreq->start -= misalignment;
269-
rreq->len += misalignment;
270-
}
271-
272-
rreq->len = round_up(rreq->len, rsize);
273-
if (rreq->start < i_size && rreq->len > i_size - rreq->start)
274-
rreq->len = i_size - rreq->start;
275-
}
276-
277248
/*
278249
* Completion of a request operation.
279250
*/
@@ -329,7 +300,6 @@ const struct netfs_request_ops cifs_req_ops = {
329300
.init_request = cifs_init_request,
330301
.free_request = cifs_free_request,
331302
.free_subrequest = cifs_free_subrequest,
332-
.expand_readahead = cifs_expand_readahead,
333303
.clamp_length = cifs_clamp_length,
334304
.issue_read = cifs_req_issue_read,
335305
.done = cifs_rreq_done,

0 commit comments

Comments
 (0)