From patchwork Wed Aug 14 20:38:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13764107 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 22CFBC3DA4A for ; Wed, 14 Aug 2024 20:42:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A839D6B00C0; Wed, 14 Aug 2024 16:42:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A33536B00C2; Wed, 14 Aug 2024 16:42:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8AC826B00C3; Wed, 14 Aug 2024 16:42:18 -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 6AEA36B00C0 for ; Wed, 14 Aug 2024 16:42:18 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1F077140D6D for ; Wed, 14 Aug 2024 20:42:18 +0000 (UTC) X-FDA: 82452023556.28.850F3D0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 6161BA0002 for ; Wed, 14 Aug 2024 20:42:16 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="IwZ7L/gQ"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf25.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723668083; a=rsa-sha256; cv=none; b=TUohXBS2Bb5kclpaTjcA7aDA42vVCXNfBWLlvmScK1l9s2a4aLnuddln0jHjAz6PHq1mG7 Xyn8whZZ+TYrCvkwecY4NaRAGmSdmpFgqkkq9HcRxLxx/gSaxx9lJ+jBpLsdo+Ttmn4v47 vrMFuSyfCmwzpPXAXx0YznkldXVv2Tw= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="IwZ7L/gQ"; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf25.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723668083; 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=G4MNzaMiFDukGg48jovETePA3npABSpoRCz9c88nf5g=; b=oub2YxkfSD0HYN7HZz11T+tCVQ4kqfc6P3fXxEOJvktWmy4E+/WurAXCdAiiDT/6DvFVlZ VOCQhYs83It+VIF4x1qiDJHuNaREjRLny5kIOEvxATEmWdJja5rtSCcblRgB+soKA2LcBC 3G93IRUgsvwqGCkkCOrfko7rjfrRfHs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723668135; 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=G4MNzaMiFDukGg48jovETePA3npABSpoRCz9c88nf5g=; b=IwZ7L/gQG9rokjh/Nh4CF4gDfwPFIv4tUePx4Wgh5Db7mi1qOVtopyVTipTuzwDxfW0s+4 +fa25mwdhy1YmVihkz5jj5fw4V15DZPjoRia0dEYyW3hRgS1XtNCRhKCLd+n3+GJEjAEeu YHRPrUnY628jEHkKG/T2UKt+F1FCbeM= Received: from mx-prod-mc-01.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-497-k4Nb6-ZQNa-w-MVZAByrPQ-1; Wed, 14 Aug 2024 16:42:11 -0400 X-MC-Unique: k4Nb6-ZQNa-w-MVZAByrPQ-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 97CAC1954B0F; Wed, 14 Aug 2024 20:42:08 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.30]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9B2041955F66; Wed, 14 Aug 2024 20:42:02 +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 v2 25/25] cifs: Don't support ITER_XARRAY Date: Wed, 14 Aug 2024 21:38:45 +0100 Message-ID: <20240814203850.2240469-26-dhowells@redhat.com> In-Reply-To: <20240814203850.2240469-1-dhowells@redhat.com> References: <20240814203850.2240469-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Rspamd-Queue-Id: 6161BA0002 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: dmpjsifg8buep5ounfd3oyuy5rqmt7p8 X-HE-Tag: 1723668136-699585 X-HE-Meta: U2FsdGVkX1/OeKr6dCfdBBNi7vJ1bkutoHceuk5mDsETh+zVffD3mcfulBkBdsS0IQM34KNtD7PnhP9HMfH4ceApnhWjjiP2lpoOvkerEQhDxW6ucyiAnjMrBBQo33cX1V4+YrqStmaKEZEgu2rcbo37h5kn+xNXKbx35BRfDgmADOnE+7KH/jEe+mrm5DCbWTwjOHGg26TOfCxCpbu/tCYAxzB8lWQXYOzyYUhHQRSnVYpUNYjZNMwhGul35zfqm4oefMdSrwBAFd18f4LAsxstFSGykOSFmNQNzD3rNxb+ycKpTVwLKPUrRO5J1KXyI5OAtnvVhQ+W0YFWZZgD61+E5HlIJLiCIYpXKntEsiRQeoEHn2gPC7DYYHgoj9s9AyvfIrtUrNTCTu5kkTNbTl+11LyTaJ0zNTy1vQb7jr+kWRBE7PFMtoEbrVccMgxKwIMrSJb1jcTdowVtwAMIp2FIdXuDKJmWYZ2VHj1tBmSOPqqpjjCB9U96AYZ2nJKzkzU/X/dMdkvSGDmhq5MNhtrVs/Kz2wNY2I1ujZaZDWwDj4ltDrIpJ/4b99LW3wRZaMvTO/RysDWAZ5yrwCAl1qwInQcjAnlRXPw4BNaLcwifWv3INWppJ5gkKStIO5PJndeusUrQkef16d3hEAUKl9Q/JAnNZzcqVd9T27hE2v4/KDFcvVJMl+rP+aEEtJoU7I5pVjsVif5JZYqQlmF5Bbl0E1+2wUsD6QdOyOUTia3NvO8Dk/TCeGx+VY2VA0jaqhOrNdgASI6Qno7SJ68xIfF63TTW5IiEwU8iAqjIVJmejylZYLvCCPrbih4gidu1+IJ8V6nJ0+81syfJWvEbFc8Teg03tNGGcQjejXwfut3lFHyPMycWuzj+cXzKag4XOPEgUyZ3XpSg5atoRQa7pmKSk/lr5bpoooDaCAtBOHfJibVTsAbBbPrTero0EJov4JokyfUhMGYUPFKCyOg xFRJZpOf aWX6fhKVyUFWpbjRKr5qaZquY4CPyxKLZQeBUgni36MQej4quMBO6iQLmLInT9a8YmL6Bc53zjkTyCU++kzk9TmzpIaorjFtpBnDi4fW1nI+2iTfno34NuWFfe6yd5xQj6XRpt7izK3hKTwlCn++oZXD669LpmowxBD7bPxaXLREp8mS6ZYS8sTYuzDAZ1ZC8JNRW6U1jcqdDlJ+rdBn3DqmoahR5fULh2RKkGwg6w4odEunUXZij2VQUOTlx3TPxLEVNphTQeTnKeqaiKAouQTKoWxEfEM+cGrap0dQ+Py/l5a+1rI17Nnd2ysigW1GQaWLGhD92iEdNq0QYDHqDonTglorqqdjCt3u+ahmJoKDPjvnLte8UwkjOJ/svQ7v/vTXlmU95r7StoJA6UKrS0dMGgEcuK2MF3yT5wTkdMBei84AlYYky5BgDEHNQT8VekasWEkBEPcaKDLkcR7tvrzKfBp8ToDSI4K79Z2tQA4Yx4idCvWx6SmOrPZDV3IKan6IHqQjJQfhXQP4mreYZsWXrJjOi0/NnLqsPXrZ4s5KmQilnJhNGBwFgRa6Rv/LeZVTwvP/n8oe9RKA= 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 c946b38ca825..80262a36030f 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;