Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3177866pxk; Mon, 28 Sep 2020 10:11:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbbvdVQnh+7YK7yErBSyfivUtFOkm+JxfvHpI7xvrZzLI+59aPIOXqaBTqOWuUXbFKmzj9 X-Received: by 2002:a50:fd0a:: with SMTP id i10mr2801979eds.277.1601313076128; Mon, 28 Sep 2020 10:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601313076; cv=none; d=google.com; s=arc-20160816; b=gRqGvfIhfVISYVUsLZfloWZdeXRTEm+HxI8eFllWDGWdQGV+mCwF5T7DX8ELZ9KFY6 yQBTkWLriPZIHsk+VrV3t12dpPVy8n0bFCY5gIeP5hQOG1Bg6dc9+DaHoCeYxaINcJ5I rBWM6OKj2VL7S/tJ+uZRK+MDESfZ/opg6C3Cyd679EyxRaFJ2hu45IN0u8HpRkdKwrdX bZVXhrBHaS1dXl0ChEmiVnuhG9LfNvPMMPTsRnVB0dAwPVUQEV93vQT8Kx0SzEyOCzs2 4it+amYuE6kLqzd/cZ7f6jObyAUq3dLC/g2ttmaZbmMmS6aJLuuD/bjvzA977o1vlIlD 0P9Q== 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=yIJ1AoId/iaH9uX+tiP3R4juFL9vJPxpeCdCSjsOFHw=; b=JpuJgt5H1J2vjfMPIDrfYAkvLYST37G4aD+9h9APNxMwyIqrht2RWLHFmHKtZ8gp89 xfvFkef6/TQqDNdhQRb/mIaRi/YMkeK6rLEKu1wrLHub2O66RyV/0qD22prPmZojD76V oHUprlq5GavN8cWKy+10CsbzjRKN7Sp0hPmuRXPtm38OapRvAf3aFkchbFS0bo0Ht+cF qp//gWtAzE+55gII/CnegSdMWPHkQlwnJSuYl1EIzixhXZGd9IdktWjoeMExN8deElIz 0JvHuV5d09tvHYppxHIvEKn6YozOsYSaUT1XJVYoDyAEcvkS7Nd9vp4M29dSHXK3yuQ/ xkUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RQ44dFuD; 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 c21si1076368edw.18.2020.09.28.10.10.52; Mon, 28 Sep 2020 10:11:16 -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=@gmail.com header.s=20161025 header.b=RQ44dFuD; 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 S1726565AbgI1RJY (ORCPT + 99 others); Mon, 28 Sep 2020 13:09:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726477AbgI1RJY (ORCPT ); Mon, 28 Sep 2020 13:09:24 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 058CFC061755 for ; Mon, 28 Sep 2020 10:09:23 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id o5so1627440qke.12 for ; Mon, 28 Sep 2020 10:09:22 -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=RQ44dFuDTB4NHpx2ocnxAkBzdnvKl/Qg+Dg27CgSgJWj4ny/OdHgYDapJHOFvGCx2O 00l7s/KI9mHpKGLZ1drPfBG8jSDOTSRGe6DDuAaH54DOP/zWfoWRArpvYuSlXL5OZ1rY BCZqJLRCeyjOOoB0USepyQ7DGWtdpEchpzefNT6Kn20p0Xg5J/upOSSS/2UfmJmgPUIH juK1PngmaFbZQGCDsC90s5vs20RAVTzA6WyoCF6CU/k/L252RgAJGisdZVpPlFZ3JIYN cKp2m5xmDzLYsN8djXpgGcwtpDkZFkXL17QY21EpSV6Ak/A+wf/X0LcAvidycfERRWRT u4eA== 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=IJnhr6MRoBhREhfkGKQSyerdmy1NC3WMCYC5yKWR4OXFE4BZosfXDuQyL1/mTBC0vc wZ23iopCU02xkHr22rTTWE+AdmRIMSHrYhF/Dm0FxTgxcvXJchTCYVGGT6ZG79d1wAAQ bCoaspmlCSBlh0QDmTmdnDa9flGZSEW8dryAFVT+PPiivi6ldbKTwCBN9NF3kJElO6X8 WDYjeqIMCHGgGQK0rEpuONwMCx4KClkSXhj9BgU63A5eU91zq4gOWhN3ZQMj2cuKXHW3 BCUkaGYDT8iAl328AQor1HDiQ0mHTm6XFGaVCQBMm1SSEZ20YJNx414KAB4LrBvZ4S/L LxNg== X-Gm-Message-State: AOAM531ku6MVT9UNBCcKSav079iGWJr1psCQ8+BtqNIVDec8vQhClVLj QZYoVFdO5xiPUcq0hQ3IGK14vH2GpU0= X-Received: by 2002:a37:8ac2:: with SMTP id m185mr467323qkd.84.1601312961694; Mon, 28 Sep 2020 10:09:21 -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 201sm1556862qkf.103.2020.09.28.10.09.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 10:09:21 -0700 (PDT) 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 v6 01/10] SUNRPC: Split out a function for setting current page Date: Mon, 28 Sep 2020 13:09:10 -0400 Message-Id: <20200928170919.707641-2-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200928170919.707641-1-Anna.Schumaker@Netapp.com> References: <20200928170919.707641-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 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