Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2479087pxa; Mon, 17 Aug 2020 10:34:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDxFbYRbsgYAA/sbl8FjepdD964/4vBDYLb8pAvNnWDdLK44YnTbQ4/Kl+cRdQWS2iA7h7 X-Received: by 2002:a50:c38b:: with SMTP id h11mr16149045edf.308.1597685679770; Mon, 17 Aug 2020 10:34:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597685679; cv=none; d=google.com; s=arc-20160816; b=UV/7rLLvmn9bYAqFf4zJ13LLNfcvTHitzD1ceiz7V4i33/oIIyXsKseRnjdqSCCrY4 c82mJd/S2S0zSLDayDdRU3w8Ct2oZ65gd3IA+xxhd1TLOYulhqFc+Pand0Pbt6clAUgd NPeCCGB7XTkmtNgD3V/GrLhYQBnrE0B1k074L+nAMxDcshaUFDTO6buTdhH4QIIeB1pQ iVPBpxhLioPdaV44vYy4NPYMGSCL3hfB7ckZ+DbwZl/TOZfPpn6c//8tc1sqaXAHo0Q2 vUGprcM91y7A2g0ZhCcvqeoSiFBSQNTCuE3bMWuD83WRq8l7JfyALGuU3XpZCUI5egxI x35A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yIJ1AoId/iaH9uX+tiP3R4juFL9vJPxpeCdCSjsOFHw=; b=PI0Y57s3H5ti7yC1TW9l8NHri5QYKe68ltH+u0GNA0XMHLO0o8xpcL/BMvgcbUuQPK 8wQA9AxieCYcQpJ6mNLg8yLUlyE6psbOt19t6V8vpBgKVkEkEbo42N4p3xEtP9GLOESS N1qtX7MN3kH291QqsgxXH+vQNY1MgjC2bK34bSLMiRGoi3WBNsvo0COdX9v2crx4APzW vEapYKWwrGXHEcuPWlZ/2i3EVD55gUDgPnO/+JgNGG0tz7kUIcf+q2S3Qhh5q613zLIv mFMl9IjD+SKcDbxi0gN9IEX586OkBdxAiCDHvxY9KToJLiFF5elA1xYhH8Sn9ixpzl2r eOxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=hIrYT2wc; 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=fail (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 v19si11938970ejy.697.2020.08.17.10.34.16; Mon, 17 Aug 2020 10:34:39 -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=fail header.i=@gmail.com header.s=20161025 header.b=hIrYT2wc; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389173AbgHQRd1 (ORCPT + 99 others); Mon, 17 Aug 2020 13:33:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389118AbgHQQxr (ORCPT ); Mon, 17 Aug 2020 12:53:47 -0400 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA156C06134C for ; Mon, 17 Aug 2020 09:53:30 -0700 (PDT) Received: by mail-io1-xd42.google.com with SMTP id g14so18395540iom.0 for ; Mon, 17 Aug 2020 09:53:30 -0700 (PDT) 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=yIJ1AoId/iaH9uX+tiP3R4juFL9vJPxpeCdCSjsOFHw=; b=hIrYT2wcbwDRZRDEKO7xEanYpmsQibj04HCDulj2CEXm0ZfjG6A+drNfykW7wG52Vz dUyw7sMqIadhtkdenDGeW1OlqYPyoPmXRGtnbvD5l+ur/c5MO+PvXFwFG6ov89jcZ4Gk ErXYcVyY/QAqZ5G+210SFMY8G0bP0zyFPulytodVJ9iNSp54bV6Hq4IDC504VUVI9kdo ri/0tCgQcLy6O+Cy95gsVRO5b0s5Q4b1DJtkdZLyoRy0HdF3vKY+BdMwNHizlogKjPPi JeXZ2Ii+kkFh1q6sLmZs6IBsB5zLH1fsdf16tGrx4NJZTGIo3iGUBC6uJ07wLw3X7ilx ng8A== 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=yIJ1AoId/iaH9uX+tiP3R4juFL9vJPxpeCdCSjsOFHw=; b=kl4FS8R55sjClH3H9CsBduX0mIhNo66BUS1s7zKYAdLDgtbH6/JyJX006Z+shDwe8S NsEEaklR21uuwHmhGdEh0gOcRQN/hAL4PNuud72Em7cY+sJGJpXE3rqPXUzxi7klzBBx pTaP3i0TAyT/aR2z1XGetL5tfofj1AVh67EcN6iZLpiYU62kUSmnXKLxnoJjaDjxT4AY bwBKh9WH+321TXbAmS+zZNslM2Lok9nRBdznj+axLUfzKD5yoi99n6dzdYC/fABDAy/Y 9hddcmseejNg97seAnRWa2sXlJYuBnkaWmXtbmGCDLszYTyPEEU8F1YYGjHUKZ4S3XsS YXzg== X-Gm-Message-State: AOAM532wMqAcAswLIXBVerCBkGnDMEmWxlsBcRa34Vuf5VUCvE1Dy304 YE300dZYCBL7TUTJN3ZBJrGvKB0IBTI= X-Received: by 2002:a05:6638:2515:: with SMTP id v21mr15169379jat.109.1597683210029; Mon, 17 Aug 2020 09:53:30 -0700 (PDT) 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 a16sm7413106ilc.7.2020.08.17.09.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 09:53:29 -0700 (PDT) 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 v4 01/10] SUNRPC: Split out a function for setting current page Date: Mon, 17 Aug 2020 12:53:18 -0400 Message-Id: <20200817165327.354181-2-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817165327.354181-1-Anna.Schumaker@Netapp.com> References: <20200817165327.354181-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker I'm going to need this bit of code in a few places for READ_PLUS decoding, so let's make it a helper function. Signed-off-by: Anna Schumaker --- net/sunrpc/xdr.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index 6dfe5dc8b35f..c62b0882c0d8 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c @@ -870,6 +870,13 @@ static int xdr_set_page_base(struct xdr_stream *xdr, return 0; } +static void xdr_set_page(struct xdr_stream *xdr, unsigned int base, + unsigned int len) +{ + if (xdr_set_page_base(xdr, base, len) < 0) + xdr_set_iov(xdr, xdr->buf->tail, xdr->nwords << 2); +} + static void xdr_set_next_page(struct xdr_stream *xdr) { unsigned int newbase; @@ -877,8 +884,7 @@ static void xdr_set_next_page(struct xdr_stream *xdr) newbase = (1 + xdr->page_ptr - xdr->buf->pages) << PAGE_SHIFT; newbase -= xdr->buf->page_base; - if (xdr_set_page_base(xdr, newbase, PAGE_SIZE) < 0) - xdr_set_iov(xdr, xdr->buf->tail, xdr->nwords << 2); + xdr_set_page(xdr, newbase, PAGE_SIZE); } static bool xdr_set_next_buffer(struct xdr_stream *xdr) @@ -886,8 +892,7 @@ static bool xdr_set_next_buffer(struct xdr_stream *xdr) if (xdr->page_ptr != NULL) xdr_set_next_page(xdr); else if (xdr->iov == xdr->buf->head) { - if (xdr_set_page_base(xdr, 0, PAGE_SIZE) < 0) - xdr_set_iov(xdr, xdr->buf->tail, xdr->nwords << 2); + xdr_set_page(xdr, 0, PAGE_SIZE); } return xdr->p != xdr->end; } -- 2.28.0