* Re: [RFC PATCH v4 05/17] iomap: Add gfp parameter to iomap_page_create()
@ 2022-05-22 15:22 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2022-05-22 15:22 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 24131 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220520183646.2002023-6-shr@fb.com>
References: <20220520183646.2002023-6-shr@fb.com>
TO: Stefan Roesch <shr@fb.com>
Hi Stefan,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on 0cdd776ec92c0fec768c7079331804d3e52d4b27]
url: https://github.com/intel-lab-lkp/linux/commits/Stefan-Roesch/io-uring-xfs-support-async-buffered-writes/20220521-024152
base: 0cdd776ec92c0fec768c7079331804d3e52d4b27
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: x86_64-randconfig-c007 (https://download.01.org/0day-ci/archive/20220522/202205222333.0epqETHu-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 1443dbaba6f0e57be066995db9164f89fb57b413)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/cdb87406db4bfab0740dbd3950e9b39feed41f5e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Stefan-Roesch/io-uring-xfs-support-async-buffered-writes/20220521-024152
git checkout cdb87406db4bfab0740dbd3950e9b39feed41f5e
# save the config file
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
45 warnings generated.
Suppressed 45 warnings (45 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
34 warnings generated.
Suppressed 34 warnings (34 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
34 warnings generated.
Suppressed 34 warnings (34 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
25 warnings generated.
drivers/pps/sysfs.c:26:9: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
return sprintf(buf, "%lld.%09d#%d\n",
^~~~~~~
drivers/pps/sysfs.c:26:9: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11
return sprintf(buf, "%lld.%09d#%d\n",
^~~~~~~
drivers/pps/sysfs.c:40:9: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
return sprintf(buf, "%lld.%09d#%d\n",
^~~~~~~
drivers/pps/sysfs.c:40:9: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11
return sprintf(buf, "%lld.%09d#%d\n",
^~~~~~~
drivers/pps/sysfs.c:51:9: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
return sprintf(buf, "%4x\n", pps->info.mode);
^~~~~~~
drivers/pps/sysfs.c:51:9: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11
return sprintf(buf, "%4x\n", pps->info.mode);
^~~~~~~
drivers/pps/sysfs.c:60:9: warning: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
return sprintf(buf, "%d\n", !!pps->info.echo);
^~~~~~~
drivers/pps/sysfs.c:60:9: note: Call to function 'sprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11
return sprintf(buf, "%d\n", !!pps->info.echo);
^~~~~~~
drivers/pps/sysfs.c:69:9: warning: Call to function 'sprintf' is insecure as it does not provide bounding of the memory buffer or security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
return sprintf(buf, "%s\n", pps->info.name);
^~~~~~~
drivers/pps/sysfs.c:69:9: note: Call to function 'sprintf' is insecure as it does not provide bounding of the memory buffer or security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11
return sprintf(buf, "%s\n", pps->info.name);
^~~~~~~
drivers/pps/sysfs.c:78:9: warning: Call to function 'sprintf' is insecure as it does not provide bounding of the memory buffer or security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
return sprintf(buf, "%s\n", pps->info.path);
^~~~~~~
drivers/pps/sysfs.c:78:9: note: Call to function 'sprintf' is insecure as it does not provide bounding of the memory buffer or security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'sprintf_s' in case of C11
return sprintf(buf, "%s\n", pps->info.path);
^~~~~~~
Suppressed 19 warnings (19 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
50 warnings generated.
fs/iomap/buffered-io.c:235:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memcpy(addr, iomap->inline_data, size);
^
include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
#define memcpy(p, q, s) __fortify_memcpy_chk(p, q, s, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:362:2: note: expanded from macro '__fortify_memcpy_chk'
__underlying_##op(p, q, __fortify_size); \
^~~~~~~~~~~~~~~~~
note: expanded from here
include/linux/fortify-string.h:45:29: note: expanded from macro '__underlying_memcpy'
#define __underlying_memcpy __builtin_memcpy
^~~~~~~~~~~~~~~~
fs/iomap/buffered-io.c:235:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(addr, iomap->inline_data, size);
^
include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
#define memcpy(p, q, s) __fortify_memcpy_chk(p, q, s, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:362:2: note: expanded from macro '__fortify_memcpy_chk'
__underlying_##op(p, q, __fortify_size); \
^~~~~~~~~~~~~~~~~
note: expanded from here
include/linux/fortify-string.h:45:29: note: expanded from macro '__underlying_memcpy'
#define __underlying_memcpy __builtin_memcpy
^~~~~~~~~~~~~~~~
fs/iomap/buffered-io.c:236:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memset(addr + size, 0, PAGE_SIZE - poff - size);
^
include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
#define memset(p, c, s) __fortify_memset_chk(p, c, s, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:265:2: note: expanded from macro '__fortify_memset_chk'
__underlying_memset(p, c, __fortify_size); \
^~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:47:29: note: expanded from macro '__underlying_memset'
#define __underlying_memset __builtin_memset
^~~~~~~~~~~~~~~~
fs/iomap/buffered-io.c:236:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
memset(addr + size, 0, PAGE_SIZE - poff - size);
^
include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
#define memset(p, c, s) __fortify_memset_chk(p, c, s, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:265:2: note: expanded from macro '__fortify_memset_chk'
__underlying_memset(p, c, __fortify_size); \
^~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:47:29: note: expanded from macro '__underlying_memset'
#define __underlying_memset __builtin_memset
^~~~~~~~~~~~~~~~
>> fs/iomap/buffered-io.c:554:21: warning: Value stored to 'iop' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct iomap_page *iop = to_iomap_page(folio);
^~~ ~~~~~~~~~~~~~~~~~~~~
fs/iomap/buffered-io.c:554:21: note: Value stored to 'iop' during its initialization is never read
struct iomap_page *iop = to_iomap_page(folio);
^~~ ~~~~~~~~~~~~~~~~~~~~
fs/iomap/buffered-io.c:697:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memcpy(iomap_inline_data(iomap, pos), addr, copied);
^
include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
#define memcpy(p, q, s) __fortify_memcpy_chk(p, q, s, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:362:2: note: expanded from macro '__fortify_memcpy_chk'
__underlying_##op(p, q, __fortify_size); \
^~~~~~~~~~~~~~~~~
note: expanded from here
include/linux/fortify-string.h:45:29: note: expanded from macro '__underlying_memcpy'
#define __underlying_memcpy __builtin_memcpy
^~~~~~~~~~~~~~~~
fs/iomap/buffered-io.c:697:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(iomap_inline_data(iomap, pos), addr, copied);
^
include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
#define memcpy(p, q, s) __fortify_memcpy_chk(p, q, s, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:362:2: note: expanded from macro '__fortify_memcpy_chk'
__underlying_##op(p, q, __fortify_size); \
^~~~~~~~~~~~~~~~~
note: expanded from here
include/linux/fortify-string.h:45:29: note: expanded from macro '__underlying_memcpy'
#define __underlying_memcpy __builtin_memcpy
^~~~~~~~~~~~~~~~
Suppressed 46 warnings (46 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
115 warnings generated.
drivers/usb/early/xhci-dbc.c:204:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memset(seg->trbs, 0, PAGE_SIZE);
^
include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
#define memset(p, c, s) __fortify_memset_chk(p, c, s, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:265:2: note: expanded from macro '__fortify_memset_chk'
__underlying_memset(p, c, __fortify_size); \
^~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:47:29: note: expanded from macro '__underlying_memset'
#define __underlying_memset __builtin_memset
^~~~~~~~~~~~~~~~
drivers/usb/early/xhci-dbc.c:204:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
memset(seg->trbs, 0, PAGE_SIZE);
^
include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
#define memset(p, c, s) __fortify_memset_chk(p, c, s, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:265:2: note: expanded from macro '__fortify_memset_chk'
__underlying_memset(p, c, __fortify_size); \
^~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:47:29: note: expanded from macro '__underlying_memset'
#define __underlying_memset __builtin_memset
^~~~~~~~~~~~~~~~
drivers/usb/early/xhci-dbc.c:241:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memset(xdbc.table_base, 0, PAGE_SIZE);
^
include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
#define memset(p, c, s) __fortify_memset_chk(p, c, s, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:265:2: note: expanded from macro '__fortify_memset_chk'
__underlying_memset(p, c, __fortify_size); \
^~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:47:29: note: expanded from macro '__underlying_memset'
#define __underlying_memset __builtin_memset
^~~~~~~~~~~~~~~~
drivers/usb/early/xhci-dbc.c:241:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
memset(xdbc.table_base, 0, PAGE_SIZE);
^
include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
#define memset(p, c, s) __fortify_memset_chk(p, c, s, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:265:2: note: expanded from macro '__fortify_memset_chk'
__underlying_memset(p, c, __fortify_size); \
^~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:47:29: note: expanded from macro '__underlying_memset'
#define __underlying_memset __builtin_memset
^~~~~~~~~~~~~~~~
drivers/usb/early/xhci-dbc.c:242:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
memset(xdbc.out_buf, 0, PAGE_SIZE);
^
include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
#define memset(p, c, s) __fortify_memset_chk(p, c, s, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:265:2: note: expanded from macro '__fortify_memset_chk'
__underlying_memset(p, c, __fortify_size); \
^~~~~~~~~~~~~~~~~~~
include/linux/fortify-string.h:47:29: note: expanded from macro '__underlying_memset'
#define __underlying_memset __builtin_memset
^~~~~~~~~~~~~~~~
drivers/usb/early/xhci-dbc.c:242:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
memset(xdbc.out_buf, 0, PAGE_SIZE);
^
include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
#define memset(p, c, s) __fortify_memset_chk(p, c, s, \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/iop +554 fs/iomap/buffered-io.c
afc51aaa22f26c Darrick J. Wong 2019-07-15 549
fad0a1ab34f777 Christoph Hellwig 2021-08-10 550 static int __iomap_write_begin(const struct iomap_iter *iter, loff_t pos,
bc6123a84a71b5 Matthew Wilcox (Oracle 2021-05-02 551) size_t len, struct folio *folio)
afc51aaa22f26c Darrick J. Wong 2019-07-15 552 {
fad0a1ab34f777 Christoph Hellwig 2021-08-10 553 const struct iomap *srcmap = iomap_iter_srcmap(iter);
cdb87406db4bfa Stefan Roesch 2022-05-20 @554 struct iomap_page *iop = to_iomap_page(folio);
1b5c1e36dc0e0f Christoph Hellwig 2021-08-10 555 loff_t block_size = i_blocksize(iter->inode);
6cc19c5fad0908 Nikolay Borisov 2020-09-10 556 loff_t block_start = round_down(pos, block_size);
6cc19c5fad0908 Nikolay Borisov 2020-09-10 557 loff_t block_end = round_up(pos + len, block_size);
431c0566bb6078 Matthew Wilcox (Oracle 2021-04-28 558) size_t from = offset_in_folio(folio, pos), to = from + len;
431c0566bb6078 Matthew Wilcox (Oracle 2021-04-28 559) size_t poff, plen;
cdb87406db4bfa Stefan Roesch 2022-05-20 560 gfp_t gfp = GFP_NOFS | __GFP_NOFAIL;
afc51aaa22f26c Darrick J. Wong 2019-07-15 561
431c0566bb6078 Matthew Wilcox (Oracle 2021-04-28 562) if (folio_test_uptodate(folio))
afc51aaa22f26c Darrick J. Wong 2019-07-15 563 return 0;
431c0566bb6078 Matthew Wilcox (Oracle 2021-04-28 564) folio_clear_error(folio);
afc51aaa22f26c Darrick J. Wong 2019-07-15 565
cdb87406db4bfa Stefan Roesch 2022-05-20 566 iop = iomap_page_create(iter->inode, folio, gfp);
cdb87406db4bfa Stefan Roesch 2022-05-20 567
afc51aaa22f26c Darrick J. Wong 2019-07-15 568 do {
431c0566bb6078 Matthew Wilcox (Oracle 2021-04-28 569) iomap_adjust_read_range(iter->inode, folio, &block_start,
afc51aaa22f26c Darrick J. Wong 2019-07-15 570 block_end - block_start, &poff, &plen);
afc51aaa22f26c Darrick J. Wong 2019-07-15 571 if (plen == 0)
afc51aaa22f26c Darrick J. Wong 2019-07-15 572 break;
afc51aaa22f26c Darrick J. Wong 2019-07-15 573
b74b1293e6cae7 Christoph Hellwig 2021-08-10 574 if (!(iter->flags & IOMAP_UNSHARE) &&
32a38a49910439 Christoph Hellwig 2019-10-18 575 (from <= poff || from >= poff + plen) &&
d3b404396977fd Christoph Hellwig 2019-10-18 576 (to <= poff || to >= poff + plen))
d3b404396977fd Christoph Hellwig 2019-10-18 577 continue;
d3b404396977fd Christoph Hellwig 2019-10-18 578
1b5c1e36dc0e0f Christoph Hellwig 2021-08-10 579 if (iomap_block_needs_zeroing(iter, block_start)) {
b74b1293e6cae7 Christoph Hellwig 2021-08-10 580 if (WARN_ON_ONCE(iter->flags & IOMAP_UNSHARE))
32a38a49910439 Christoph Hellwig 2019-10-18 581 return -EIO;
431c0566bb6078 Matthew Wilcox (Oracle 2021-04-28 582) folio_zero_segments(folio, poff, from, to, poff + plen);
14284fedf59f16 Matthew Wilcox (Oracle 2020-09-10 583) } else {
431c0566bb6078 Matthew Wilcox (Oracle 2021-04-28 584) int status = iomap_read_folio_sync(block_start, folio,
14284fedf59f16 Matthew Wilcox (Oracle 2020-09-10 585) poff, plen, srcmap);
d3b404396977fd Christoph Hellwig 2019-10-18 586 if (status)
d3b404396977fd Christoph Hellwig 2019-10-18 587 return status;
14284fedf59f16 Matthew Wilcox (Oracle 2020-09-10 588) }
431c0566bb6078 Matthew Wilcox (Oracle 2021-04-28 589) iomap_set_range_uptodate(folio, iop, poff, plen);
afc51aaa22f26c Darrick J. Wong 2019-07-15 590 } while ((block_start += plen) < block_end);
afc51aaa22f26c Darrick J. Wong 2019-07-15 591
d3b404396977fd Christoph Hellwig 2019-10-18 592 return 0;
afc51aaa22f26c Darrick J. Wong 2019-07-15 593 }
afc51aaa22f26c Darrick J. Wong 2019-07-15 594
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH v4 05/17] iomap: Add gfp parameter to iomap_page_create()
2022-05-22 7:21 ` Christoph Hellwig
@ 2022-05-25 21:29 ` Stefan Roesch
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Roesch @ 2022-05-25 21:29 UTC (permalink / raw)
To: Christoph Hellwig
Cc: io-uring, kernel-team, linux-mm, linux-xfs, linux-fsdevel, david, jack
On 5/22/22 12:21 AM, Christoph Hellwig wrote:
> On Fri, May 20, 2022 at 11:36:34AM -0700, Stefan Roesch wrote:
>> - iop = kzalloc(struct_size(iop, uptodate, BITS_TO_LONGS(nr_blocks)),
>> - GFP_NOFS | __GFP_NOFAIL);
>> + iop = kzalloc(struct_size(iop, uptodate, BITS_TO_LONGS(nr_blocks)), gfp);
>
> Please avoid the overly long line.
Fixed.
>
> Looking at this I also thnk my second suggestion of just passing the
> flags to iomap_page_create and let iomap_page_create itself pick the
> gfp_t might be the better option here.
Replaced the gfp paramter with a flags parameter and decide on setting
the gfp flags in iomap_page_create.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH v4 05/17] iomap: Add gfp parameter to iomap_page_create()
2022-05-20 18:36 ` [RFC PATCH v4 05/17] iomap: Add gfp parameter to iomap_page_create() Stefan Roesch
@ 2022-05-22 7:21 ` Christoph Hellwig
2022-05-25 21:29 ` Stefan Roesch
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2022-05-22 7:21 UTC (permalink / raw)
To: Stefan Roesch
Cc: io-uring, kernel-team, linux-mm, linux-xfs, linux-fsdevel, david,
jack, hch
On Fri, May 20, 2022 at 11:36:34AM -0700, Stefan Roesch wrote:
> - iop = kzalloc(struct_size(iop, uptodate, BITS_TO_LONGS(nr_blocks)),
> - GFP_NOFS | __GFP_NOFAIL);
> + iop = kzalloc(struct_size(iop, uptodate, BITS_TO_LONGS(nr_blocks)), gfp);
Please avoid the overly long line.
Looking at this I also thnk my second suggestion of just passing the
flags to iomap_page_create and let iomap_page_create itself pick the
gfp_t might be the better option here.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [RFC PATCH v4 05/17] iomap: Add gfp parameter to iomap_page_create()
2022-05-20 18:36 [RFC PATCH v4 00/17] io-uring/xfs: support async buffered writes Stefan Roesch
@ 2022-05-20 18:36 ` Stefan Roesch
2022-05-22 7:21 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Roesch @ 2022-05-20 18:36 UTC (permalink / raw)
To: io-uring, kernel-team, linux-mm, linux-xfs, linux-fsdevel
Cc: shr, david, jack, hch
Add the gfp flags parameter to the function iomap_page_create() to be
able to specify gfp flags.
No intended functional changes in this patch.
Signed-off-by: Stefan Roesch <shr@fb.com>
---
fs/iomap/buffered-io.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 8ce8720093b9..27e67bfc64f5 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -44,7 +44,7 @@ static inline struct iomap_page *to_iomap_page(struct folio *folio)
static struct bio_set iomap_ioend_bioset;
static struct iomap_page *
-iomap_page_create(struct inode *inode, struct folio *folio)
+iomap_page_create(struct inode *inode, struct folio *folio, gfp_t gfp)
{
struct iomap_page *iop = to_iomap_page(folio);
unsigned int nr_blocks = i_blocks_per_folio(inode, folio);
@@ -52,8 +52,8 @@ iomap_page_create(struct inode *inode, struct folio *folio)
if (iop || nr_blocks <= 1)
return iop;
- iop = kzalloc(struct_size(iop, uptodate, BITS_TO_LONGS(nr_blocks)),
- GFP_NOFS | __GFP_NOFAIL);
+ iop = kzalloc(struct_size(iop, uptodate, BITS_TO_LONGS(nr_blocks)), gfp);
+
spin_lock_init(&iop->uptodate_lock);
if (folio_test_uptodate(folio))
bitmap_fill(iop->uptodate, nr_blocks);
@@ -226,7 +226,8 @@ static int iomap_read_inline_data(const struct iomap_iter *iter,
if (WARN_ON_ONCE(size > iomap->length))
return -EIO;
if (offset > 0)
- iop = iomap_page_create(iter->inode, folio);
+ iop = iomap_page_create(iter->inode, folio,
+ GFP_NOFS | __GFP_NOFAIL);
else
iop = to_iomap_page(folio);
@@ -264,7 +265,7 @@ static loff_t iomap_readpage_iter(const struct iomap_iter *iter,
return iomap_read_inline_data(iter, folio);
/* zero post-eof blocks as the page may be mapped */
- iop = iomap_page_create(iter->inode, folio);
+ iop = iomap_page_create(iter->inode, folio, GFP_NOFS | __GFP_NOFAIL);
iomap_adjust_read_range(iter->inode, folio, &pos, length, &poff, &plen);
if (plen == 0)
goto done;
@@ -550,17 +551,20 @@ static int __iomap_write_begin(const struct iomap_iter *iter, loff_t pos,
size_t len, struct folio *folio)
{
const struct iomap *srcmap = iomap_iter_srcmap(iter);
- struct iomap_page *iop = iomap_page_create(iter->inode, folio);
+ struct iomap_page *iop = to_iomap_page(folio);
loff_t block_size = i_blocksize(iter->inode);
loff_t block_start = round_down(pos, block_size);
loff_t block_end = round_up(pos + len, block_size);
size_t from = offset_in_folio(folio, pos), to = from + len;
size_t poff, plen;
+ gfp_t gfp = GFP_NOFS | __GFP_NOFAIL;
if (folio_test_uptodate(folio))
return 0;
folio_clear_error(folio);
+ iop = iomap_page_create(iter->inode, folio, gfp);
+
do {
iomap_adjust_read_range(iter->inode, folio, &block_start,
block_end - block_start, &poff, &plen);
@@ -1332,7 +1336,8 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc,
struct writeback_control *wbc, struct inode *inode,
struct folio *folio, u64 end_pos)
{
- struct iomap_page *iop = iomap_page_create(inode, folio);
+ struct iomap_page *iop = iomap_page_create(inode, folio,
+ GFP_NOFS | __GFP_NOFAIL);
struct iomap_ioend *ioend, *next;
unsigned len = i_blocksize(inode);
unsigned nblocks = i_blocks_per_folio(inode, folio);
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-25 21:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-22 15:22 [RFC PATCH v4 05/17] iomap: Add gfp parameter to iomap_page_create() kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2022-05-20 18:36 [RFC PATCH v4 00/17] io-uring/xfs: support async buffered writes Stefan Roesch
2022-05-20 18:36 ` [RFC PATCH v4 05/17] iomap: Add gfp parameter to iomap_page_create() Stefan Roesch
2022-05-22 7:21 ` Christoph Hellwig
2022-05-25 21:29 ` Stefan Roesch
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.