Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp679871pxb; Wed, 18 Nov 2020 14:21:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJwtrMaeOtX+iGVGwFKt9OWqEyYtXAVxgSSeGerETRiAkairuT8TavwYlGe3Ubz1/72PK6iW X-Received: by 2002:a17:906:c82c:: with SMTP id dd12mr8338251ejb.321.1605738100329; Wed, 18 Nov 2020 14:21:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605738100; cv=none; d=google.com; s=arc-20160816; b=C4hiVZBwymqQZmuS7X43s2CD6epXCrVwZ7sPgpCMg51taqET73EkFxQ1pfrQSSsArU PCKrhXHXAff65SF1bVkhanvyvXnuIXxRt/AJvjnyijIiGzML6ZTgU2E+qFmLvpJVyMK4 vrXY4VrrrB/UmW+3oNSq74zImbj2oCrcLyKHAzEPQn2vB+N89YGtPjMniNFkg1qhpmDn 7nkH9LuvAtqgapE55nJjVDcLCUxgrtDkC8mkVKctkIp71hfndrSKRa8HPatzgjQlFcuE 0EhTLY3/5r5+Jr56vwaV9LLJ8llB92tLOIdmifc7y2dMn8gUjAjlPi1/nSByoD8HPPCe hVmg== 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 :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=u2TDM/raW0aOp1/TMC7d6dDDtdBuH1GMkLgdHmMckZo=; b=HxbQi8ekiReRoAGq5QBsMGV9dzfX040J139c51gf2iv/JvYvmedoRpzvGisD6sROdW d5WWqvK6rNIsc3pyoQ9PIpZA7rGEJ5RJ0qLseBfZ3dSqPGDcs9IvpBfWYJhkyn6zc7PJ F08i50VTY1FcPjFY0aONcLhhQTP1lf6Xj8MhaZSLHuTA9X/UpEMwsSFtgE5hipqMP+JD Gw4NyTDpPf45Nlg62WLM62LFIqoTM0nxBHpr6OlIZjP53N/ti5sSU6w+64iM25ZNw4p+ anHOuhsS6A8K0HYwjRXsMciyS+sAzOoVU/D0GuSjyh3q76B6egijePXRIq871C/86lJK r+NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eUdpZi3h; 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 ec18si16193963ejb.679.2020.11.18.14.21.13; Wed, 18 Nov 2020 14:21:40 -0800 (PST) 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=default header.b=eUdpZi3h; 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 S1726766AbgKRWTp (ORCPT + 99 others); Wed, 18 Nov 2020 17:19:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:43820 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726184AbgKRWTp (ORCPT ); Wed, 18 Nov 2020 17:19:45 -0500 Received: from leira.hammer.space (c-68-36-133-222.hsd1.mi.comcast.net [68.36.133.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 71EF5246DC for ; Wed, 18 Nov 2020 22:19:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605737984; bh=aZmrGsheszoo3wyL9VbIIzf5/t57BUubvxhuJpQQqXE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eUdpZi3hnbObS7fdjjKy0wHy0wfhEUZjGuX1o/oY4dPKyyG30z+XWHoftnbm3MOU/ TJZmBFYkjMxrmdPfHOx95V4yLgnxiuBz9LJSCFY9L/v71ZG5dX081Cojfms1AQauVx QIV64MKfPSCz7gamlnHiHjmldM8Wq9cJKVzsvovU= From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH 3/3] NFS: Avoid copy of xdr padding in read() Date: Wed, 18 Nov 2020 17:19:39 -0500 Message-Id: <20201118221939.20715-3-trondmy@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201118221939.20715-2-trondmy@kernel.org> References: <20201118221939.20715-1-trondmy@kernel.org> <20201118221939.20715-2-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust When doing a read() into a page, we also don't care if the nul padding stays in that last page when the data length is not 32-bit aligned. Signed-off-by: Trond Myklebust --- fs/nfs/nfs2xdr.c | 2 +- fs/nfs/nfs3xdr.c | 2 +- fs/nfs/nfs4xdr.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c index db9c265ad9e1..468bfbfe44d7 100644 --- a/fs/nfs/nfs2xdr.c +++ b/fs/nfs/nfs2xdr.c @@ -102,7 +102,7 @@ static int decode_nfsdata(struct xdr_stream *xdr, struct nfs_pgio_res *result) if (unlikely(!p)) return -EIO; count = be32_to_cpup(p); - recvd = xdr_read_pages(xdr, count); + recvd = xdr_read_pages(xdr, xdr_align_size(count)); if (unlikely(count > recvd)) goto out_cheating; out: diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c index d3e1726d538b..8ef7c961d3e2 100644 --- a/fs/nfs/nfs3xdr.c +++ b/fs/nfs/nfs3xdr.c @@ -1611,7 +1611,7 @@ static int decode_read3resok(struct xdr_stream *xdr, ocount = be32_to_cpup(p++); if (unlikely(ocount != count)) goto out_mismatch; - recvd = xdr_read_pages(xdr, count); + recvd = xdr_read_pages(xdr, xdr_align_size(count)); if (unlikely(count > recvd)) goto out_cheating; out: diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 755b556e85c3..5baa767106dc 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -5202,7 +5202,7 @@ static int decode_read(struct xdr_stream *xdr, struct rpc_rqst *req, return -EIO; eof = be32_to_cpup(p++); count = be32_to_cpup(p); - recvd = xdr_read_pages(xdr, count); + recvd = xdr_read_pages(xdr, xdr_align_size(count)); if (count > recvd) { dprintk("NFS: server cheating in read reply: " "count %u > recvd %u\n", count, recvd); -- 2.28.0