Re: [PATCH v2 6/6] mm/truncate: use folio_split() for truncate operation.

From: kernel test robot
Date: Sat Nov 02 2024 - 13:23:01 EST


Hi Zi,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on next-20241101]
[cannot apply to linus/master v6.12-rc5]
[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/Zi-Yan/mm-huge_memory-add-two-new-yet-used-functions-for-folio_split/20241101-230623
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20241101150357.1752726-7-ziy%40nvidia.com
patch subject: [PATCH v2 6/6] mm/truncate: use folio_split() for truncate operation.
config: arc-tb10x_defconfig (https://download.01.org/0day-ci/archive/20241103/202411030124.ZWzXWxPU-lkp@xxxxxxxxx/config)
compiler: arc-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241103/202411030124.ZWzXWxPU-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411030124.ZWzXWxPU-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

mm/truncate.c: In function 'truncate_inode_partial_folio':
>> mm/truncate.c:214:13: error: implicit declaration of function 'split_folio_at'; did you mean 'split_folio'? [-Werror=implicit-function-declaration]
214 | if (split_folio_at(folio, folio_page(folio, in_folio_offset), NULL) == 0)
| ^~~~~~~~~~~~~~
| split_folio
cc1: some warnings being treated as errors


vim +214 mm/truncate.c

166
167 /*
168 * Handle partial folios. The folio may be entirely within the
169 * range if a split has raced with us. If not, we zero the part of the
170 * folio that's within the [start, end] range, and then split the folio if
171 * it's large. split_page_range() will discard pages which now lie beyond
172 * i_size, and we rely on the caller to discard pages which lie within a
173 * newly created hole.
174 *
175 * Returns false if splitting failed so the caller can avoid
176 * discarding the entire folio which is stubbornly unsplit.
177 */
178 bool truncate_inode_partial_folio(struct folio *folio, loff_t start, loff_t end)
179 {
180 loff_t pos = folio_pos(folio);
181 unsigned int offset, length;
182 long in_folio_offset;
183
184 if (pos < start)
185 offset = start - pos;
186 else
187 offset = 0;
188 length = folio_size(folio);
189 if (pos + length <= (u64)end)
190 length = length - offset;
191 else
192 length = end + 1 - pos - offset;
193
194 folio_wait_writeback(folio);
195 if (length == folio_size(folio)) {
196 truncate_inode_folio(folio->mapping, folio);
197 return true;
198 }
199
200 /*
201 * We may be zeroing pages we're about to discard, but it avoids
202 * doing a complex calculation here, and then doing the zeroing
203 * anyway if the page split fails.
204 */
205 if (!mapping_inaccessible(folio->mapping))
206 folio_zero_range(folio, offset, length);
207
208 if (folio_needs_release(folio))
209 folio_invalidate(folio, offset, length);
210 if (!folio_test_large(folio))
211 return true;
212
213 in_folio_offset = PAGE_ALIGN_DOWN(offset) / PAGE_SIZE;
> 214 if (split_folio_at(folio, folio_page(folio, in_folio_offset), NULL) == 0)
215 return true;
216 if (folio_test_dirty(folio))
217 return false;
218 truncate_inode_folio(folio->mapping, folio);
219 return true;
220 }
221

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