Skip to contentSkip to conversation

linux-next: build failure after merge of the fsverity tree

PATCH Mark Brown 3 participants 5 messages Feb 3 – Feb 4

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

Hi all,

After merging the fsverity tree, today's linux-next build (x86_64 allmodconfig) failed like this:

/tmp/next/build/fs/f2fs/data.c: In function 'f2fs_read_data_large_folio':
/tmp/next/build/fs/f2fs/data.c:2525:51: error: passing argument 1 of 'fsverity_verify_page' from incompatible pointer type [-Wincompatible-pointer-types]

 2525 |                             !fsverity_verify_page(folio_file_page(folio,
      |                                                   ^~~~~~~~~~~~~~~~~~~~~~
      |                                                   |
      |                                                   struct page *
 2526 |                                                                 index))) {
      |                                                                 ~~~~~~
In file included from /tmp/next/build/fs/f2fs/f2fs.h:29,
                 from /tmp/next/build/fs/f2fs/data.c:24:
/tmp/next/build/include/linux/fsverity.h:285:63: note: expected 'struct fsverity_info *' but argument is of type 'struct page *'
  285 | static inline bool fsverity_verify_page(struct fsverity_info *vi,
      |                                         ~~~~~~~~~~~~~~~~~~~~~~^~
/tmp/next/build/fs/f2fs/data.c:2525:30: error: too few arguments to function 'fsverity_verify_page'
 2525 |                             !fsverity_verify_page(folio_file_page(folio,
      |                              ^~~~~~~~~~~~~~~~~~~~
/tmp/next/build/include/linux/fsverity.h:285:20: note: declared here
  285 | static inline bool fsverity_verify_page(struct fsverity_info *vi,
      |                    ^~~~~~~~~~~~~~~~~~~~
/tmp/next/build/fs/f2fs/data.c:2557:57: error: passing argument 2 of 'f2fs_grab_read_bio' makes pointer from integer without a cast [-Wint-conversion]
 2557 |                         bio = f2fs_grab_read_bio(inode, block_nr,
      |                                                         ^~~~~~~~
      |                                                         |
      |                                                         sector_t {aka long long unsigned int}
/tmp/next/build/fs/f2fs/data.c:1100:61: note: expected 'struct fsverity_info *' but argument is of type 'sector_t' {aka 'long long unsigned int'}
 1100 |                                       struct fsverity_info *vi, block_t blkaddr,
      |                                       ~~~~~~~~~~~~~~~~~~~~~~^~
/tmp/next/build/fs/f2fs/data.c:2557:31: error: too few arguments to function 'f2fs_grab_read_bio'
 2557 |                         bio = f2fs_grab_read_bio(inode, block_nr,
      |                               ^~~~~~~~~~~~~~~~~~
/tmp/next/build/fs/f2fs/data.c:1099:20: note: declared here
 1099 | static struct bio *f2fs_grab_read_bio(struct inode *inode,
      |                    ^~~~~~~~~~~~~~~~~~

Caused by commit

3428cd0a9498a (f2fs: consolidate fsverity_info lookup)

interacting with

05e65c14ea59 (f2fs: support large folio for immutable non-compressed case)

I have (hopefully) fixed it up, see below, and can carry as needed.

From a954b589f2aa0da3f2522dbeaf342966190a4139 Mon Sep 17 00:00:00 2001
From: Mark Brown <[email protected]>
Date: Tue, 3 Feb 2026 13:19:22 +0000
Subject: [PATCH] f2fs: Fix interaction with fsverity changes

/tmp/next/build/fs/f2fs/data.c: In function 'f2fs_read_data_large_folio':
/tmp/next/build/fs/f2fs/data.c:2525:51: error: passing argument 1 of 'fsverity_verify_page' from incompatible pointer type [-Wincompatible-pointer-types]

 2525 |                             !fsverity_verify_page(folio_file_page(folio,
      |                                                   ^~~~~~~~~~~~~~~~~~~~~~
      |                                                   |
      |                                                   struct page *
 2526 |                                                                 index))) {
      |                                                                 ~~~~~~
In file included from /tmp/next/build/fs/f2fs/f2fs.h:29,
                 from /tmp/next/build/fs/f2fs/data.c:24:
/tmp/next/build/include/linux/fsverity.h:285:63: note: expected 'struct fsverity_info *' but argument is of type 'struct page *'
  285 | static inline bool fsverity_verify_page(struct fsverity_info *vi,
      |                                         ~~~~~~~~~~~~~~~~~~~~~~^~
/tmp/next/build/fs/f2fs/data.c:2525:30: error: too few arguments to function 'fsverity_verify_page'
 2525 |                             !fsverity_verify_page(folio_file_page(folio,
      |                              ^~~~~~~~~~~~~~~~~~~~
/tmp/next/build/include/linux/fsverity.h:285:20: note: declared here
  285 | static inline bool fsverity_verify_page(struct fsverity_info *vi,
      |                    ^~~~~~~~~~~~~~~~~~~~
/tmp/next/build/fs/f2fs/data.c:2557:57: error: passing argument 2 of 'f2fs_grab_read_bio' makes pointer from integer without a cast [-Wint-conversion]
 2557 |                         bio = f2fs_grab_read_bio(inode, block_nr,
      |                                                         ^~~~~~~~
      |                                                         |
      |                                                         sector_t {aka long long unsigned int}
/tmp/next/build/fs/f2fs/data.c:1100:61: note: expected 'struct fsverity_info *' but argument is of type 'sector_t' {aka 'long long unsigned int'}
 1100 |                                       struct fsverity_info *vi, block_t blkaddr,
      |                                       ~~~~~~~~~~~~~~~~~~~~~~^~
/tmp/next/build/fs/f2fs/data.c:2557:31: error: too few arguments to function 'f2fs_grab_read_bio'
 2557 |                         bio = f2fs_grab_read_bio(inode, block_nr,
      |                               ^~~~~~~~~~~~~~~~~~
/tmp/next/build/fs/f2fs/data.c:1099:20: note: declared here
 1099 | static struct bio *f2fs_grab_read_bio(struct inode *inode,
      |                    ^~~~~~~~~~~~~~~~~~
---
 fs/f2fs/data.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
fs/f2fs/data.c +4 -3
index d9085d1236d97..46b4f70f8faf5 100644
@@ -2451,6 +2451,7 @@ static void ffs_detach_free(struct folio *folio)
 }
 
 static int f2fs_read_data_large_folio(struct inode *inode,
+		struct fsverity_info *vi,
 		struct readahead_control *rac, struct folio *folio)
 {
 	struct bio *bio = NULL;
@@ -2522,7 +2523,7 @@ static int f2fs_read_data_large_folio(struct inode *inode,
 		} else {
 			folio_zero_range(folio, offset << PAGE_SHIFT, PAGE_SIZE);
 			if (f2fs_need_verity(inode, index) &&
-			    !fsverity_verify_page(folio_file_page(folio,
+			    !fsverity_verify_page(vi, folio_file_page(folio,
 								index))) {
 				ret = -EIO;
 				goto err_out;
@@ -2554,7 +2555,7 @@ static int f2fs_read_data_large_folio(struct inode *inode,
 			bio = NULL;
 		}
 		if (bio == NULL)
-			bio = f2fs_grab_read_bio(inode, block_nr,
+			bio = f2fs_grab_read_bio(inode, vi, block_nr,
 					max_nr_pages,
 					f2fs_ra_op_flags(rac),
 					index, false);
@@ -2629,7 +2630,7 @@ static int f2fs_mpage_readpages(struct inode *inode, struct fsverity_info *vi,
 	int ret = 0;
 
 	if (mapping_large_folio_support(mapping))
-		return f2fs_read_data_large_folio(inode, rac, folio);
+		return f2fs_read_data_large_folio(inode, vi, rac, folio);
 
 #ifdef CONFIG_F2FS_FS_COMPRESSION
 	if (f2fs_compressed_file(inode)) {
Signature · 1 line
2.47.3
#1 lore raw

fs/f2fs/data.c static int f2fs_read_data_large_folio(struct inode *inode, · line 2525

Quoted 3 lines · Mark Brown
fs/f2fs/data.c +0 -0
 		} else {
 			folio_zero_range(folio, offset << PAGE_SHIFT, PAGE_SIZE);
 			if (f2fs_need_verity(inode, index) &&

This also need to be replaced with a

			if (vi &&

Eric already posted the conflict resultion here:

https://lore.kernel.org/fsverity/[email protected]/T/#m291294c1f6b7368d3c426ee47e6d23dc854b3ba6

and I independently verified it.

author maintainer
#2 lore raw
Quoted 8 lines · Christoph Hellwig

fs/f2fs/data.c static int f2fs_read_data_large_folio(struct inode *inode, · line 2525

Quoted 3 lines · Mark Brown
fs/f2fs/data.c +0 -0
 		} else {
 			folio_zero_range(folio, offset << PAGE_SHIFT, PAGE_SIZE);
 			if (f2fs_need_verity(inode, index) &&

This also need to be replaced with a

			if (vi &&

Thanks, I'll roll that in - I was a bit suspicious of that bit.

Quoted 3 lines

Eric already posted the conflict resultion here:

https://lore.kernel.org/fsverity/[email protected]/T/#m291294c1f6b7368d3c426ee47e6d23dc854b3ba6

Looks the same otherwise modulo whitespace changes.

#3 lore raw
In reply to Mark Brown
kernel test robot noticed the following build errors:

Hi Mark,

kernel test robot noticed the following build errors:

[auto build test ERROR on jaegeuk-f2fs/dev-test]
[also build test ERROR on jaegeuk-f2fs/dev]
[cannot apply to linus/master v6.19-rc8 next-20260204]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mark-Brown/linux-next-build-failure-after-merge-of-the-fsverity-tree/20260203-214224
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
patch link:    https://lore.kernel.org/r/aYH54qJee85qLLkN%40sirena.org.uk
patch subject: linux-next: build failure after merge of the fsverity tree
config: x86_64-rhel-9.4-bpf (https://download.01.org/0day-ci/archive/20260205/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260205/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

fs/f2fs/data.c: In function 'f2fs_read_data_large_folio':
fs/f2fs/data.c:2523:51: error: passing argument 1 of 'fsverity_verify_page' from incompatible pointer type [-Wincompatible-pointer-types]

    2523 |                             !fsverity_verify_page(vi, folio_file_page(folio,
         |                                                   ^~
         |                                                   |
         |                                                   struct fsverity_info *
   In file included from fs/f2fs/f2fs.h:29,
                    from fs/f2fs/data.c:24:
   include/linux/fsverity.h:298:54: note: expected 'struct page *' but argument is of type 'struct fsverity_info *'
     298 | static inline bool fsverity_verify_page(struct page *page)
         |                                         ~~~~~~~~~~~~~^~~~
>> fs/f2fs/data.c:2523:30: error: too many arguments to function 'fsverity_verify_page'
    2523 |                             !fsverity_verify_page(vi, folio_file_page(folio,
         |                              ^~~~~~~~~~~~~~~~~~~~
   include/linux/fsverity.h:298:20: note: declared here
     298 | static inline bool fsverity_verify_page(struct page *page)
         |                    ^~~~~~~~~~~~~~~~~~~~
   fs/f2fs/data.c:2555:57: error: passing argument 2 of 'f2fs_grab_read_bio' makes integer from pointer without a cast [-Wint-conversion]
    2555 |                         bio = f2fs_grab_read_bio(inode, vi, block_nr,
         |                                                         ^~
         |                                                         |
         |                                                         struct fsverity_info *
   fs/f2fs/data.c:1097:68: note: expected 'block_t' {aka 'unsigned int'} but argument is of type 'struct fsverity_info *'
    1097 | static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr,
         |                                                            ~~~~~~~~^~~~~~~
>> fs/f2fs/data.c:2555:31: error: too many arguments to function 'f2fs_grab_read_bio'
    2555 |                         bio = f2fs_grab_read_bio(inode, vi, block_nr,
         |                               ^~~~~~~~~~~~~~~~~~
   fs/f2fs/data.c:1097:20: note: declared here
    1097 | static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr,
         |                    ^~~~~~~~~~~~~~~~~~
   fs/f2fs/data.c: In function 'f2fs_mpage_readpages':
   fs/f2fs/data.c:2629:58: error: 'vi' undeclared (first use in this function)
    2629 |                 return f2fs_read_data_large_folio(inode, vi, rac, folio);
         |                                                          ^~

fs/f2fs/data.c:2629:58: note: each undeclared identifier is reported only once for each function it appears in

vim +/fsverity_verify_page +2523 fs/f2fs/data.c

2449
2450 static int f2fs_read_data_large_folio(struct inode *inode,
2451 struct fsverity_info *vi,
2452 struct readahead_control *rac, struct folio *folio)
2453 {
2454 struct bio *bio = NULL;
2455 sector_t last_block_in_bio = 0;
2456 struct f2fs_map_blocks map = {0, };
2457 pgoff_t index, offset, next_pgofs = 0;
2458 unsigned max_nr_pages = rac ? readahead_count(rac) :
2459 folio_nr_pages(folio);
2460 unsigned nrpages;
2461 struct f2fs_folio_state *ffs;
2462 int ret = 0;
2463 bool folio_in_bio;
2464
2465 if (!IS_IMMUTABLE(inode) || f2fs_compressed_file(inode)) {
2466 if (folio)
2467 folio_unlock(folio);
2468 return -EOPNOTSUPP;
2469 }
2470
2471 map.m_seg_type = NO_CHECK_TYPE;
2472
2473 if (rac)
2474 folio = readahead_folio(rac);
2475 next_folio:
2476 if (!folio)
2477 goto out;
2478
2479 folio_in_bio = false;
2480 index = folio->index;
2481 offset = 0;
2482 ffs = NULL;
2483 nrpages = folio_nr_pages(folio);
2484
2485 for (; nrpages; nrpages--, max_nr_pages--, index++, offset++) {
2486 sector_t block_nr;
2487 /*
2488 * Map blocks using the previous result first.
2489 */
2490 if (map.m_flags & F2FS_MAP_MAPPED) {
2491 if (index > map.m_lblk &&
2492 index < (map.m_lblk + map.m_len))
2493 goto got_it;
2494 } else if (index < next_pgofs) {
2495 /* hole case */
2496 goto got_it;
2497 }
2498
2499 /*
2500 * Then do more f2fs_map_blocks() calls until we are
2501 * done with this page.
2502 */
2503 memset(&map, 0, sizeof(map));
2504 map.m_next_pgofs = &next_pgofs;
2505 map.m_seg_type = NO_CHECK_TYPE;
2506 map.m_lblk = index;
2507 map.m_len = max_nr_pages;
2508
2509 ret = f2fs_map_blocks(inode, &map, F2FS_GET_BLOCK_DEFAULT);
2510 if (ret)
2511 goto err_out;
2512 got_it:
2513 if ((map.m_flags & F2FS_MAP_MAPPED)) {
2514 block_nr = map.m_pblk + index - map.m_lblk;
2515 if (!f2fs_is_valid_blkaddr(F2FS_I_SB(inode), block_nr,
2516 DATA_GENERIC_ENHANCE_READ)) {
2517 ret = -EFSCORRUPTED;
2518 goto err_out;
2519 }
2520 } else {
2521 folio_zero_range(folio, offset << PAGE_SHIFT, PAGE_SIZE);
2522 if (f2fs_need_verity(inode, index) &&

> 2523				    !fsverity_verify_page(vi, folio_file_page(folio,
  2524									index))) {
  2525					ret = -EIO;
  2526					goto err_out;
  2527				}
  2528				continue;
  2529			}
  2530	
  2531			/* We must increment read_pages_pending before possible BIOs submitting
  2532			 * to prevent from premature folio_end_read() call on folio
  2533			 */
  2534			if (folio_test_large(folio)) {
  2535				ffs = ffs_find_or_alloc(folio);
  2536	
  2537				/* set the bitmap to wait */
  2538				spin_lock_irq(&ffs->state_lock);
  2539				ffs->read_pages_pending++;
  2540				spin_unlock_irq(&ffs->state_lock);
  2541			}
  2542	
  2543			/*
  2544			 * This page will go to BIO.  Do we need to send this
  2545			 * BIO off first?
  2546			 */
  2547			if (bio && (!page_is_mergeable(F2FS_I_SB(inode), bio,
  2548							last_block_in_bio, block_nr) ||
  2549				!f2fs_crypt_mergeable_bio(bio, inode, index, NULL))) {
  2550	submit_and_realloc:
  2551				f2fs_submit_read_bio(F2FS_I_SB(inode), bio, DATA);
  2552				bio = NULL;
  2553			}
  2554			if (bio == NULL)
> 2555				bio = f2fs_grab_read_bio(inode, vi, block_nr,

2556 max_nr_pages,
2557 f2fs_ra_op_flags(rac),
2558 index, false);
2559
2560 /*
2561 * If the page is under writeback, we need to wait for
2562 * its completion to see the correct decrypted data.
2563 */
2564 f2fs_wait_on_block_writeback(inode, block_nr);
2565
2566 if (!bio_add_folio(bio, folio, F2FS_BLKSIZE,
2567 offset << PAGE_SHIFT))
2568 goto submit_and_realloc;
2569
2570 folio_in_bio = true;
2571 inc_page_count(F2FS_I_SB(inode), F2FS_RD_DATA);
2572 f2fs_update_iostat(F2FS_I_SB(inode), NULL, FS_DATA_READ_IO,
2573 F2FS_BLKSIZE);
2574 last_block_in_bio = block_nr;
2575 }
2576 trace_f2fs_read_folio(folio, DATA);
2577 err_out:
2578 if (!folio_in_bio) {
2579 folio_end_read(folio, !ret);
2580 if (ret)
2581 return ret;
2582 }
2583 if (rac) {
2584 folio = readahead_folio(rac);
2585 goto next_folio;
2586 }
2587 out:
2588 f2fs_submit_read_bio(F2FS_I_SB(inode), bio, DATA);
2589 if (ret) {
2590 /* Wait bios and clear uptodate. */
2591 folio_lock(folio);
2592 folio_clear_uptodate(folio);
2593 folio_unlock(folio);
2594 }
2595 return ret;
2596 }
2597

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#4 lore raw
In reply to Mark Brown
kernel test robot noticed the following build errors:

Hi Mark,

kernel test robot noticed the following build errors:

[auto build test ERROR on jaegeuk-f2fs/dev-test]
[also build test ERROR on jaegeuk-f2fs/dev]
[cannot apply to linus/master v6.19-rc8 next-20260204]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mark-Brown/linux-next-build-failure-after-merge-of-the-fsverity-tree/20260203-214224
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
patch link:    https://lore.kernel.org/r/aYH54qJee85qLLkN%40sirena.org.uk
patch subject: linux-next: build failure after merge of the fsverity tree
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260205/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260205/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> fs/f2fs/data.c:2523:34: error: too many arguments to function call, expected single argument 'page', have 2 arguments
    2523 |                             !fsverity_verify_page(vi, folio_file_page(folio,
         |                              ~~~~~~~~~~~~~~~~~~~~     ^~~~~~~~~~~~~~~~~~~~~~
    2524 |                                                                 index))) {
         |                                                                 ~~~~~~
   include/linux/fsverity.h:298:20: note: 'fsverity_verify_page' declared here
     298 | static inline bool fsverity_verify_page(struct page *page)
         |                    ^                    ~~~~~~~~~~~~~~~~~
>> fs/f2fs/data.c:2558:13: error: too many arguments to function call, expected 6, have 7
    2555 |                         bio = f2fs_grab_read_bio(inode, vi, block_nr,
         |                               ~~~~~~~~~~~~~~~~~~
    2556 |                                         max_nr_pages,
    2557 |                                         f2fs_ra_op_flags(rac),
    2558 |                                         index, false);
         |                                                ^~~~~
   fs/f2fs/data.c:1097:20: note: 'f2fs_grab_read_bio' declared here
    1097 | static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr,
         |                    ^                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1098 |                                       unsigned nr_pages, blk_opf_t op_flag,
         |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1099 |                                       pgoff_t first_idx, bool for_write)
         |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> fs/f2fs/data.c:2629:44: error: use of undeclared identifier 'vi'
    2629 |                 return f2fs_read_data_large_folio(inode, vi, rac, folio);
         |                                                          ^

3 errors generated.

vim +/page +2523 fs/f2fs/data.c

2449
2450 static int f2fs_read_data_large_folio(struct inode *inode,
2451 struct fsverity_info *vi,
2452 struct readahead_control *rac, struct folio *folio)
2453 {
2454 struct bio *bio = NULL;
2455 sector_t last_block_in_bio = 0;
2456 struct f2fs_map_blocks map = {0, };
2457 pgoff_t index, offset, next_pgofs = 0;
2458 unsigned max_nr_pages = rac ? readahead_count(rac) :
2459 folio_nr_pages(folio);
2460 unsigned nrpages;
2461 struct f2fs_folio_state *ffs;
2462 int ret = 0;
2463 bool folio_in_bio;
2464
2465 if (!IS_IMMUTABLE(inode) || f2fs_compressed_file(inode)) {
2466 if (folio)
2467 folio_unlock(folio);
2468 return -EOPNOTSUPP;
2469 }
2470
2471 map.m_seg_type = NO_CHECK_TYPE;
2472
2473 if (rac)
2474 folio = readahead_folio(rac);
2475 next_folio:
2476 if (!folio)
2477 goto out;
2478
2479 folio_in_bio = false;
2480 index = folio->index;
2481 offset = 0;
2482 ffs = NULL;
2483 nrpages = folio_nr_pages(folio);
2484
2485 for (; nrpages; nrpages--, max_nr_pages--, index++, offset++) {
2486 sector_t block_nr;
2487 /*
2488 * Map blocks using the previous result first.
2489 */
2490 if (map.m_flags & F2FS_MAP_MAPPED) {
2491 if (index > map.m_lblk &&
2492 index < (map.m_lblk + map.m_len))
2493 goto got_it;
2494 } else if (index < next_pgofs) {
2495 /* hole case */
2496 goto got_it;
2497 }
2498
2499 /*
2500 * Then do more f2fs_map_blocks() calls until we are
2501 * done with this page.
2502 */
2503 memset(&map, 0, sizeof(map));
2504 map.m_next_pgofs = &next_pgofs;
2505 map.m_seg_type = NO_CHECK_TYPE;
2506 map.m_lblk = index;
2507 map.m_len = max_nr_pages;
2508
2509 ret = f2fs_map_blocks(inode, &map, F2FS_GET_BLOCK_DEFAULT);
2510 if (ret)
2511 goto err_out;
2512 got_it:
2513 if ((map.m_flags & F2FS_MAP_MAPPED)) {
2514 block_nr = map.m_pblk + index - map.m_lblk;
2515 if (!f2fs_is_valid_blkaddr(F2FS_I_SB(inode), block_nr,
2516 DATA_GENERIC_ENHANCE_READ)) {
2517 ret = -EFSCORRUPTED;
2518 goto err_out;
2519 }
2520 } else {
2521 folio_zero_range(folio, offset << PAGE_SHIFT, PAGE_SIZE);
2522 if (f2fs_need_verity(inode, index) &&

> 2523				    !fsverity_verify_page(vi, folio_file_page(folio,
  2524									index))) {
  2525					ret = -EIO;
  2526					goto err_out;
  2527				}
  2528				continue;
  2529			}
  2530	
  2531			/* We must increment read_pages_pending before possible BIOs submitting
  2532			 * to prevent from premature folio_end_read() call on folio
  2533			 */
  2534			if (folio_test_large(folio)) {
  2535				ffs = ffs_find_or_alloc(folio);
  2536	
  2537				/* set the bitmap to wait */
  2538				spin_lock_irq(&ffs->state_lock);
  2539				ffs->read_pages_pending++;
  2540				spin_unlock_irq(&ffs->state_lock);
  2541			}
  2542	
  2543			/*
  2544			 * This page will go to BIO.  Do we need to send this
  2545			 * BIO off first?
  2546			 */
  2547			if (bio && (!page_is_mergeable(F2FS_I_SB(inode), bio,
  2548							last_block_in_bio, block_nr) ||
  2549				!f2fs_crypt_mergeable_bio(bio, inode, index, NULL))) {
  2550	submit_and_realloc:
  2551				f2fs_submit_read_bio(F2FS_I_SB(inode), bio, DATA);
  2552				bio = NULL;
  2553			}
  2554			if (bio == NULL)
  2555				bio = f2fs_grab_read_bio(inode, vi, block_nr,
  2556						max_nr_pages,
  2557						f2fs_ra_op_flags(rac),
> 2558						index, false);
  2559	
  2560			/*
  2561			 * If the page is under writeback, we need to wait for
  2562			 * its completion to see the correct decrypted data.
  2563			 */
  2564			f2fs_wait_on_block_writeback(inode, block_nr);
  2565	
  2566			if (!bio_add_folio(bio, folio, F2FS_BLKSIZE,
  2567						offset << PAGE_SHIFT))
  2568				goto submit_and_realloc;
  2569	
  2570			folio_in_bio = true;
  2571			inc_page_count(F2FS_I_SB(inode), F2FS_RD_DATA);
  2572			f2fs_update_iostat(F2FS_I_SB(inode), NULL, FS_DATA_READ_IO,
  2573					F2FS_BLKSIZE);
  2574			last_block_in_bio = block_nr;
  2575		}
  2576		trace_f2fs_read_folio(folio, DATA);
  2577	err_out:
  2578		if (!folio_in_bio) {
  2579			folio_end_read(folio, !ret);
  2580			if (ret)
  2581				return ret;
  2582		}
  2583		if (rac) {
  2584			folio = readahead_folio(rac);
  2585			goto next_folio;
  2586		}
  2587	out:
  2588		f2fs_submit_read_bio(F2FS_I_SB(inode), bio, DATA);
  2589		if (ret) {
  2590			/* Wait bios and clear uptodate. */
  2591			folio_lock(folio);
  2592			folio_clear_uptodate(folio);
  2593			folio_unlock(folio);
  2594		}
  2595		return ret;
  2596	}
  2597	
  2598	/*
  2599	 * This function was originally taken from fs/mpage.c, and customized for f2fs.
  2600	 * Major change was from block_size == page_size in f2fs by default.
  2601	 */
  2602	static int f2fs_mpage_readpages(struct inode *inode,
  2603			struct readahead_control *rac, struct folio *folio)
  2604	{
  2605		struct bio *bio = NULL;
  2606		sector_t last_block_in_bio = 0;
  2607		struct f2fs_map_blocks map;
  2608	#ifdef CONFIG_F2FS_FS_COMPRESSION
  2609		struct compress_ctx cc = {
  2610			.inode = inode,
  2611			.log_cluster_size = F2FS_I(inode)->i_log_cluster_size,
  2612			.cluster_size = F2FS_I(inode)->i_cluster_size,
  2613			.cluster_idx = NULL_CLUSTER,
  2614			.rpages = NULL,
  2615			.cpages = NULL,
  2616			.nr_rpages = 0,
  2617			.nr_cpages = 0,
  2618		};
  2619		pgoff_t nc_cluster_idx = NULL_CLUSTER;
  2620		pgoff_t index;
  2621	#endif
  2622		pgoff_t next_pgofs = 0;
  2623		unsigned nr_pages = rac ? readahead_count(rac) : 1;
  2624		struct address_space *mapping = rac ? rac->mapping : folio->mapping;
  2625		unsigned max_nr_pages = nr_pages;
  2626		int ret = 0;
  2627	
  2628		if (mapping_large_folio_support(mapping))
> 2629			return f2fs_read_data_large_folio(inode, vi, rac, folio);

2630

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki