Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2479714pxa; Mon, 17 Aug 2020 10:35:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7AI79wjVdTPtMNlNIOxcMXaaDpmMrkiATq3pvOy7TRieFsDE2yyOzBfwK1v11jsZWLQ9t X-Received: by 2002:a17:906:4e57:: with SMTP id g23mr15544940ejw.92.1597685735189; Mon, 17 Aug 2020 10:35:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597685735; cv=none; d=google.com; s=arc-20160816; b=UbmMrcOIUyl1RyX2GlxNw4SxqU1F6srTlE1kQEuBp1AiKMZAIkq6whke8E/7q8cdZA zMHSC2NjW2O6qsTYWhpu1BwYyGS0n2xCa2421qJlPA5uZ4D0/HTX1/75pbPCMT5YvRf5 m0NJuIqmiyk1ex+U7q8OnoZ3/LRYIsZ8Vao1TEOdSBKuyBySDNMWPnW9nMB0Bep4rKnb P75I/2qW9ir5CyseelvWjHTh6Nq9bPga299URZgS6IEfQ7qVOkoUefrn36e975gGWZoY +wXlzkSBtB1um5LBzip+B2oP9v2ZxTpecVyQxCL5fvDLbMxUB4YlwuPLh79E+KfethPc C1dg== 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=sDycQp4p8QqjhUNfybr06rjLzMrYS09sHrxbwDXOUcI=; b=zv/K7GdLPBVPra8qis/6lQ/cddg6CNlI2RY2Nn0lie4v+qR6uxzembToIsmr51sNdY 6iH6p/ft1dyr28Lva1PI4IwZAJjkmajdySUStPu2JmIAG+1pzQb4odOqp+7vKJa+A4Rn bgwqT9UQHMut8KN2t1Y0uNIT8vjObGRNvOpgd/4oxDjpN1eUBwO7oxONgN+/cP0QXVZT GFW/iky2xG90BVnt65rt9HX9LRF9OiP9dYJHD4ZofDms4FvlieX+ZmtvFAiysbVgJN9x caYaaPOV2vP34J9Mj6O65dExbJxuPnprAef4M6wlDXs7pGyrecO0m1vvDs5R15d6g6Ks 6+Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Ro8IoZMr; 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 e2si11358834ejj.50.2020.08.17.10.35.12; Mon, 17 Aug 2020 10:35:35 -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=Ro8IoZMr; 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 S2389090AbgHQRdX (ORCPT + 99 others); Mon, 17 Aug 2020 13:33:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389022AbgHQQxs (ORCPT ); Mon, 17 Aug 2020 12:53:48 -0400 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF87DC06134F for ; Mon, 17 Aug 2020 09:53:34 -0700 (PDT) Received: by mail-io1-xd43.google.com with SMTP id z6so18302801iow.6 for ; Mon, 17 Aug 2020 09:53:34 -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=sDycQp4p8QqjhUNfybr06rjLzMrYS09sHrxbwDXOUcI=; b=Ro8IoZMrcIOtejypptmqXkVsHoRbdE7L+5BTIGTpY7fto2LLM08U0zj1H8pO940mSK UIl7EiXhWxrAjx6yKRT4wEVlLUCG5MmlKHypgzHt8OBf8kR7nTBxgWAZiL7Ch90n1AYG tvJifIRnBKyBjuDy2r/5if75Efj2wksflHpqCwYir8Mulp0i09oRbrmzKXGXiK7uAHLl JT9Pe/Xe8CXv4eNEZQXh45mOoowI+uVg4cUJ+L8H+6kECa+udJrHgjOToyv6PIRpwPGY hAVIEAHDD8ORbVzBdKY6to1/Nqhs5ytUdq6WNXf1rWxkvpQXDJYZbfKFm91JXw1KfVBI QHqg== 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=sDycQp4p8QqjhUNfybr06rjLzMrYS09sHrxbwDXOUcI=; b=pEX7pP4hcF0Z6QLPq699lNHY594HATddL7bAGVkdtZM4DTU1pF8Pqu5J6Lgnwj5U2s 28T6og5klA/F6mFTvjLmdur7dGoseVLRVItCx2WKT3MrgrIj/4+QGuwRfhvvd59PLpt2 gUwqBMeHlCi0jnBYXFWvvSFxPjNXmYUyKy9f8v13FK0E/HV2ZxnROIMWIhij2xF9ODn5 JZQH+BiwLjbBKo2PxjS1SKwcCPs9XYRFlgWOVji3h5Q6VFop/o+ZEpBg18k8TGlIFt3g VJNJJBjkpZPTRkhJYT64Nbqya2yVYIT2yZELV+ED+4FiVu47IblJoBbFN8lE5LH4JfYY lRUw== X-Gm-Message-State: AOAM5315pFgQFUPtKejUp0AAEzGTlMEwZFI5oCAKv+uPjnsz9Ev9xJ7w I/p5leoD4WSdku+WxizFxqgrUVUAb2c= X-Received: by 2002:a02:3f0d:: with SMTP id d13mr14908711jaa.99.1597683213863; Mon, 17 Aug 2020 09:53:33 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 09:53:33 -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 05/10] SUNRPC: Split out xdr_realign_pages() from xdr_align_pages() Date: Mon, 17 Aug 2020 12:53:22 -0400 Message-Id: <20200817165327.354181-6-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 don't need the entire align pages code for READ_PLUS, so split out the part I do need so I don't need to reimplement anything. Signed-off-by: Anna Schumaker --- net/sunrpc/xdr.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index 8d29450fdce5..70efb35c119e 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c @@ -1042,26 +1042,33 @@ __be32 * xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes) } EXPORT_SYMBOL_GPL(xdr_inline_decode); -static unsigned int xdr_align_pages(struct xdr_stream *xdr, unsigned int len) +static void xdr_realign_pages(struct xdr_stream *xdr) { struct xdr_buf *buf = xdr->buf; - struct kvec *iov; - unsigned int nwords = XDR_QUADLEN(len); + struct kvec *iov = buf->head; unsigned int cur = xdr_stream_pos(xdr); unsigned int copied, offset; - if (xdr->nwords == 0) - return 0; - /* Realign pages to current pointer position */ - iov = buf->head; if (iov->iov_len > cur) { offset = iov->iov_len - cur; copied = xdr_shrink_bufhead(buf, offset); trace_rpc_xdr_alignment(xdr, offset, copied); xdr->nwords = XDR_QUADLEN(buf->len - cur); } +} +static unsigned int xdr_align_pages(struct xdr_stream *xdr, unsigned int len) +{ + struct xdr_buf *buf = xdr->buf; + unsigned int nwords = XDR_QUADLEN(len); + unsigned int cur = xdr_stream_pos(xdr); + unsigned int copied, offset; + + if (xdr->nwords == 0) + return 0; + + xdr_realign_pages(xdr); if (nwords > xdr->nwords) { nwords = xdr->nwords; len = nwords << 2; -- 2.28.0