From patchwork Mon Jul 29 16:19:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13745447 Return-Path: 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 D8F3CC3DA4A for ; Mon, 29 Jul 2024 16:23:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6BF746B0092; Mon, 29 Jul 2024 12:23:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 65E716B00A8; Mon, 29 Jul 2024 12:23:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D8286B00AB; Mon, 29 Jul 2024 12:23:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 2DAB56B0092 for ; Mon, 29 Jul 2024 12:23:25 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E8407A40D4 for ; Mon, 29 Jul 2024 16:23:24 +0000 (UTC) X-FDA: 82393310328.22.314BC74 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 4D11F16001A for ; Mon, 29 Jul 2024 16:23:23 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=e8iEbgOX; spf=pass (imf08.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1722270132; 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=R2k6li9/r5cEcbpMZCeQm71pTBPmJTS708jWII1Wsr4=; b=M2oS0WsYEGtO7aKcEbCJXeGr7v0Ym4fbr2eeexFcPw7vkd8cikUsk+4ENYnUisJ6/ITxi8 VVPwytQEVgwIn79wcfvjfOxFnfUweLLVuQeT+VcV2DcBlwbMio3UxN225TXJTKzZuCJkn0 CABjY2BBaBXdmB5rPocm2D8v/anMYLU= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=e8iEbgOX; spf=pass (imf08.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1722270132; a=rsa-sha256; cv=none; b=HzTJm2aY05xS/u0N3rYxBazS36lErezX7WslnqVvI6s4YrzdVZrUSQNJODMd9KT7QrRYq5 v11c6ek2zT97a9kOCg0m87sR3xIZrVg0mMlKoT0/I30gZIJSiblw86UfNFrgEF6nb1/k18 u/DDysYwFxQTwaYzfklkeveoVqWhExs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722270202; 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=R2k6li9/r5cEcbpMZCeQm71pTBPmJTS708jWII1Wsr4=; b=e8iEbgOXrb7mIBMektgSe2j/rMtDyFTuzn82yNscpFjAGfLNc8a9QnUm1u7GAchEnyVj8/ ZO94x27QoA2vTOhqlBb7Szk/XSO7S8+2c0ic4izyJUd8U5VrhbOHyW9ZAXMWG9fpEsZ4mN Ih4eM1taE8XyEhexWpGc2KzSkYaWktE= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-281-ggb6HApwM0-NT275O_fz1g-1; Mon, 29 Jul 2024 12:23:20 -0400 X-MC-Unique: ggb6HApwM0-NT275O_fz1g-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 744701955D47; Mon, 29 Jul 2024 16:23:12 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.216]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 29B481955D42; Mon, 29 Jul 2024 16:23:05 +0000 (UTC) From: David Howells To: Christian Brauner , Steve French , Matthew Wilcox Cc: David Howells , Jeff Layton , Gao Xiang , Dominique Martinet , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , netfs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Steve French , Enzo Matsumiya Subject: [PATCH 24/24] cifs: Don't support ITER_XARRAY Date: Mon, 29 Jul 2024 17:19:53 +0100 Message-ID: <20240729162002.3436763-25-dhowells@redhat.com> In-Reply-To: <20240729162002.3436763-1-dhowells@redhat.com> References: <20240729162002.3436763-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 4D11F16001A X-Stat-Signature: 7kj1w1586hqenpapiyyeixbtbetbgd33 X-Rspam-User: X-HE-Tag: 1722270203-294957 X-HE-Meta: U2FsdGVkX1/X36MvJ/Ih7WqGz77k42pRVU8gSJXfDobAtWvPvvqm2VHG6j+ddHMLsw3D34NUnOHgPKeO7d0WpG5HQclH5aDJzvnlIuFOTrAubemxO2W+QaF0Zl6nMFAZ5UGhnIttQv4J6Qz666hktXrvLrWdUTN/+ZE16mYg7GnO3sM6ryTjxUfdWXIVsS/rcAm5PANUNrz9zsVn9xPQ1B9BnpZ7kUlVGEgejGOnDq/Ot5p2sqlnat/nghMohK0cxvC1hO5qsjMs4shynJMnLrYS4rOKvzE72F37bu2jBntKjUBe4gwjDLCg0748O9+pnXBusri3N1Wm+THH84JGs32kDF4J2ZfIx3CQxW91GDsPIk2DTbU9ZT4uNEVuzo9pxXbUm432w0JLwnIiySwFg0RHv4/C8IsFVtul9QjuZ9cY6IUf6Sw7Zw+p27rlR+Dc4xmvZnMIqmNHfngjaWYkPbzadwREiE86iaEbTS7qtUzMWCqYtdF7TDgkn1wLEzNJ1LeTs0Cf2YxFpYz3FS11yPSWm4VBneCreH6RQsU38mEOaNjprdpE89ZBczGNhkOpnYE7gI12i3NodfCE5GRfeiDBptzC5FVbaiWF4xbkcaDrERGIWcNsH7z2p/zn8ElC3KG7QCatASbUZh7EniZCgWPy9HOS4q3C7nfVpC/5amh4xhpoNXt/LYde1Lqe5Q6JW4ikNaI8X1RPqTEDrzDUBHhvV92UtFy9yVH6utfXhHXZZ5Z0nKu4qGY5vp8vDBDV2Is9KjnVAo8hRnDE4ZNaBeZ6uBWZX8GQo62FmK1Dx/hUefJsa/K3miSDO7EIlPwB3zzB9CTZhAVZ9blujARvfU/hw1R5FYWicLQmlYJU0eWXZbmIYSuf0S0evSYT1jWxSn0Da8uhzUgZVqqRFxdzJXyXoa2Q/6D3CTNgyQd9O5vFY0WPkGL4deJfPzdOnOoHd9Agzpf1sUJBwfir1Ls eeYBZICa 5vJnMtFM0SWePJA1MNSJ+fB1qSSZDBEW3GRlHkQDPDdyQrfYKqOZPbmx5IPST6ldytM3XfeOKet5x9K78J0O3YvkiDrZQGjBrmgTFVpY6Xze96Cbz3SAD4hZuRx9e6kt0Js4C/VV/s2mAw1e07UmYIj5VovtCYIQfbKMIS4MHz/SbYOaLQYRaIIWIKtldkp57jUYfedOQKsJykH2sV62vf7qlIAgPE9DmvQ1JlH7BAGrzZc9GQ7mysTcWTUqGygcZT/4tddrl9PlSUJ99RTYqzLFHLGwUfPuwsJGvvBXi7xm7lEj8TKYmxupnd/gXZansNQR2g71uZgpPELA1b6+6wceBQKJ8MP6xGdSVgFUUEjgpWm4U09CtJeiSCp1S0M8/JtAplSO21icwL4x084wfmjjI4R4GtvsCLHFtwwadVoVouZrIUmLT8DSHMRpUrN/VMiZAEawcd1i2NXfpYdRda0XbHKoWOVX+VNYnFqQ2dif+QqfEoHADJvcvbiFTZz4PyPrmSw1rFEvTsTZ81DmlEwBY1cMiUOi5kaDAVVEF1ImoGQJWLek+qLyqcjTqGdfhiUfhF8JuXX+wfjQ= 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: List-Subscribe: List-Unsubscribe: There's now no need to support ITER_XARRAY in cifs as netfslib hands down ITER_FOLIOQ instead - and that's simpler to use with iterate_and_advance() as it doesn't hold the RCU read lock over the step function. This is part of the process of phasing out ITER_XARRAY. Signed-off-by: David Howells cc: Steve French cc: Paulo Alcantara cc: Tom Talpey cc: Enzo Matsumiya cc: linux-cifs@vger.kernel.org --- fs/smb/client/cifsencrypt.c | 51 ------------------------------------- fs/smb/client/smbdirect.c | 49 ----------------------------------- 2 files changed, 100 deletions(-) diff --git a/fs/smb/client/cifsencrypt.c b/fs/smb/client/cifsencrypt.c index 991a1ab047e7..7481b21a0489 100644 --- a/fs/smb/client/cifsencrypt.c +++ b/fs/smb/client/cifsencrypt.c @@ -25,54 +25,6 @@ #include "../common/arc4.h" #include -/* - * Hash data from an XARRAY-type iterator. - */ -static ssize_t cifs_shash_xarray(const struct iov_iter *iter, ssize_t maxsize, - struct shash_desc *shash) -{ - struct folio *folios[16], *folio; - unsigned int nr, i, j, npages; - loff_t start = iter->xarray_start + iter->iov_offset; - pgoff_t last, index = start / PAGE_SIZE; - ssize_t ret = 0; - size_t len, offset, foffset; - void *p; - - if (maxsize == 0) - return 0; - - last = (start + maxsize - 1) / PAGE_SIZE; - do { - nr = xa_extract(iter->xarray, (void **)folios, index, last, - ARRAY_SIZE(folios), XA_PRESENT); - if (nr == 0) - return -EIO; - - for (i = 0; i < nr; i++) { - folio = folios[i]; - npages = folio_nr_pages(folio); - foffset = start - folio_pos(folio); - offset = foffset % PAGE_SIZE; - for (j = foffset / PAGE_SIZE; j < npages; j++) { - len = min_t(size_t, maxsize, PAGE_SIZE - offset); - p = kmap_local_page(folio_page(folio, j)); - ret = crypto_shash_update(shash, p, len); - kunmap_local(p); - if (ret < 0) - return ret; - maxsize -= len; - if (maxsize <= 0) - return 0; - start += len; - offset = 0; - index++; - } - } - } while (nr == ARRAY_SIZE(folios)); - return 0; -} - static size_t cifs_shash_step(void *iter_base, size_t progress, size_t len, void *priv, void *priv2) { @@ -96,9 +48,6 @@ static int cifs_shash_iter(const struct iov_iter *iter, size_t maxsize, struct iov_iter tmp_iter = *iter; int err = -EIO; - if (iov_iter_type(iter) == ITER_XARRAY) - return cifs_shash_xarray(iter, maxsize, shash); - if (iterate_and_advance_kernel(&tmp_iter, maxsize, shash, &err, cifs_shash_step) != maxsize) return err; diff --git a/fs/smb/client/smbdirect.c b/fs/smb/client/smbdirect.c index 52acead63d9d..ee63c570d505 100644 --- a/fs/smb/client/smbdirect.c +++ b/fs/smb/client/smbdirect.c @@ -2584,52 +2584,6 @@ static ssize_t smb_extract_folioq_to_rdma(struct iov_iter *iter, return ret; } -/* - * Extract folio fragments from an XARRAY-class iterator and add them to an - * RDMA list. The folios are not pinned. - */ -static ssize_t smb_extract_xarray_to_rdma(struct iov_iter *iter, - struct smb_extract_to_rdma *rdma, - ssize_t maxsize) -{ - struct xarray *xa = iter->xarray; - struct folio *folio; - loff_t start = iter->xarray_start + iter->iov_offset; - pgoff_t index = start / PAGE_SIZE; - ssize_t ret = 0; - size_t off, len; - XA_STATE(xas, xa, index); - - rcu_read_lock(); - - xas_for_each(&xas, folio, ULONG_MAX) { - if (xas_retry(&xas, folio)) - continue; - if (WARN_ON(xa_is_value(folio))) - break; - if (WARN_ON(folio_test_hugetlb(folio))) - break; - - off = offset_in_folio(folio, start); - len = min_t(size_t, maxsize, folio_size(folio) - off); - - if (!smb_set_sge(rdma, folio_page(folio, 0), off, len)) { - rcu_read_unlock(); - return -EIO; - } - - maxsize -= len; - ret += len; - if (rdma->nr_sge >= rdma->max_sge || maxsize <= 0) - break; - } - - rcu_read_unlock(); - if (ret > 0) - iov_iter_advance(iter, ret); - return ret; -} - /* * Extract page fragments from up to the given amount of the source iterator * and build up an RDMA list that refers to all of those bits. The RDMA list @@ -2657,9 +2611,6 @@ static ssize_t smb_extract_iter_to_rdma(struct iov_iter *iter, size_t len, case ITER_FOLIOQ: ret = smb_extract_folioq_to_rdma(iter, rdma, len); break; - case ITER_XARRAY: - ret = smb_extract_xarray_to_rdma(iter, rdma, len); - break; default: WARN_ON_ONCE(1); return -EIO;