* Re: [RFC PATCH 2/2] iov_iter: Drop the X argument from iterate_all_kinds() and use B instead
@ 2021-04-09 23:38 kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-04-09 23:38 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 18625 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <161799186664.847742.14555840742293852768.stgit@warthog.procyon.org.uk>
References: <161799186664.847742.14555840742293852768.stgit@warthog.procyon.org.uk>
TO: David Howells <dhowells@redhat.com>
Hi David,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on next-20210409]
[cannot apply to linus/master v5.12-rc6 v5.12-rc5 v5.12-rc4 v5.12-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/David-Howells/iov_iter-Remove-iov_iter_for_each_range/20210410-021151
base: e99d8a8495175df8cb8b739f8cf9b0fc9d0cd3b5
:::::: branch date: 5 hours ago
:::::: commit date: 5 hours ago
config: microblaze-randconfig-s031-20210409 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-279-g6d5d9b42-dirty
# https://github.com/0day-ci/linux/commit/3a86123438f2aac6764901c8462752f378c958c0
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review David-Howells/iov_iter-Remove-iov_iter_for_each_range/20210410-021151
git checkout 3a86123438f2aac6764901c8462752f378c958c0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=microblaze
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> lib/iov_iter.c:1481:9: sparse: sparse: context imbalance in 'iov_iter_get_pages' - different lock contexts for basic block
>> lib/iov_iter.c:1607:9: sparse: sparse: context imbalance in 'iov_iter_get_pages_alloc' - different lock contexts for basic block
lib/iov_iter.c: note: in included file:
include/net/checksum.h:31:39: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected restricted __wsum [usertype] sum @@ got unsigned int @@
include/net/checksum.h:31:39: sparse: expected restricted __wsum [usertype] sum
include/net/checksum.h:31:39: sparse: got unsigned int
include/net/checksum.h:39:45: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected restricted __wsum [usertype] sum @@ got unsigned int @@
include/net/checksum.h:39:45: sparse: expected restricted __wsum [usertype] sum
include/net/checksum.h:39:45: sparse: got unsigned int
>> lib/iov_iter.c:1818:5: sparse: sparse: context imbalance in 'iov_iter_npages' - different lock contexts for basic block
vim +/iov_iter_get_pages +1481 lib/iov_iter.c
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1480
62a8067a7f35db mm/iov_iter.c Al Viro 2014-04-04 @1481 ssize_t iov_iter_get_pages(struct iov_iter *i,
2c80929c4c4d54 mm/iov_iter.c Miklos Szeredi 2014-09-24 1482 struct page **pages, size_t maxsize, unsigned maxpages,
62a8067a7f35db mm/iov_iter.c Al Viro 2014-04-04 1483 size_t *start)
62a8067a7f35db mm/iov_iter.c Al Viro 2014-04-04 1484 {
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1485 if (maxsize > i->count)
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1486 maxsize = i->count;
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1487
00e23707442a75 lib/iov_iter.c David Howells 2018-10-22 1488 if (unlikely(iov_iter_is_pipe(i)))
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1489 return pipe_get_pages(i, pages, maxsize, maxpages, start);
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1490 if (unlikely(iov_iter_is_xarray(i)))
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1491 return iter_xarray_get_pages(i, pages, maxsize, maxpages, start);
9ea9ce0427aab0 lib/iov_iter.c David Howells 2018-10-20 1492 if (unlikely(iov_iter_is_discard(i)))
9ea9ce0427aab0 lib/iov_iter.c David Howells 2018-10-20 1493 return -EFAULT;
9ea9ce0427aab0 lib/iov_iter.c David Howells 2018-10-20 1494
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1495 iterate_all_kinds(i, maxsize, v, ({
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1496 unsigned long addr = (unsigned long)v.iov_base;
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1497 size_t len = v.iov_len + (*start = addr & (PAGE_SIZE - 1));
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1498 int n;
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1499 int res;
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1500
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1501 if (len > maxpages * PAGE_SIZE)
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1502 len = maxpages * PAGE_SIZE;
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1503 addr &= ~(PAGE_SIZE - 1);
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1504 n = DIV_ROUND_UP(len, PAGE_SIZE);
73b0140bf0fe9d lib/iov_iter.c Ira Weiny 2019-05-13 1505 res = get_user_pages_fast(addr, n,
73b0140bf0fe9d lib/iov_iter.c Ira Weiny 2019-05-13 1506 iov_iter_rw(i) != WRITE ? FOLL_WRITE : 0,
73b0140bf0fe9d lib/iov_iter.c Ira Weiny 2019-05-13 1507 pages);
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1508 if (unlikely(res < 0))
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1509 return res;
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1510 return (res == n ? len : res * PAGE_SIZE) - *start;
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1511 0;}),({
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1512 /* can't be more than PAGE_SIZE */
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1513 *start = v.bv_offset;
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1514 get_page(*pages = v.bv_page);
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1515 return v.bv_len;
a280455fa87053 mm/iov_iter.c Al Viro 2014-11-27 1516 }),({
a280455fa87053 mm/iov_iter.c Al Viro 2014-11-27 1517 return -EFAULT;
3a86123438f2aa lib/iov_iter.c David Howells 2021-04-09 1518 })
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1519 )
e5393fae3b49e8 mm/iov_iter.c Al Viro 2014-11-27 1520 return 0;
62a8067a7f35db mm/iov_iter.c Al Viro 2014-04-04 1521 }
62a8067a7f35db mm/iov_iter.c Al Viro 2014-04-04 1522 EXPORT_SYMBOL(iov_iter_get_pages);
62a8067a7f35db mm/iov_iter.c Al Viro 2014-04-04 1523
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1524 static struct page **get_pages_array(size_t n)
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1525 {
752ade68cbd81d lib/iov_iter.c Michal Hocko 2017-05-08 1526 return kvmalloc_array(n, sizeof(struct page *), GFP_KERNEL);
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1527 }
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1528
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1529 static ssize_t pipe_get_pages_alloc(struct iov_iter *i,
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1530 struct page ***pages, size_t maxsize,
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1531 size_t *start)
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1532 {
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1533 struct page **p;
8cefc107ca54c8 lib/iov_iter.c David Howells 2019-11-15 1534 unsigned int iter_head, npages;
d7760d638b140d lib/iov_iter.c Ilya Dryomov 2018-05-02 1535 ssize_t n;
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1536
33844e665104b1 lib/iov_iter.c Al Viro 2016-12-21 1537 if (!maxsize)
33844e665104b1 lib/iov_iter.c Al Viro 2016-12-21 1538 return 0;
33844e665104b1 lib/iov_iter.c Al Viro 2016-12-21 1539
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1540 if (!sanity(i))
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1541 return -EFAULT;
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1542
8cefc107ca54c8 lib/iov_iter.c David Howells 2019-11-15 1543 data_start(i, &iter_head, start);
8cefc107ca54c8 lib/iov_iter.c David Howells 2019-11-15 1544 /* Amount of free space: some of this one + all after this one */
8cefc107ca54c8 lib/iov_iter.c David Howells 2019-11-15 1545 npages = pipe_space_for_user(iter_head, i->pipe->tail, i->pipe);
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1546 n = npages * PAGE_SIZE - *start;
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1547 if (maxsize > n)
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1548 maxsize = n;
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1549 else
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1550 npages = DIV_ROUND_UP(maxsize + *start, PAGE_SIZE);
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1551 p = get_pages_array(npages);
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1552 if (!p)
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1553 return -ENOMEM;
8cefc107ca54c8 lib/iov_iter.c David Howells 2019-11-15 1554 n = __pipe_get_pages(i, maxsize, p, iter_head, start);
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1555 if (n > 0)
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1556 *pages = p;
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1557 else
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1558 kvfree(p);
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1559 return n;
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1560 }
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1561
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1562 static ssize_t iter_xarray_get_pages_alloc(struct iov_iter *i,
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1563 struct page ***pages, size_t maxsize,
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1564 size_t *_start_offset)
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1565 {
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1566 struct page **p;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1567 unsigned nr, offset;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1568 pgoff_t index, count;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1569 size_t size = maxsize, actual;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1570 loff_t pos;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1571
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1572 if (!size)
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1573 return 0;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1574
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1575 pos = i->xarray_start + i->iov_offset;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1576 index = pos >> PAGE_SHIFT;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1577 offset = pos & ~PAGE_MASK;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1578 *_start_offset = offset;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1579
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1580 count = 1;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1581 if (size > PAGE_SIZE - offset) {
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1582 size -= PAGE_SIZE - offset;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1583 count += size >> PAGE_SHIFT;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1584 size &= ~PAGE_MASK;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1585 if (size)
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1586 count++;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1587 }
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1588
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1589 p = get_pages_array(count);
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1590 if (!p)
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1591 return -ENOMEM;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1592 *pages = p;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1593
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1594 nr = iter_xarray_copy_pages(p, i->xarray, index, count);
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1595 if (nr == 0)
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1596 return 0;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1597
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1598 actual = PAGE_SIZE * nr;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1599 actual -= offset;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1600 if (nr == count && size > 0) {
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1601 unsigned last_offset = (nr > 1) ? 0 : offset;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1602 actual -= PAGE_SIZE - (last_offset + size);
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1603 }
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1604 return actual;
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1605 }
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1606
62a8067a7f35db mm/iov_iter.c Al Viro 2014-04-04 @1607 ssize_t iov_iter_get_pages_alloc(struct iov_iter *i,
62a8067a7f35db mm/iov_iter.c Al Viro 2014-04-04 1608 struct page ***pages, size_t maxsize,
62a8067a7f35db mm/iov_iter.c Al Viro 2014-04-04 1609 size_t *start)
62a8067a7f35db mm/iov_iter.c Al Viro 2014-04-04 1610 {
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1611 struct page **p;
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1612
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1613 if (maxsize > i->count)
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1614 maxsize = i->count;
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1615
00e23707442a75 lib/iov_iter.c David Howells 2018-10-22 1616 if (unlikely(iov_iter_is_pipe(i)))
241699cd72a848 lib/iov_iter.c Al Viro 2016-09-22 1617 return pipe_get_pages_alloc(i, pages, maxsize, start);
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1618 if (unlikely(iov_iter_is_xarray(i)))
788abcfb66c10d lib/iov_iter.c David Howells 2020-02-10 1619 return iter_xarray_get_pages_alloc(i, pages, maxsize, start);
9ea9ce0427aab0 lib/iov_iter.c David Howells 2018-10-20 1620 if (unlikely(iov_iter_is_discard(i)))
9ea9ce0427aab0 lib/iov_iter.c David Howells 2018-10-20 1621 return -EFAULT;
9ea9ce0427aab0 lib/iov_iter.c David Howells 2018-10-20 1622
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1623 iterate_all_kinds(i, maxsize, v, ({
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1624 unsigned long addr = (unsigned long)v.iov_base;
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1625 size_t len = v.iov_len + (*start = addr & (PAGE_SIZE - 1));
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1626 int n;
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1627 int res;
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1628
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1629 addr &= ~(PAGE_SIZE - 1);
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1630 n = DIV_ROUND_UP(len, PAGE_SIZE);
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1631 p = get_pages_array(n);
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1632 if (!p)
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1633 return -ENOMEM;
73b0140bf0fe9d lib/iov_iter.c Ira Weiny 2019-05-13 1634 res = get_user_pages_fast(addr, n,
73b0140bf0fe9d lib/iov_iter.c Ira Weiny 2019-05-13 1635 iov_iter_rw(i) != WRITE ? FOLL_WRITE : 0, p);
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1636 if (unlikely(res < 0)) {
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1637 kvfree(p);
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1638 return res;
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1639 }
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1640 *pages = p;
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1641 return (res == n ? len : res * PAGE_SIZE) - *start;
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1642 0;}),({
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1643 /* can't be more than PAGE_SIZE */
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1644 *start = v.bv_offset;
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1645 *pages = p = get_pages_array(1);
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1646 if (!p)
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1647 return -ENOMEM;
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1648 get_page(*p = v.bv_page);
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1649 return v.bv_len;
a280455fa87053 mm/iov_iter.c Al Viro 2014-11-27 1650 }),({
a280455fa87053 mm/iov_iter.c Al Viro 2014-11-27 1651 return -EFAULT;
3a86123438f2aa lib/iov_iter.c David Howells 2021-04-09 1652 })
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1653 )
1b17f1f2e56a09 mm/iov_iter.c Al Viro 2014-11-27 1654 return 0;
62a8067a7f35db mm/iov_iter.c Al Viro 2014-04-04 1655 }
62a8067a7f35db mm/iov_iter.c Al Viro 2014-04-04 1656 EXPORT_SYMBOL(iov_iter_get_pages_alloc);
62a8067a7f35db mm/iov_iter.c Al Viro 2014-04-04 1657
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29816 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* [RFC PATCH 2/2] iov_iter: Drop the X argument from iterate_all_kinds() and use B instead
2021-04-09 1:24 [PATCH v6 01/30] iov_iter: Add ITER_XARRAY Al Viro
@ 2021-04-09 18:11 ` David Howells
0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2021-04-09 18:11 UTC (permalink / raw)
To: viro
Cc: dhowells, willy, jlayton, hch, linux-mm, linux-fsdevel,
linux-cachefs, v9fs-developer, linux-afs, ceph-devel, linux-cifs,
linux-nfs, linux-kernel
Drop the X argument from iterate_all_kinds() and use the B argument instead
as it's always the same unless the ITER_XARRAY is handled specially.
Signed-off-by: David Howells <dhowells@redhat.com>
---
lib/iov_iter.c | 42 ++++++++++++------------------------------
1 file changed, 12 insertions(+), 30 deletions(-)
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 93e9838c128d..144abdac11db 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -79,8 +79,8 @@
#define iterate_xarray(i, n, __v, skip, STEP) { \
struct page *head = NULL; \
size_t wanted = n, seg, offset; \
- loff_t start = i->xarray_start + skip; \
- pgoff_t index = start >> PAGE_SHIFT; \
+ loff_t xarray_start = i->xarray_start + skip; \
+ pgoff_t index = xarray_start >> PAGE_SHIFT; \
int j; \
\
XA_STATE(xas, i->xarray, index); \
@@ -113,7 +113,7 @@
n = wanted - n; \
}
-#define iterate_all_kinds(i, n, v, I, B, K, X) { \
+#define iterate_all_kinds(i, n, v, I, B, K) { \
if (likely(n)) { \
size_t skip = i->iov_offset; \
if (unlikely(i->type & ITER_BVEC)) { \
@@ -127,7 +127,7 @@
} else if (unlikely(i->type & ITER_DISCARD)) { \
} else if (unlikely(i->type & ITER_XARRAY)) { \
struct bio_vec v; \
- iterate_xarray(i, n, v, skip, (X)); \
+ iterate_xarray(i, n, v, skip, (B)); \
} else { \
const struct iovec *iov; \
struct iovec v; \
@@ -842,9 +842,7 @@ bool _copy_from_iter_full(void *addr, size_t bytes, struct iov_iter *i)
0;}),
memcpy_from_page((to += v.bv_len) - v.bv_len, v.bv_page,
v.bv_offset, v.bv_len),
- memcpy((to += v.iov_len) - v.iov_len, v.iov_base, v.iov_len),
- memcpy_from_page((to += v.bv_len) - v.bv_len, v.bv_page,
- v.bv_offset, v.bv_len)
+ memcpy((to += v.iov_len) - v.iov_len, v.iov_base, v.iov_len)
)
iov_iter_advance(i, bytes);
@@ -927,9 +925,7 @@ bool _copy_from_iter_full_nocache(void *addr, size_t bytes, struct iov_iter *i)
0;}),
memcpy_from_page((to += v.bv_len) - v.bv_len, v.bv_page,
v.bv_offset, v.bv_len),
- memcpy((to += v.iov_len) - v.iov_len, v.iov_base, v.iov_len),
- memcpy_from_page((to += v.bv_len) - v.bv_len, v.bv_page,
- v.bv_offset, v.bv_len)
+ memcpy((to += v.iov_len) - v.iov_len, v.iov_base, v.iov_len)
)
iov_iter_advance(i, bytes);
@@ -1058,9 +1054,7 @@ size_t iov_iter_copy_from_user_atomic(struct page *page,
copyin((p += v.iov_len) - v.iov_len, v.iov_base, v.iov_len),
memcpy_from_page((p += v.bv_len) - v.bv_len, v.bv_page,
v.bv_offset, v.bv_len),
- memcpy((p += v.iov_len) - v.iov_len, v.iov_base, v.iov_len),
- memcpy_from_page((p += v.bv_len) - v.bv_len, v.bv_page,
- v.bv_offset, v.bv_len)
+ memcpy((p += v.iov_len) - v.iov_len, v.iov_base, v.iov_len)
)
kunmap_atomic(kaddr);
return bytes;
@@ -1349,8 +1343,7 @@ unsigned long iov_iter_alignment(const struct iov_iter *i)
iterate_all_kinds(i, size, v,
(res |= (unsigned long)v.iov_base | v.iov_len, 0),
res |= v.bv_offset | v.bv_len,
- res |= (unsigned long)v.iov_base | v.iov_len,
- res |= v.bv_offset | v.bv_len
+ res |= (unsigned long)v.iov_base | v.iov_len
)
return res;
}
@@ -1372,9 +1365,7 @@ unsigned long iov_iter_gap_alignment(const struct iov_iter *i)
(res |= (!res ? 0 : (unsigned long)v.bv_offset) |
(size != v.bv_len ? size : 0)),
(res |= (!res ? 0 : (unsigned long)v.iov_base) |
- (size != v.iov_len ? size : 0)),
- (res |= (!res ? 0 : (unsigned long)v.bv_offset) |
- (size != v.bv_len ? size : 0))
+ (size != v.iov_len ? size : 0))
);
return res;
}
@@ -1530,8 +1521,7 @@ ssize_t iov_iter_get_pages(struct iov_iter *i,
return v.bv_len;
}),({
return -EFAULT;
- }),
- 0
+ })
)
return 0;
}
@@ -1665,7 +1655,7 @@ ssize_t iov_iter_get_pages_alloc(struct iov_iter *i,
return v.bv_len;
}),({
return -EFAULT;
- }), 0
+ })
)
return 0;
}
@@ -1751,13 +1741,6 @@ bool csum_and_copy_from_iter_full(void *addr, size_t bytes, __wsum *csum,
v.iov_base, v.iov_len,
sum, off);
off += v.iov_len;
- }), ({
- char *p = kmap_atomic(v.bv_page);
- sum = csum_and_memcpy((to += v.bv_len) - v.bv_len,
- p + v.bv_offset, v.bv_len,
- sum, off);
- kunmap_atomic(p);
- off += v.bv_len;
})
)
*csum = sum;
@@ -1892,8 +1875,7 @@ int iov_iter_npages(const struct iov_iter *i, int maxpages)
- p / PAGE_SIZE;
if (npages >= maxpages)
return maxpages;
- }),
- 0
+ })
)
return npages;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-09 23:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 23:38 [RFC PATCH 2/2] iov_iter: Drop the X argument from iterate_all_kinds() and use B instead kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2021-04-09 1:24 [PATCH v6 01/30] iov_iter: Add ITER_XARRAY Al Viro
2021-04-09 18:11 ` [RFC PATCH 2/2] iov_iter: Drop the X argument from iterate_all_kinds() and use B instead David Howells
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.