Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1534264pxb; Fri, 27 Aug 2021 11:01:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNdY8OoWDRgzwH+NhjR1hOpjKOweWPdqjJUDuov0sJEa9cg/l630pmhYaAXvAIFrq4r1C3 X-Received: by 2002:a05:6602:3404:: with SMTP id n4mr8383866ioz.45.1630087284787; Fri, 27 Aug 2021 11:01:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630087284; cv=none; d=google.com; s=arc-20160816; b=hWq6iUD14xBvSbKjgJRnS/4F7dwLn/k4nm3s01kn12xbh4lhHV4XTlcVj13FhykpKO VnAOn32o/0kbfBeJPa/54EGIZ4cTPBk4BPPggbP6931xTrYTIxuDBj9aWu/xAQcE6j4X VnhNbSVS/dQUqyqhQvVF1YN1zlegI0Ne9uxYd6KKcnzHgDB+QUGxr/HKmv/FIzcPqVVF IKVgtu7zIbqZ83jtBvZC7nRFqX3py8KR5ym27fsVrfMCO4cNB+OWQLW7CLEYWDYlE+F8 9IxPidtPfRKPLyGzpILLwOVa0dxQomGxbi/JQnj3JkzoMIuCC0c8Epw9gdQHQNHJUZu7 3B2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=L5Y0vQ7X/qB6oBQW2nW1P4GVkjdEoWMcMH1wHO1JCYc=; b=Xy7Wp0JMhIxcCT6kdnt/RUqOipeLiCtJsJPORBjgqWXlEo+c0jgK3pA1BxvJEorRDo gzyuCIbE8CpMGEFL2mQSk3QpT+TtIkc5ZwweSU5PRfh7qNO4M2+A7cudgFATU4eCg84u lIbnQyAzZx6gaQ7N3QAWSOI//sIo81rubF/65wkkWaTSRzwN/KTrJh+DhXIzvk3l8jcy /23nafUd1u/a095JR2vzkvm+ncghdXLkEclQOlaQs/4oyi2Q+Fb/V8TyusZjSEDl18ty BWG8ObFaj9rSOhcwE8/pLdoNP86ppWYw86NtywSJhwn0c8eVrKQxslI3ZEP5zZBVFBCJ FIuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="UNz/wN5p"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j7si5983092ioq.78.2021.08.27.11.00.59; Fri, 27 Aug 2021 11:01:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="UNz/wN5p"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236657AbhH0SBr (ORCPT + 99 others); Fri, 27 Aug 2021 14:01:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:57884 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231359AbhH0SBq (ORCPT ); Fri, 27 Aug 2021 14:01:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7E55160F35; Fri, 27 Aug 2021 18:00:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630087257; bh=p+B933KvPu08re7lkMfC9NDHAxMff6Xh275mOr2AcLY=; h=From:To:Cc:Subject:Date:From; b=UNz/wN5prEvsD9FS0C2npoHKIxmYmSDHy0WbrA+PoONDkGVX7M42beAg/jessIJaT 6cAcjKfbVsLpF5T1clCICRK32t4DGs/mtSWFh86XMVZKYERdqqw+yL8MgDPz+RtE9F cIlnTXRwTmUVz89ORcd9WMZjosUdx/R+z4Ex2KMWNBL6GA3EgkTur5IAEUgxQJboBi +2jXAjyavle+RrUgG5G4nowBsGj7TYdJH7YN9zvTxJMkC+zQnHIOB3XzE9NxW1PYr6 k9Bq1DCF0o1upTDnkCjf40cRIOdMb6RLLSS8zblp95ua9y6c9041K+A+0oCkkP9aj+ Gg/GD+2zp5Xsg== From: trondmy@kernel.org To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH] NFS: Always provide aligned buffers to the RPC read layers Date: Fri, 27 Aug 2021 14:00:56 -0400 Message-Id: <20210827180056.610170-1-trondmy@kernel.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust 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 --- fs/nfs/read.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 9f39e0a1a38b..08d6cc57cbc3 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -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; -- 2.31.1