Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp777272pxu; Thu, 3 Dec 2020 12:20:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2Sjb9Gv1oQLx/crjgVoVlICBU9LvARe6SyKY8Ovc66ZmXM4ABU1gtKZUvzlu3ECGYhUfx X-Received: by 2002:a17:906:5e0f:: with SMTP id n15mr4085776eju.459.1607026809554; Thu, 03 Dec 2020 12:20:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607026809; cv=none; d=google.com; s=arc-20160816; b=H+cF0FoAFrwrL+8GAoREFfwMqhQQ02CspkmbLxZfvowHdrmEJ7oY96R9VlmXHiMyYi p8JVgH2j3Cxae4OZjcZcQJ91OobsJ2+Rw4shb9fcoQEeTFf4MK7+D/MshbUkjxFv6SfT 5dgFl1KvqeRzkZbhLLfJywxkjYkT0eFfUs3hQkneE7KwT/ttKEbz6oqT8ZAgHXEDhboS 0KHjAvpl6vplxRrxCzCnYZ+TEL/DUJ6t7SppbHa8MPZp/294Y43yWd0KCmlDW9bo2yxu urDpk18c3jUGkDAjKj9upyM1lPUhqKimyKNMndEFiMSBM/ShHmgbsiVrfpfB9unkEIbm jrxA== 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:cc:to:from:sender :dkim-signature; bh=VpbzW1tJjXNLaoKcxIkBvS9VSfhDnefWLuqJQFG1IaQ=; b=Vwp14idlKCKHtgW35px7avdJnHmacp6QBwgLUAdJu8H23TqRW5uMdnnqERwouiDmAh COIKExU2Q4E8EM1xXd3FEHYtAOEhmCihjT9tNv+UzXcbK5c74GdA9N7CWfocKk6OAzzS dYXIN6nan/0Q1Tr1TS0JioTBY1y7PSnGJsB50hr2vSnxmlFzL8EwFN8SSppDmHPhwOHk v4/Z9A6xORMZDa43mze5a0VG6oakBleOz2jJ6T2Fh3Tu8ZJd2w4NNRVvOhtdpFs0eOia ihhvLIH+NV2v7F5PoRmyKQIXubGo5OblxfNwpxpSKwEWXam7UOyceyiTSs52hnkSRwpu Y/qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=W+s96HL4; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs4si1543193edb.555.2020.12.03.12.19.36; Thu, 03 Dec 2020 12:20:09 -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=@gmail.com header.s=20161025 header.b=W+s96HL4; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727773AbgLCUTd (ORCPT + 99 others); Thu, 3 Dec 2020 15:19:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726915AbgLCUTc (ORCPT ); Thu, 3 Dec 2020 15:19:32 -0500 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 783C2C061A4F for ; Thu, 3 Dec 2020 12:18:46 -0800 (PST) Received: by mail-qk1-x743.google.com with SMTP id n132so3427354qke.1 for ; Thu, 03 Dec 2020 12:18:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VpbzW1tJjXNLaoKcxIkBvS9VSfhDnefWLuqJQFG1IaQ=; b=W+s96HL43gfE/BdEiVnEe7Y+Kh2Z2lHe0s0rOsGG/vc3xJ0AjnYNIL0orDRUh29om2 f4Xw2VBnnM3ZuD3wiJzfGcUibOhJFqZW0qq5ZZLQnRzLLKHlrHHofU82bVSYuynJeOd+ AsN1AJKKM7aPWncZU3Xx5bAzskJ04JZJYdwNmGFjp1Ns6kiKBVJyQsolSZYbBqgpEKgP j9U2v+YWCbxX/DjF+ZhAlIFdyDWH9AThA7KLG9pND+78ODe1T8LWqEV2otlSMvx4MRJY lsQdH7czMUeYMsb14mhgPbSBiMuyqj+xbnB7fMaVs34Utm4jN/LSBGWbFV1UzHD3UwKi 8n8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=VpbzW1tJjXNLaoKcxIkBvS9VSfhDnefWLuqJQFG1IaQ=; b=aB8tskonMc4YCNKAk1N9Fv0A3uOF59AIPW0byowZ7zEnQIdY/rDNpbbxkCTLxZj1gc at+wBdSZh1HZBAOOGnxKwqzwBOgX/LPvMd7Wj4aFmRvEEilVu2qsgIn0Ib/N0kEp/WnD 4ib26QbFhLKvVSi4G6xB+W6apJToha6E4A0tjU7KP3qSMc9hxAiszYqlvXfmiOJQ+OmL xU99BX7ByREy/DU2BftCjDjwWJ27Qoz8a93Vp1h+VUflj0sU/u+VA3WkGECVNXm70SqL jMoBCFazOOiXnIpd8E12e2UF0+cB2kEChTTBalBQufiTk2NzMMMb/4qDuVrm7cvAMUrB IDjA== X-Gm-Message-State: AOAM533cknPpVEtEXK3xGV2JLmKoZusiOwAMIYmeUC2s6I1zpdmqb3fd Zd/sgMZ1RTbteRbksDVg02LGOAZw/jc= X-Received: by 2002:a05:620a:94d:: with SMTP id w13mr4489799qkw.194.1607026725466; Thu, 03 Dec 2020 12:18:45 -0800 (PST) Received: from gouda.nowheycreamery.com (c-68-32-74-190.hsd1.mi.comcast.net. [68.32.74.190]) by smtp.gmail.com with ESMTPSA id q20sm2194530qtn.80.2020.12.03.12.18.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 12:18:44 -0800 (PST) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH 2/3] NFS: Allocate a scratch page for READ_PLUS Date: Thu, 3 Dec 2020 15:18:40 -0500 Message-Id: <20201203201841.103294-3-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201203201841.103294-1-Anna.Schumaker@Netapp.com> References: <20201203201841.103294-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker We might need this to better handle shifting around data in the reply buffer. Suggested-by: Trond Myklebust Signed-off-by: Anna Schumaker --- fs/nfs/nfs42xdr.c | 2 ++ fs/nfs/read.c | 13 +++++++++++-- include/linux/nfs_xdr.h | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c index 8432bd6b95f0..ef095a5f86f7 100644 --- a/fs/nfs/nfs42xdr.c +++ b/fs/nfs/nfs42xdr.c @@ -1297,6 +1297,8 @@ static int nfs4_xdr_dec_read_plus(struct rpc_rqst *rqstp, struct compound_hdr hdr; int status; + xdr_set_scratch_buffer(xdr, page_address(res->scratch), PAGE_SIZE); + status = decode_compound_hdr(xdr, &hdr); if (status) goto out; diff --git a/fs/nfs/read.c b/fs/nfs/read.c index eb854f1f86e2..012deb5a136f 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -37,15 +37,24 @@ static struct kmem_cache *nfs_rdata_cachep; static struct nfs_pgio_header *nfs_readhdr_alloc(void) { - struct nfs_pgio_header *p = kmem_cache_zalloc(nfs_rdata_cachep, GFP_KERNEL); + struct nfs_pgio_header *p; + struct page *page; - if (p) + page = alloc_page(GFP_KERNEL); + if (!page) + return ERR_PTR(-ENOMEM); + + p = kmem_cache_zalloc(nfs_rdata_cachep, GFP_KERNEL); + if (p) { p->rw_mode = FMODE_READ; + p->res.scratch = page; + } return p; } static void nfs_readhdr_free(struct nfs_pgio_header *rhdr) { + __free_page(rhdr->res.scratch); kmem_cache_free(nfs_rdata_cachep, rhdr); } diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index d63cb862d58e..e0a1c97f11a9 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -659,6 +659,7 @@ struct nfs_pgio_res { struct nfs_fattr * fattr; __u64 count; __u32 op_status; + struct page * scratch; union { struct { unsigned int replen; /* used by read */ -- 2.29.2