]> git.baikalelectronics.ru Git - kernel.git/commitdiff
NFS: Always provide aligned buffers to the RPC read layers
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 27 Aug 2021 18:00:56 +0000 (14:00 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Mon, 30 Aug 2021 17:21:38 +0000 (13:21 -0400)
Instead of messing around with XDR padding in the RDMA layer, we should
just give the RPC layer an aligned buffer. Try to avoid creating extra
RPC calls by aligning to the smaller value of ALIGN(len, rsize) and
PAGE_SIZE.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/read.c

index 9f39e0a1a38bd17de21ef5a675f3c4cae8a1df05..08d6cc57cbc37e6429d2c7c36e6b8dc0a76f2abf 100644 (file)
@@ -293,15 +293,19 @@ static int
 readpage_async_filler(void *data, struct page *page)
 {
        struct nfs_readdesc *desc = data;
+       struct inode *inode = page_file_mapping(page)->host;
+       unsigned int rsize = NFS_SERVER(inode)->rsize;
        struct nfs_page *new;
-       unsigned int len;
+       unsigned int len, aligned_len;
        int error;
 
        len = nfs_page_length(page);
        if (len == 0)
                return nfs_return_empty_page(page);
 
-       new = nfs_create_request(desc->ctx, page, 0, len);
+       aligned_len = min_t(unsigned int, ALIGN(len, rsize), PAGE_SIZE);
+
+       new = nfs_create_request(desc->ctx, page, 0, aligned_len);
        if (IS_ERR(new))
                goto out_error;