Skip to content

Commit 4aa571d

Browse files
dhowellsbrauner
authored andcommitted
cifs: Don't support ITER_XARRAY
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 <[email protected]> cc: Steve French <[email protected]> cc: Paulo Alcantara <[email protected]> cc: Tom Talpey <[email protected]> cc: Enzo Matsumiya <[email protected]> cc: [email protected] Link: https://lore.kernel.org/r/[email protected]/ # v2 Signed-off-by: Christian Brauner <[email protected]>
1 parent a2906d3 commit 4aa571d

File tree

2 files changed

+0
-100
lines changed

2 files changed

+0
-100
lines changed

fs/smb/client/cifsencrypt.c

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -25,54 +25,6 @@
2525
#include "../common/arc4.h"
2626
#include <crypto/aead.h>
2727

28-
/*
29-
* Hash data from an XARRAY-type iterator.
30-
*/
31-
static ssize_t cifs_shash_xarray(const struct iov_iter *iter, ssize_t maxsize,
32-
struct shash_desc *shash)
33-
{
34-
struct folio *folios[16], *folio;
35-
unsigned int nr, i, j, npages;
36-
loff_t start = iter->xarray_start + iter->iov_offset;
37-
pgoff_t last, index = start / PAGE_SIZE;
38-
ssize_t ret = 0;
39-
size_t len, offset, foffset;
40-
void *p;
41-
42-
if (maxsize == 0)
43-
return 0;
44-
45-
last = (start + maxsize - 1) / PAGE_SIZE;
46-
do {
47-
nr = xa_extract(iter->xarray, (void **)folios, index, last,
48-
ARRAY_SIZE(folios), XA_PRESENT);
49-
if (nr == 0)
50-
return -EIO;
51-
52-
for (i = 0; i < nr; i++) {
53-
folio = folios[i];
54-
npages = folio_nr_pages(folio);
55-
foffset = start - folio_pos(folio);
56-
offset = foffset % PAGE_SIZE;
57-
for (j = foffset / PAGE_SIZE; j < npages; j++) {
58-
len = min_t(size_t, maxsize, PAGE_SIZE - offset);
59-
p = kmap_local_page(folio_page(folio, j));
60-
ret = crypto_shash_update(shash, p, len);
61-
kunmap_local(p);
62-
if (ret < 0)
63-
return ret;
64-
maxsize -= len;
65-
if (maxsize <= 0)
66-
return 0;
67-
start += len;
68-
offset = 0;
69-
index++;
70-
}
71-
}
72-
} while (nr == ARRAY_SIZE(folios));
73-
return 0;
74-
}
75-
7628
static size_t cifs_shash_step(void *iter_base, size_t progress, size_t len,
7729
void *priv, void *priv2)
7830
{
@@ -96,9 +48,6 @@ static int cifs_shash_iter(const struct iov_iter *iter, size_t maxsize,
9648
struct iov_iter tmp_iter = *iter;
9749
int err = -EIO;
9850

99-
if (iov_iter_type(iter) == ITER_XARRAY)
100-
return cifs_shash_xarray(iter, maxsize, shash);
101-
10251
if (iterate_and_advance_kernel(&tmp_iter, maxsize, shash, &err,
10352
cifs_shash_step) != maxsize)
10453
return err;

fs/smb/client/smbdirect.c

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,52 +2584,6 @@ static ssize_t smb_extract_folioq_to_rdma(struct iov_iter *iter,
25842584
return ret;
25852585
}
25862586

2587-
/*
2588-
* Extract folio fragments from an XARRAY-class iterator and add them to an
2589-
* RDMA list. The folios are not pinned.
2590-
*/
2591-
static ssize_t smb_extract_xarray_to_rdma(struct iov_iter *iter,
2592-
struct smb_extract_to_rdma *rdma,
2593-
ssize_t maxsize)
2594-
{
2595-
struct xarray *xa = iter->xarray;
2596-
struct folio *folio;
2597-
loff_t start = iter->xarray_start + iter->iov_offset;
2598-
pgoff_t index = start / PAGE_SIZE;
2599-
ssize_t ret = 0;
2600-
size_t off, len;
2601-
XA_STATE(xas, xa, index);
2602-
2603-
rcu_read_lock();
2604-
2605-
xas_for_each(&xas, folio, ULONG_MAX) {
2606-
if (xas_retry(&xas, folio))
2607-
continue;
2608-
if (WARN_ON(xa_is_value(folio)))
2609-
break;
2610-
if (WARN_ON(folio_test_hugetlb(folio)))
2611-
break;
2612-
2613-
off = offset_in_folio(folio, start);
2614-
len = min_t(size_t, maxsize, folio_size(folio) - off);
2615-
2616-
if (!smb_set_sge(rdma, folio_page(folio, 0), off, len)) {
2617-
rcu_read_unlock();
2618-
return -EIO;
2619-
}
2620-
2621-
maxsize -= len;
2622-
ret += len;
2623-
if (rdma->nr_sge >= rdma->max_sge || maxsize <= 0)
2624-
break;
2625-
}
2626-
2627-
rcu_read_unlock();
2628-
if (ret > 0)
2629-
iov_iter_advance(iter, ret);
2630-
return ret;
2631-
}
2632-
26332587
/*
26342588
* Extract page fragments from up to the given amount of the source iterator
26352589
* 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,
26572611
case ITER_FOLIOQ:
26582612
ret = smb_extract_folioq_to_rdma(iter, rdma, len);
26592613
break;
2660-
case ITER_XARRAY:
2661-
ret = smb_extract_xarray_to_rdma(iter, rdma, len);
2662-
break;
26632614
default:
26642615
WARN_ON_ONCE(1);
26652616
return -EIO;

0 commit comments

Comments
 (0)