Message ID | 20230331160914.1608208-24-dhowells@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE631C76196 for <linux-mm@archiver.kernel.org>; Fri, 31 Mar 2023 16:10:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E2D8A6B00A1; Fri, 31 Mar 2023 12:10:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DDD566B00A2; Fri, 31 Mar 2023 12:10:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CCBA06B00A3; Fri, 31 Mar 2023 12:10:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id BE2E66B00A1 for <linux-mm@kvack.org>; Fri, 31 Mar 2023 12:10:35 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 914211A0CFE for <linux-mm@kvack.org>; Fri, 31 Mar 2023 16:10:35 +0000 (UTC) X-FDA: 80629681230.07.0EC0F99 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf30.hostedemail.com (Postfix) with ESMTP id D8EE280028 for <linux-mm@kvack.org>; Fri, 31 Mar 2023 16:10:33 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=XI6amrfh; spf=pass (imf30.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680279033; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Cnsl2PBKcn/WeJcDUlvQg+kDRV/xI85q/f39rakA9vk=; b=bv7h8vribHqIl6vZhOsmiC7A0dHGguGh6dqnqd3MztZcFI/K6yp1/zYcifNQgbAQyb56sG HbNvzoJuudd7PxzCqPLraQ3lgj0FUBNbXPAsxuMZRylogv15Ts9bCkqoQGZqYgS6uMHP+1 At35AUCY4U8YT041+Filt9i0bxJXpik= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=XI6amrfh; spf=pass (imf30.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680279033; a=rsa-sha256; cv=none; b=yRcSDoF5v9tvSLv2Z0hEiSXw7+cfKRbFokh1u8DyXCgTYi/GQ5Muf/Bk5326kCOfpV2Kau H3VGlirOnL5EcLSb5hrcpsYbHTfdScQZUtlswIUPWGW49lg64VCzv6vCUaJ8A8B2e9cRaA skg05JN0P5G94WDWsiYCvWjtIcWVug0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680279033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Cnsl2PBKcn/WeJcDUlvQg+kDRV/xI85q/f39rakA9vk=; b=XI6amrfhRiWRFwg5EjOLOK2iogcx337hgNfwNFXjcryGyD3zSmQgwI1vb5IL7A80QwWmTe 3Z94TKdsDo+2E5epf2kFhV5BTx0Y86fdU9WzCcG2mmJxsFGJWzbqJxMxb9S9cPxH6lueh3 /+yaUc0S/jHFUbdefhu9ILQ0yGzZSBQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-670-w26OBUVGPfurU15AUpPLuQ-1; Fri, 31 Mar 2023 12:10:26 -0400 X-MC-Unique: w26OBUVGPfurU15AUpPLuQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4B9C3380452A; Fri, 31 Mar 2023 16:10:25 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A525492C3E; Fri, 31 Mar 2023 16:10:23 +0000 (UTC) From: David Howells <dhowells@redhat.com> To: Matthew Wilcox <willy@infradead.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Cc: David Howells <dhowells@redhat.com>, Al Viro <viro@zeniv.linux.org.uk>, Christoph Hellwig <hch@infradead.org>, Jens Axboe <axboe@kernel.dk>, Jeff Layton <jlayton@kernel.org>, Christian Brauner <brauner@kernel.org>, Chuck Lever III <chuck.lever@oracle.com>, Linus Torvalds <torvalds@linux-foundation.org>, netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Herbert Xu <herbert@gondor.apana.org.au>, linux-crypto@vger.kernel.org Subject: [PATCH v3 23/55] crypto: af_alg: Indent the loop in af_alg_sendmsg() Date: Fri, 31 Mar 2023 17:08:42 +0100 Message-Id: <20230331160914.1608208-24-dhowells@redhat.com> In-Reply-To: <20230331160914.1608208-1-dhowells@redhat.com> References: <20230331160914.1608208-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Stat-Signature: waa9wmdo3qobbxxmhkdnd73kzt851u1f X-Rspam-User: X-Rspamd-Queue-Id: D8EE280028 X-Rspamd-Server: rspam06 X-HE-Tag: 1680279033-436587 X-HE-Meta: U2FsdGVkX1+p2yFPwY/DEkn3f+eFucXqyJ9y+A+glY6WSAYir1gjawbTvm+LWIeZ5d2R1ljqW+sVidHfx1JyetFlhFh5m4+pJeYE3rMuNh4LIDc5WpFJ1psQedjMGARF5GD0p30ehVXpQG/ziIxcNG2rNIXwG/lx4o6OMqUqGIgSe9MwoLEW7G2Top80+nlROboxdjuAoQtsVV5+1lvu31dCaKhhHUp617cP7yj9ExP3PPDAgNSZcVRJXz30xJcx02cHkgi55kwonm0W4lOUHWfXvS0qQs3FFcmAg4O+9gO4RorNcNyV1jCJafyraD9lr2Mibr2N+84xRkh9tNJFBviGc5bQvz1neRRfykCYGPtP+JHvC0O1aAwCybV3gz2rQr+hHt7X9PVSj0iZQbEN3BkXCmbhqUCw2vfqZHi5n/8gHNnsrH/hZdlAAtyWPZZSz/Xcx3YtCdumnqfqT9sOrqy0C1hi3RaMAXI9u3G9DSO+9F9YmAICRsnp8rBNpwh4x7vv6qK2oH2QUoN5q+uYsQzbrP6hb2vdaHga/E0Ia7J1Y5gDCE+yyGGGCJ8jhr7FH5gt2alwgIZ3U3s+ippgEflxfxqBCbhLEgCgNqvhCcH96TP2dWeaiivvwBkYgz9Ap5mCqnvoQEjbyUXhtuP7k4cUCh2cAeJiDeZgrB9lNIY8t1iPuhTCh2XzrHxqHNAZJ7OytOH6BdoDaLMjVj/4N2U8gGIwqMxJ6VnHSX3HwQEmUzu9wvRGtCaxccA78U33J+yfeMsyHOGIQUcsDxlksOSzSFXY4+PPh5+DQC6QT6xI8PSBsRx5CRLirW0u2JDj0ckpRp4nofQ3G1U34eYZ3RNjrGF8z0njLHjYbvLxEim2BNOQfVmkCfk6rQ1L4+Ct/Na4BzTouajfFIrGi7B8xO2yLnnJdtnfJHEFodtZBnPe1PWT6Lq3nRpwVk98UiEhHV+1eV2OcPhxsn5COcV mQH789Wo uTVxUBXwvNP5KpxE6uLlyt/iojIS8MYXVvq13fZptBfbnGVBdfUPc3NiopRHYngdgNCr7Q07dZuhhbfk8g2MNra9l4Aahk+I1iZY1dDKkzGJurFQREPIb2KHrJQJOmQlAHm6FdDFiK0CrSH1O4GVmybURKFOURynveE3PjkMgsic6jheJpDxmGheSYyTPzA9Al1Fka9xIUOHirTbmMbaLw1wJ1Se3in5cvoadM7NcoSFgNZeDa32pPB2Fpe1IuUAIQmF4zRwxOIc+pl2DjNVvyDOoOojVcoB3XCaAsqBXKIQBRjilEsFJdzEjGmheuSmQoLyO0XuwZXQFI6NTqhwhPTOWZFD4RekXUqn/5Suf8ye3wbbYbjF8ddVXd5kBvWYnp0MFsKbQpQZqsyAjd/1IWBm9fHNRq4Z2w46ZVnr75ezkHSzml+0M6Zcyb7EovWKXfKE/geEqjv0bjUdnAiIY+a3MuI7SLXqXqC7EJ4bFsGVkvFS8xD+vh3Loqw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
splice, net: Replace sendpage with sendmsg(MSG_SPLICE_PAGES)
|
expand
|
diff --git a/crypto/af_alg.c b/crypto/af_alg.c index 1dafd088ad45..483821e310e9 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c @@ -1031,35 +1031,37 @@ int af_alg_sendmsg(struct socket *sock, struct msghdr *msg, size_t size, if (sgl->cur) sg_unmark_end(sg + sgl->cur - 1); - do { - struct page *pg; - unsigned int i = sgl->cur; + if (1 /* TODO check MSG_SPLICE_PAGES */) { + do { + struct page *pg; + unsigned int i = sgl->cur; - plen = min_t(size_t, len, PAGE_SIZE); + plen = min_t(size_t, len, PAGE_SIZE); - pg = alloc_page(GFP_KERNEL); - if (!pg) { - err = -ENOMEM; - goto unlock; - } + pg = alloc_page(GFP_KERNEL); + if (!pg) { + err = -ENOMEM; + goto unlock; + } - sg_assign_page(sg + i, pg); + sg_assign_page(sg + i, pg); - err = memcpy_from_msg(page_address(sg_page(sg + i)), - msg, plen); - if (err) { - __free_page(sg_page(sg + i)); - sg_assign_page(sg + i, NULL); - goto unlock; - } + err = memcpy_from_msg(page_address(sg_page(sg + i)), + msg, plen); + if (err) { + __free_page(sg_page(sg + i)); + sg_assign_page(sg + i, NULL); + goto unlock; + } - sg[i].length = plen; - len -= plen; - ctx->used += plen; - copied += plen; - size -= plen; - sgl->cur++; - } while (len && sgl->cur < MAX_SGL_ENTS); + sg[i].length = plen; + len -= plen; + ctx->used += plen; + copied += plen; + size -= plen; + sgl->cur++; + } while (len && sgl->cur < MAX_SGL_ENTS); + } if (!size) sg_mark_end(sg + sgl->cur - 1);
Put the loop in af_alg_sendmsg() into an if-statement to indent it to make the next patch easier to review as that will add another branch to handle MSG_SPLICE_PAGES to the if-statement. Signed-off-by: David Howells <dhowells@redhat.com> cc: Herbert Xu <herbert@gondor.apana.org.au> cc: "David S. Miller" <davem@davemloft.net> cc: Eric Dumazet <edumazet@google.com> cc: Jakub Kicinski <kuba@kernel.org> cc: Paolo Abeni <pabeni@redhat.com> cc: Jens Axboe <axboe@kernel.dk> cc: Matthew Wilcox <willy@infradead.org> cc: linux-crypto@vger.kernel.org cc: netdev@vger.kernel.org --- crypto/af_alg.c | 50 +++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-)