[dhowells-fs:netfs-folio 3/3] fs/ceph/addr.c:813:4: error: 'page' undeclared
From: kernel test robot
Date: Thu Aug 12 2021 - 12:16:11 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git netfs-folio
head: bd62d82fbd1b69357ba3c0d8dffc62fd861f6d3e
commit: bd62d82fbd1b69357ba3c0d8dffc62fd861f6d3e [3/3] ceph: Use folios
config: arm-randconfig-s031-20210812 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 10.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-348-gf0e6938b-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?id=bd62d82fbd1b69357ba3c0d8dffc62fd861f6d3e
git remote add dhowells-fs https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git
git fetch --no-tags dhowells-fs netfs-folio
git checkout bd62d82fbd1b69357ba3c0d8dffc62fd861f6d3e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash fs/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All errors (new ones prefixed by >>):
fs/ceph/addr.c: In function 'writepage_nounlock':
fs/ceph/addr.c:553:2: warning: #warning ^^^ which page? [-Wcpp]
553 | #warning ^^^ which page?
| ^~~~~~~
fs/ceph/addr.c: In function 'writepages_finish':
fs/ceph/addr.c:674:2: warning: #warning ^^^ page or folio? [-Wcpp]
674 | #warning ^^^ page or folio?
| ^~~~~~~
fs/ceph/addr.c: In function 'ceph_writepages_start':
>> fs/ceph/addr.c:813:4: error: 'page' undeclared (first use in this function)
813 | page = pvec.pages[i];
| ^~~~
fs/ceph/addr.c:813:4: note: each undeclared identifier is reported only once for each function it appears in
In file included from fs/ceph/addr.c:2:
>> fs/ceph/addr.c:814:46: error: passing argument 1 of 'folio_index' from incompatible pointer type [-Werror=incompatible-pointer-types]
814 | dout("? %p idx %lu\n", folio, folio_index(folio));
| ^~~~~
| |
| struct page *
include/linux/ceph/ceph_debug.h:26:29: note: in definition of macro 'dout'
26 | printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
| ^~~~~~~~~~~
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:457:49: note: expected 'struct folio *' but argument is of type 'struct page *'
457 | static inline pgoff_t folio_index(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
>> fs/ceph/addr.c:816:16: error: passing argument 1 of 'folio_lock' from incompatible pointer type [-Werror=incompatible-pointer-types]
816 | folio_lock(folio); /* first page */
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:700:45: note: expected 'struct folio *' but argument is of type 'struct page *'
700 | static inline void folio_lock(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
>> fs/ceph/addr.c:817:28: error: passing argument 1 of 'folio_trylock' from incompatible pointer type [-Werror=incompatible-pointer-types]
817 | else if (!folio_trylock(folio))
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:687:48: note: expected 'struct folio *' but argument is of type 'struct page *'
687 | static inline bool folio_trylock(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
In file included from include/linux/string.h:5,
from include/linux/ceph/ceph_debug.h:7,
from fs/ceph/addr.c:2:
>> fs/ceph/addr.c:821:35: error: passing argument 1 of 'folio_test_dirty' from incompatible pointer type [-Werror=incompatible-pointer-types]
821 | if (unlikely(!folio_test_dirty(folio)) ||
| ^~~~~
| |
| struct page *
include/linux/compiler.h:33:34: note: in definition of macro '__branch_check__'
33 | ______r = __builtin_expect(!!(x), expect); \
| ^
fs/ceph/addr.c:821:8: note: in expansion of macro 'unlikely'
821 | if (unlikely(!folio_test_dirty(folio)) ||
| ^~~~~~~~
In file included from include/linux/mmzone.h:22,
from include/linux/gfp.h:6,
from include/linux/xarray.h:14,
from include/linux/radix-tree.h:19,
from include/linux/fs.h:15,
from include/linux/backing-dev.h:13,
from fs/ceph/addr.c:4:
include/linux/page-flags.h:313:62: note: expected 'struct folio *' but argument is of type 'struct page *'
313 | static __always_inline bool folio_test_##lname(struct folio *folio) \
| ~~~~~~~~~~~~~~^~~~~
include/linux/page-flags.h:361:2: note: in expansion of macro 'TESTPAGEFLAG'
361 | TESTPAGEFLAG(uname, lname, policy) \
| ^~~~~~~~~~~~
include/linux/page-flags.h:412:1: note: in expansion of macro 'PAGEFLAG'
412 | PAGEFLAG(Dirty, dirty, PF_HEAD) TESTSCFLAG(Dirty, dirty, PF_HEAD)
| ^~~~~~~~
In file included from include/linux/string.h:5,
from include/linux/ceph/ceph_debug.h:7,
from fs/ceph/addr.c:2:
>> fs/ceph/addr.c:821:35: error: passing argument 1 of 'folio_test_dirty' from incompatible pointer type [-Werror=incompatible-pointer-types]
821 | if (unlikely(!folio_test_dirty(folio)) ||
| ^~~~~
| |
| struct page *
include/linux/compiler.h:35:19: note: in definition of macro '__branch_check__'
35 | expect, is_constant); \
| ^~~~~~~~~~~
fs/ceph/addr.c:821:8: note: in expansion of macro 'unlikely'
821 | if (unlikely(!folio_test_dirty(folio)) ||
| ^~~~~~~~
In file included from include/linux/mmzone.h:22,
from include/linux/gfp.h:6,
from include/linux/xarray.h:14,
from include/linux/radix-tree.h:19,
from include/linux/fs.h:15,
from include/linux/backing-dev.h:13,
from fs/ceph/addr.c:4:
include/linux/page-flags.h:313:62: note: expected 'struct folio *' but argument is of type 'struct page *'
313 | static __always_inline bool folio_test_##lname(struct folio *folio) \
| ~~~~~~~~~~~~~~^~~~~
include/linux/page-flags.h:361:2: note: in expansion of macro 'TESTPAGEFLAG'
361 | TESTPAGEFLAG(uname, lname, policy) \
| ^~~~~~~~~~~~
include/linux/page-flags.h:412:1: note: in expansion of macro 'PAGEFLAG'
412 | PAGEFLAG(Dirty, dirty, PF_HEAD) TESTSCFLAG(Dirty, dirty, PF_HEAD)
| ^~~~~~~~
In file included from include/linux/string.h:5,
from include/linux/ceph/ceph_debug.h:7,
from fs/ceph/addr.c:2:
>> fs/ceph/addr.c:822:31: error: passing argument 1 of 'folio_mapping' from incompatible pointer type [-Werror=incompatible-pointer-types]
822 | unlikely(folio_mapping(folio) != mapping)) {
| ^~~~~
| |
| struct page *
include/linux/compiler.h:33:34: note: in definition of macro '__branch_check__'
33 | ______r = __builtin_expect(!!(x), expect); \
| ^
fs/ceph/addr.c:822:8: note: in expansion of macro 'unlikely'
822 | unlikely(folio_mapping(folio) != mapping)) {
| ^~~~~~~~
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:166:37: note: expected 'struct folio *' but argument is of type 'struct page *'
166 | struct address_space *folio_mapping(struct folio *);
| ^~~~~~~~~~~~~~
In file included from include/linux/string.h:5,
from include/linux/ceph/ceph_debug.h:7,
from fs/ceph/addr.c:2:
>> fs/ceph/addr.c:822:31: error: passing argument 1 of 'folio_mapping' from incompatible pointer type [-Werror=incompatible-pointer-types]
822 | unlikely(folio_mapping(folio) != mapping)) {
| ^~~~~
| |
| struct page *
include/linux/compiler.h:35:19: note: in definition of macro '__branch_check__'
35 | expect, is_constant); \
| ^~~~~~~~~~~
fs/ceph/addr.c:822:8: note: in expansion of macro 'unlikely'
822 | unlikely(folio_mapping(folio) != mapping)) {
| ^~~~~~~~
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:166:37: note: expected 'struct folio *' but argument is of type 'struct page *'
166 | struct address_space *folio_mapping(struct folio *);
| ^~~~~~~~~~~~~~
>> fs/ceph/addr.c:824:18: error: passing argument 1 of 'folio_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
824 | folio_unlock(folio);
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:685:33: note: expected 'struct folio *' but argument is of type 'struct page *'
685 | void folio_unlock(struct folio *folio);
| ~~~~~~~~~~~~~~^~~~~
>> fs/ceph/addr.c:828:33: error: passing argument 1 of 'folio_snap_context' from incompatible pointer type [-Werror=incompatible-pointer-types]
828 | pgsnapc = folio_snap_context(folio);
| ^~~~~
| |
| struct page *
fs/ceph/addr.c:68:74: note: expected 'struct folio *' but argument is of type 'struct page *'
68 | static inline struct ceph_snap_context *folio_snap_context(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:836:18: error: passing argument 1 of 'folio_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
836 | folio_unlock(folio);
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:685:33: note: expected 'struct folio *' but argument is of type 'struct page *'
685 | void folio_unlock(struct folio *folio);
| ~~~~~~~~~~~~~~^~~~~
>> fs/ceph/addr.c:839:23: error: passing argument 1 of 'folio_file_pos' from incompatible pointer type [-Werror=incompatible-pointer-types]
839 | if (folio_file_pos(folio) >= ceph_wbc.i_size) {
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:636:51: note: expected 'struct folio *' but argument is of type 'struct page *'
636 | static inline loff_t folio_file_pos(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:843:24: error: passing argument 1 of 'folio_file_pos' from incompatible pointer type [-Werror=incompatible-pointer-types]
843 | folio_file_pos(folio) >= i_size_read(inode)) &&
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:636:51: note: expected 'struct folio *' but argument is of type 'struct page *'
636 | static inline loff_t folio_file_pos(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
>> fs/ceph/addr.c:846:23: error: passing argument 1 of 'folio_size' from incompatible pointer type [-Werror=incompatible-pointer-types]
846 | 0, folio_size(folio));
| ^~~~~
| |
| struct page *
In file included from include/linux/bvec.h:14,
from include/linux/blk_types.h:10,
from include/linux/genhd.h:19,
from include/linux/blkdev.h:8,
from include/linux/backing-dev.h:15,
from fs/ceph/addr.c:4:
include/linux/mm.h:1721:47: note: expected 'struct folio *' but argument is of type 'struct page *'
1721 | static inline size_t folio_size(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:847:18: error: passing argument 1 of 'folio_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
847 | folio_unlock(folio);
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:685:33: note: expected 'struct folio *' but argument is of type 'struct page *'
685 | void folio_unlock(struct folio *folio);
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:850:39: error: passing argument 1 of 'folio_index' from incompatible pointer type [-Werror=incompatible-pointer-types]
850 | if (strip_unit_end && (folio_index(folio) > strip_unit_end)) {
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:457:49: note: expected 'struct folio *' but argument is of type 'struct page *'
457 | static inline pgoff_t folio_index(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:852:18: error: passing argument 1 of 'folio_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
852 | folio_unlock(folio);
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:685:33: note: expected 'struct folio *' but argument is of type 'struct page *'
685 | void folio_unlock(struct folio *folio);
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:858:19: error: passing argument 1 of 'folio_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
858 | folio_unlock(folio);
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:685:33: note: expected 'struct folio *' but argument is of type 'struct page *'
685 | void folio_unlock(struct folio *folio);
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:867:18: error: passing argument 1 of 'folio_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
867 | folio_unlock(folio);
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:685:33: note: expected 'struct folio *' but argument is of type 'struct page *'
685 | void folio_unlock(struct folio *folio);
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:883:34: error: passing argument 1 of 'folio_file_pos' from incompatible pointer type [-Werror=incompatible-pointer-types]
883 | offset = (u64)folio_file_pos(folio);
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:636:51: note: expected 'struct folio *' but argument is of type 'struct page *'
636 | static inline loff_t folio_file_pos(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:891:34: error: passing argument 1 of 'folio_index' from incompatible pointer type [-Werror=incompatible-pointer-types]
891 | strip_unit_end = folio_index(folio) +
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:457:49: note: expected 'struct folio *' but argument is of type 'struct page *'
457 | static inline pgoff_t folio_index(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:906:27: error: passing argument 1 of 'folio_index' from incompatible pointer type [-Werror=incompatible-pointer-types]
906 | } else if (folio_index(folio) !=
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:457:49: note: expected 'struct folio *' but argument is of type 'struct page *'
457 | static inline pgoff_t folio_index(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:911:19: error: passing argument 1 of 'folio_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
911 | folio_unlock(folio);
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:685:33: note: expected 'struct folio *' but argument is of type 'struct page *'
685 | void folio_unlock(struct folio *folio);
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:916:34: error: passing argument 1 of 'folio_file_pos' from incompatible pointer type [-Werror=incompatible-pointer-types]
916 | offset = (u64)folio_file_pos(folio);
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
--
from include/linux/ceph/ceph_debug.h:7,
from fs/ceph/addr.c:2:
fs/ceph/addr.c:984:20: error: passing argument 1 of 'folio_size' from incompatible pointer type [-Werror=incompatible-pointer-types]
984 | folio_size(folio) - offset);
| ^~~~~
| |
| struct page *
include/linux/compiler.h:33:34: note: in definition of macro '__branch_check__'
33 | ______r = __builtin_expect(!!(x), expect); \
| ^
include/asm-generic/bug.h:65:36: note: in expansion of macro 'unlikely'
65 | #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
| ^~~~~~~~
fs/ceph/addr.c:983:3: note: in expansion of macro 'BUG_ON'
983 | BUG_ON(len < folio_file_pos(pages[locked_pages - 1]) +
| ^~~~~~
In file included from include/linux/bvec.h:14,
from include/linux/blk_types.h:10,
from include/linux/genhd.h:19,
from include/linux/blkdev.h:8,
from include/linux/backing-dev.h:15,
from fs/ceph/addr.c:4:
include/linux/mm.h:1721:47: note: expected 'struct folio *' but argument is of type 'struct page *'
1721 | static inline size_t folio_size(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
In file included from include/linux/string.h:5,
from include/linux/ceph/ceph_debug.h:7,
from fs/ceph/addr.c:2:
fs/ceph/addr.c:983:36: error: passing argument 1 of 'folio_file_pos' from incompatible pointer type [-Werror=incompatible-pointer-types]
983 | BUG_ON(len < folio_file_pos(pages[locked_pages - 1]) +
| ~~~~~^~~~~~~~~~~~~~~~~~
| |
| struct page *
include/linux/compiler.h:35:19: note: in definition of macro '__branch_check__'
35 | expect, is_constant); \
| ^~~~~~~~~~~
include/asm-generic/bug.h:65:36: note: in expansion of macro 'unlikely'
65 | #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
| ^~~~~~~~
fs/ceph/addr.c:983:3: note: in expansion of macro 'BUG_ON'
983 | BUG_ON(len < folio_file_pos(pages[locked_pages - 1]) +
| ^~~~~~
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:636:51: note: expected 'struct folio *' but argument is of type 'struct page *'
636 | static inline loff_t folio_file_pos(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
In file included from include/linux/string.h:5,
from include/linux/ceph/ceph_debug.h:7,
from fs/ceph/addr.c:2:
fs/ceph/addr.c:984:20: error: passing argument 1 of 'folio_size' from incompatible pointer type [-Werror=incompatible-pointer-types]
984 | folio_size(folio) - offset);
| ^~~~~
| |
| struct page *
include/linux/compiler.h:35:19: note: in definition of macro '__branch_check__'
35 | expect, is_constant); \
| ^~~~~~~~~~~
include/asm-generic/bug.h:65:36: note: in expansion of macro 'unlikely'
65 | #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
| ^~~~~~~~
fs/ceph/addr.c:983:3: note: in expansion of macro 'BUG_ON'
983 | BUG_ON(len < folio_file_pos(pages[locked_pages - 1]) +
| ^~~~~~
In file included from include/linux/bvec.h:14,
from include/linux/blk_types.h:10,
from include/linux/genhd.h:19,
from include/linux/blkdev.h:8,
from include/linux/backing-dev.h:15,
from fs/ceph/addr.c:4:
include/linux/mm.h:1721:47: note: expected 'struct folio *' but argument is of type 'struct page *'
1721 | static inline size_t folio_size(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:1014:22: error: passing argument 1 of 'folio_size' from incompatible pointer type [-Werror=incompatible-pointer-types]
1014 | len += folio_size(folio);
| ^~~~~
| |
| struct page *
In file included from include/linux/bvec.h:14,
from include/linux/blk_types.h:10,
from include/linux/genhd.h:19,
from include/linux/blkdev.h:8,
from include/linux/backing-dev.h:15,
from fs/ceph/addr.c:4:
include/linux/mm.h:1721:47: note: expected 'struct folio *' but argument is of type 'struct page *'
1721 | static inline size_t folio_size(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:1023:39: error: passing argument 1 of 'folio_size' from incompatible pointer type [-Werror=incompatible-pointer-types]
1023 | u64 min_len = len + 1 - folio_size(folio);
| ^~~~~
| |
| struct page *
In file included from include/linux/bvec.h:14,
from include/linux/blk_types.h:10,
from include/linux/genhd.h:19,
from include/linux/blkdev.h:8,
from include/linux/backing-dev.h:15,
from fs/ceph/addr.c:4:
include/linux/mm.h:1721:47: note: expected 'struct folio *' but argument is of type 'struct page *'
1721 | static inline size_t folio_size(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
>> fs/ceph/addr.c:1024:49: error: passing argument 2 of 'get_writepages_data_length' from incompatible pointer type [-Werror=incompatible-pointer-types]
1024 | len = get_writepages_data_length(inode, pages[i - 1],
| ~~~~~^~~~~~~
| |
| struct page *
fs/ceph/addr.c:456:25: note: expected 'struct folio *' but argument is of type 'struct page *'
456 | struct folio *folio, u64 start)
| ~~~~~~~~~~~~~~^~~~~
>> fs/ceph/addr.c:1104:29: error: 'folio' undeclared (first use in this function)
1104 | if (folio_snap_context(folio) != snapc)
| ^~~~~
fs/ceph/addr.c: In function 'ceph_find_incompatible':
fs/ceph/addr.c:1157:38: error: 'folio' undeclared (first use in this function)
1157 | struct inode *inode = folio_mapping(folio)->host;
| ^~~~~
>> fs/ceph/addr.c:1191:31: error: passing argument 1 of 'writepage_nounlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
1191 | int r = writepage_nounlock(page, NULL);
| ^~~~
| |
| struct page *
fs/ceph/addr.c:488:45: note: expected 'struct folio *' but argument is of type 'struct page *'
488 | static int writepage_nounlock(struct folio *folio, struct writeback_control *wbc)
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c: In function 'ceph_netfs_check_write_begin':
fs/ceph/addr.c:1206:33: error: 'page' undeclared (first use in this function)
1206 | snapc = ceph_find_incompatible(page);
| ^~~~
fs/ceph/addr.c: In function 'ceph_write_begin':
fs/ceph/addr.c:1253:29: error: 'folio' undeclared (first use in this function)
1253 | if (!folio_test_uptodate(folio)) {
| ^~~~~
>> fs/ceph/addr.c:1261:3: error: implicit declaration of function 'folio_set_uptodate'; did you mean 'folio_test_uptodate'? [-Werror=implicit-function-declaration]
1261 | folio_set_uptodate(folio);
| ^~~~~~~~~~~~~~~~~~
| folio_test_uptodate
fs/ceph/addr.c:1265:61: error: passing argument 6 of 'netfs_write_begin' from incompatible pointer type [-Werror=incompatible-pointer-types]
1265 | r = netfs_write_begin(file, inode->i_mapping, pos, len, 0, &page, NULL,
| ^~~~~
| |
| struct page **
In file included from fs/ceph/addr.c:15:
include/linux/netfs.h:247:45: note: expected 'struct folio **' but argument is of type 'struct page **'
247 | loff_t, unsigned int, unsigned int, struct folio **,
| ^~~~~~~~~~~~~~~
fs/ceph/addr.c: In function 'ceph_filemap_fault':
fs/ceph/addr.c:1419:17: error: 'folio' undeclared (first use in this function)
1419 | folio_unlock(folio);
| ^~~~~
fs/ceph/addr.c: In function 'ceph_page_mkwrite':
fs/ceph/addr.c:1451:30: error: 'folio' undeclared (first use in this function)
1451 | loff_t off = folio_file_pos(folio);
| ^~~~~
fs/ceph/addr.c: In function 'ceph_fill_inline_data':
>> fs/ceph/addr.c:1569:11: error: too many arguments to function 'filemap_get_folio'
1569 | folio = filemap_get_folio(mapping, 0,
| ^~~~~~~~~~~~~~~~~
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:340:29: note: declared here
340 | static inline struct folio *filemap_get_folio(struct address_space *mapping,
| ^~~~~~~~~~~~~~~~~
>> fs/ceph/addr.c:1569:9: error: assignment to 'struct page *' from incompatible pointer type 'struct folio *' [-Werror=incompatible-pointer-types]
1569 | folio = filemap_get_folio(mapping, 0,
| ^
>> fs/ceph/addr.c:1575:27: error: passing argument 1 of 'folio_test_uptodate' from incompatible pointer type [-Werror=incompatible-pointer-types]
1575 | if (folio_test_uptodate(folio)) {
| ^~~~~
| |
| struct page *
In file included from include/linux/mmzone.h:22,
from include/linux/gfp.h:6,
from include/linux/xarray.h:14,
from include/linux/radix-tree.h:19,
from include/linux/fs.h:15,
from include/linux/backing-dev.h:13,
from fs/ceph/addr.c:4:
include/linux/page-flags.h:607:54: note: expected 'struct folio *' but argument is of type 'struct page *'
607 | static inline bool folio_test_uptodate(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:1576:17: error: passing argument 1 of 'folio_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
1576 | folio_unlock(folio);
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:685:33: note: expected 'struct folio *' but argument is of type 'struct page *'
685 | void folio_unlock(struct folio *folio);
| ~~~~~~~~~~~~~~^~~~~
>> fs/ceph/addr.c:1577:14: error: passing argument 1 of 'folio_put' from incompatible pointer type [-Werror=incompatible-pointer-types]
1577 | folio_put(folio);
| ^~~~~
| |
| struct page *
In file included from include/linux/bvec.h:14,
from include/linux/blk_types.h:10,
from include/linux/genhd.h:19,
from include/linux/blkdev.h:8,
from include/linux/backing-dev.h:15,
from fs/ceph/addr.c:4:
include/linux/mm.h:1265:44: note: expected 'struct folio *' but argument is of type 'struct page *'
1265 | static inline void folio_put(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
In file included from fs/ceph/addr.c:2:
fs/ceph/addr.c:1583:38: error: 'locked_page' undeclared (first use in this function); did you mean 'lock_page'?
1583 | inode, ceph_vinop(inode), len, locked_page);
| ^~~~~~~~~~~
include/linux/ceph/ceph_debug.h:26:29: note: in definition of macro 'dout'
26 | printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
| ^~~~~~~~~~~
fs/ceph/addr.c:1586:29: error: 'page' undeclared (first use in this function)
1586 | void *kaddr = kmap_atomic(page);
| ^~~~
fs/ceph/addr.c:1592:24: error: passing argument 1 of 'folio_size' from incompatible pointer type [-Werror=incompatible-pointer-types]
1592 | if (len < folio_size(folio))
| ^~~~~
| |
| struct page *
In file included from include/linux/bvec.h:14,
from include/linux/blk_types.h:10,
from include/linux/genhd.h:19,
from include/linux/blkdev.h:8,
from include/linux/backing-dev.h:15,
from fs/ceph/addr.c:4:
include/linux/mm.h:1721:47: note: expected 'struct folio *' but argument is of type 'struct page *'
1721 | static inline size_t folio_size(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:1598:16: error: passing argument 1 of 'folio_unlock' from incompatible pointer type [-Werror=incompatible-pointer-types]
1598 | folio_unlock(folio);
| ^~~~~
| |
| struct page *
In file included from fs/ceph/addr.c:7:
include/linux/pagemap.h:685:33: note: expected 'struct folio *' but argument is of type 'struct page *'
685 | void folio_unlock(struct folio *folio);
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c:1599:13: error: passing argument 1 of 'folio_put' from incompatible pointer type [-Werror=incompatible-pointer-types]
1599 | folio_put(folio);
| ^~~~~
| |
| struct page *
In file included from include/linux/bvec.h:14,
from include/linux/blk_types.h:10,
from include/linux/genhd.h:19,
from include/linux/blkdev.h:8,
from include/linux/backing-dev.h:15,
from fs/ceph/addr.c:4:
include/linux/mm.h:1265:44: note: expected 'struct folio *' but argument is of type 'struct page *'
1265 | static inline void folio_put(struct folio *folio)
| ~~~~~~~~~~~~~~^~~~~
fs/ceph/addr.c: At top level:
fs/ceph/addr.c:1603:5: error: conflicting types for 'ceph_uninline_data'
1603 | int ceph_uninline_data(struct file *filp, struct folio *locked_folio)
| ^~~~~~~~~~~~~~~~~~
In file included from fs/ceph/addr.c:17:
fs/ceph/super.h:1193:12: note: previous declaration of 'ceph_uninline_data' was here
1193 | extern int ceph_uninline_data(struct file *filp, struct page *locked_page);
| ^~~~~~~~~~~~~~~~~~
fs/ceph/addr.c: In function 'ceph_uninline_data':
fs/ceph/addr.c:1626:9: error: assignment to 'struct page *' from incompatible pointer type 'struct folio *' [-Werror=incompatible-pointer-types]
1626 | folio = locked_folio;
| ^
In file included from arch/arm/include/asm/bug.h:60,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from include/asm-generic/preempt.h:5,
from ./arch/arm/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:51,
from include/linux/wait.h:9,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/backing-dev.h:13,
from fs/ceph/addr.c:4:
fs/ceph/addr.c:1627:32: error: passing argument 1 of 'folio_test_uptodate' from incompatible pointer type [-Werror=incompatible-pointer-types]
1627 | WARN_ON(!folio_test_uptodate(folio));
| ^~~~~
| |
| struct page *
include/asm-generic/bug.h:121:25: note: in definition of macro 'WARN_ON'
121 | int __ret_warn_on = !!(condition); \
| ^~~~~~~~~
In file included from include/linux/mmzone.h:22,
from include/linux/gfp.h:6,
from include/linux/xarray.h:14,
from include/linux/radix-tree.h:19,
from include/linux/fs.h:15,
from include/linux/backing-dev.h:13,
from fs/ceph/addr.c:4:
include/linux/page-flags.h:607:54: note: expected 'struct folio *' but argument is of type 'struct page *'
vim +/page +813 fs/ceph/addr.c
1d3576fd10f0d7 Sage Weil 2009-10-06 620
1d3576fd10f0d7 Sage Weil 2009-10-06 621 /*
1d3576fd10f0d7 Sage Weil 2009-10-06 622 * async writeback completion handler.
1d3576fd10f0d7 Sage Weil 2009-10-06 623 *
1d3576fd10f0d7 Sage Weil 2009-10-06 624 * If we get an error, set the mapping error bit, but not the individual
1d3576fd10f0d7 Sage Weil 2009-10-06 625 * page error bits.
1d3576fd10f0d7 Sage Weil 2009-10-06 626 */
85e084feb47349 Ilya Dryomov 2016-04-28 627 static void writepages_finish(struct ceph_osd_request *req)
1d3576fd10f0d7 Sage Weil 2009-10-06 628 {
1d3576fd10f0d7 Sage Weil 2009-10-06 629 struct inode *inode = req->r_inode;
1d3576fd10f0d7 Sage Weil 2009-10-06 630 struct ceph_inode_info *ci = ceph_inode(inode);
87060c1089a94f Alex Elder 2013-04-03 631 struct ceph_osd_data *osd_data;
bd62d82fbd1b69 David Howells 2021-08-11 632 struct folio *folio;
5b64640cf65be4 Yan, Zheng 2016-01-07 633 int num_pages, total_pages = 0;
5b64640cf65be4 Yan, Zheng 2016-01-07 634 int i, j;
5b64640cf65be4 Yan, Zheng 2016-01-07 635 int rc = req->r_result;
1d3576fd10f0d7 Sage Weil 2009-10-06 636 struct ceph_snap_context *snapc = req->r_snapc;
1d3576fd10f0d7 Sage Weil 2009-10-06 637 struct address_space *mapping = inode->i_mapping;
3d14c5d2b6e15c Yehuda Sadeh 2010-04-06 638 struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
903f4fec78dd05 Xiubo Li 2021-05-13 639 unsigned int len = 0;
5b64640cf65be4 Yan, Zheng 2016-01-07 640 bool remove_page;
5b64640cf65be4 Yan, Zheng 2016-01-07 641
5b64640cf65be4 Yan, Zheng 2016-01-07 642 dout("writepages_finish %p rc %d\n", inode, rc);
26544c623e741a Jeff Layton 2017-04-04 643 if (rc < 0) {
5b64640cf65be4 Yan, Zheng 2016-01-07 644 mapping_set_error(mapping, rc);
26544c623e741a Jeff Layton 2017-04-04 645 ceph_set_error_write(ci);
0b98acd6188309 Ilya Dryomov 2020-09-14 646 if (rc == -EBLOCKLISTED)
0b98acd6188309 Ilya Dryomov 2020-09-14 647 fsc->blocklisted = true;
26544c623e741a Jeff Layton 2017-04-04 648 } else {
26544c623e741a Jeff Layton 2017-04-04 649 ceph_clear_error_write(ci);
26544c623e741a Jeff Layton 2017-04-04 650 }
1d3576fd10f0d7 Sage Weil 2009-10-06 651
79788c698b2904 Sage Weil 2010-02-02 652 /*
5b64640cf65be4 Yan, Zheng 2016-01-07 653 * We lost the cache cap, need to truncate the page before
5b64640cf65be4 Yan, Zheng 2016-01-07 654 * it is unlocked, otherwise we'd truncate it later in the
5b64640cf65be4 Yan, Zheng 2016-01-07 655 * page truncation thread, possibly losing some data that
5b64640cf65be4 Yan, Zheng 2016-01-07 656 * raced its way in
79788c698b2904 Sage Weil 2010-02-02 657 */
5b64640cf65be4 Yan, Zheng 2016-01-07 658 remove_page = !(ceph_caps_issued(ci) &
5b64640cf65be4 Yan, Zheng 2016-01-07 659 (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO));
1d3576fd10f0d7 Sage Weil 2009-10-06 660
1d3576fd10f0d7 Sage Weil 2009-10-06 661 /* clean all pages */
5b64640cf65be4 Yan, Zheng 2016-01-07 662 for (i = 0; i < req->r_num_ops; i++) {
5b64640cf65be4 Yan, Zheng 2016-01-07 663 if (req->r_ops[i].op != CEPH_OSD_OP_WRITE)
5b64640cf65be4 Yan, Zheng 2016-01-07 664 break;
5b64640cf65be4 Yan, Zheng 2016-01-07 665
5b64640cf65be4 Yan, Zheng 2016-01-07 666 osd_data = osd_req_op_extent_osd_data(req, i);
5b64640cf65be4 Yan, Zheng 2016-01-07 667 BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES);
903f4fec78dd05 Xiubo Li 2021-05-13 668 len += osd_data->length;
5b64640cf65be4 Yan, Zheng 2016-01-07 669 num_pages = calc_pages_for((u64)osd_data->alignment,
5b64640cf65be4 Yan, Zheng 2016-01-07 670 (u64)osd_data->length);
5b64640cf65be4 Yan, Zheng 2016-01-07 671 total_pages += num_pages;
5b64640cf65be4 Yan, Zheng 2016-01-07 672 for (j = 0; j < num_pages; j++) {
bd62d82fbd1b69 David Howells 2021-08-11 673 folio = page_folio(osd_data->pages[j]);
bd62d82fbd1b69 David Howells 2021-08-11 @674 #warning ^^^ page or folio?
bd62d82fbd1b69 David Howells 2021-08-11 675 BUG_ON(!folio);
bd62d82fbd1b69 David Howells 2021-08-11 676 WARN_ON(!folio_test_uptodate(folio));
1d3576fd10f0d7 Sage Weil 2009-10-06 677
5b64640cf65be4 Yan, Zheng 2016-01-07 678 if (atomic_long_dec_return(&fsc->writeback_count) <
5b64640cf65be4 Yan, Zheng 2016-01-07 679 CONGESTION_OFF_THRESH(
5b64640cf65be4 Yan, Zheng 2016-01-07 680 fsc->mount_options->congestion_kb))
09dc9fc24ba714 Jan Kara 2017-04-12 681 clear_bdi_congested(inode_to_bdi(inode),
2baba25019ec56 Yehuda Sadeh 2009-12-18 682 BLK_RW_ASYNC);
2baba25019ec56 Yehuda Sadeh 2009-12-18 683
bd62d82fbd1b69 David Howells 2021-08-11 684 ceph_put_snap_context(folio_detach_private(folio));
bd62d82fbd1b69 David Howells 2021-08-11 685 folio_end_writeback(folio);
bd62d82fbd1b69 David Howells 2021-08-11 686 dout("unlocking %p\n", folio);
e63dc5c780ba32 Yehuda Sadeh 2010-02-19 687
5b64640cf65be4 Yan, Zheng 2016-01-07 688 if (remove_page)
5b64640cf65be4 Yan, Zheng 2016-01-07 689 generic_error_remove_page(inode->i_mapping,
bd62d82fbd1b69 David Howells 2021-08-11 690 &folio->page);
e63dc5c780ba32 Yehuda Sadeh 2010-02-19 691
bd62d82fbd1b69 David Howells 2021-08-11 692 folio_unlock(folio);
1d3576fd10f0d7 Sage Weil 2009-10-06 693 }
5b64640cf65be4 Yan, Zheng 2016-01-07 694 dout("writepages_finish %p wrote %llu bytes cleaned %d pages\n",
5b64640cf65be4 Yan, Zheng 2016-01-07 695 inode, osd_data->length, rc >= 0 ? num_pages : 0);
1d3576fd10f0d7 Sage Weil 2009-10-06 696
96ac9158a230e4 John Hubbard 2019-08-08 697 release_pages(osd_data->pages, num_pages);
5b64640cf65be4 Yan, Zheng 2016-01-07 698 }
5b64640cf65be4 Yan, Zheng 2016-01-07 699
903f4fec78dd05 Xiubo Li 2021-05-13 700 ceph_update_write_metrics(&fsc->mdsc->metric, req->r_start_latency,
903f4fec78dd05 Xiubo Li 2021-05-13 701 req->r_end_latency, len, rc);
903f4fec78dd05 Xiubo Li 2021-05-13 702
5b64640cf65be4 Yan, Zheng 2016-01-07 703 ceph_put_wrbuffer_cap_refs(ci, total_pages, snapc);
5b64640cf65be4 Yan, Zheng 2016-01-07 704
5b64640cf65be4 Yan, Zheng 2016-01-07 705 osd_data = osd_req_op_extent_osd_data(req, 0);
87060c1089a94f Alex Elder 2013-04-03 706 if (osd_data->pages_from_pool)
a0102bda5bc099 Jeff Layton 2020-07-30 707 mempool_free(osd_data->pages, ceph_wb_pagevec_pool);
1d3576fd10f0d7 Sage Weil 2009-10-06 708 else
87060c1089a94f Alex Elder 2013-04-03 709 kfree(osd_data->pages);
1d3576fd10f0d7 Sage Weil 2009-10-06 710 ceph_osdc_put_request(req);
1d3576fd10f0d7 Sage Weil 2009-10-06 711 }
1d3576fd10f0d7 Sage Weil 2009-10-06 712
1d3576fd10f0d7 Sage Weil 2009-10-06 713 /*
1d3576fd10f0d7 Sage Weil 2009-10-06 714 * initiate async writeback
1d3576fd10f0d7 Sage Weil 2009-10-06 715 */
1d3576fd10f0d7 Sage Weil 2009-10-06 716 static int ceph_writepages_start(struct address_space *mapping,
1d3576fd10f0d7 Sage Weil 2009-10-06 717 struct writeback_control *wbc)
1d3576fd10f0d7 Sage Weil 2009-10-06 718 {
1d3576fd10f0d7 Sage Weil 2009-10-06 719 struct inode *inode = mapping->host;
1d3576fd10f0d7 Sage Weil 2009-10-06 720 struct ceph_inode_info *ci = ceph_inode(inode);
fc2744aa12da71 Yan, Zheng 2013-05-31 721 struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
fc2744aa12da71 Yan, Zheng 2013-05-31 722 struct ceph_vino vino = ceph_vino(inode);
2a2d927e35dd8d Yan, Zheng 2017-09-01 723 pgoff_t index, start_index, end = -1;
80e755fedebc8d Sage Weil 2010-03-31 724 struct ceph_snap_context *snapc = NULL, *last_snapc = NULL, *pgsnapc;
1d3576fd10f0d7 Sage Weil 2009-10-06 725 struct pagevec pvec;
1d3576fd10f0d7 Sage Weil 2009-10-06 726 int rc = 0;
93407472a21b82 Fabian Frederick 2017-02-27 727 unsigned int wsize = i_blocksize(inode);
1d3576fd10f0d7 Sage Weil 2009-10-06 728 struct ceph_osd_request *req = NULL;
1f934b00e90752 Yan, Zheng 2017-08-30 729 struct ceph_writeback_ctl ceph_wbc;
590e9d9861f5f2 Yan, Zheng 2017-09-03 730 bool should_loop, range_whole = false;
af9cc401ce7452 Yan, Zheng 2018-03-04 731 bool done = false;
1d3576fd10f0d7 Sage Weil 2009-10-06 732
3fb99d483e614b Yanhu Cao 2017-07-21 733 dout("writepages_start %p (mode=%s)\n", inode,
1d3576fd10f0d7 Sage Weil 2009-10-06 734 wbc->sync_mode == WB_SYNC_NONE ? "NONE" :
1d3576fd10f0d7 Sage Weil 2009-10-06 735 (wbc->sync_mode == WB_SYNC_ALL ? "ALL" : "HOLD"));
1d3576fd10f0d7 Sage Weil 2009-10-06 736
50c9132ddfb202 Jeff Layton 2020-09-25 737 if (READ_ONCE(fsc->mount_state) >= CEPH_MOUNT_SHUTDOWN) {
6c93df5db628e7 Yan, Zheng 2016-04-15 738 if (ci->i_wrbuffer_ref > 0) {
6c93df5db628e7 Yan, Zheng 2016-04-15 739 pr_warn_ratelimited(
6c93df5db628e7 Yan, Zheng 2016-04-15 740 "writepage_start %p %lld forced umount\n",
6c93df5db628e7 Yan, Zheng 2016-04-15 741 inode, ceph_ino(inode));
6c93df5db628e7 Yan, Zheng 2016-04-15 742 }
a341d4df87487a Yan, Zheng 2015-07-01 743 mapping_set_error(mapping, -EIO);
1d3576fd10f0d7 Sage Weil 2009-10-06 744 return -EIO; /* we're in a forced umount, don't write! */
1d3576fd10f0d7 Sage Weil 2009-10-06 745 }
95cca2b44e54b0 Yan, Zheng 2017-07-11 746 if (fsc->mount_options->wsize < wsize)
3d14c5d2b6e15c Yehuda Sadeh 2010-04-06 747 wsize = fsc->mount_options->wsize;
1d3576fd10f0d7 Sage Weil 2009-10-06 748
8667982014d604 Mel Gorman 2017-11-15 749 pagevec_init(&pvec);
1d3576fd10f0d7 Sage Weil 2009-10-06 750
590e9d9861f5f2 Yan, Zheng 2017-09-03 751 start_index = wbc->range_cyclic ? mapping->writeback_index : 0;
590e9d9861f5f2 Yan, Zheng 2017-09-03 752 index = start_index;
1d3576fd10f0d7 Sage Weil 2009-10-06 753
1d3576fd10f0d7 Sage Weil 2009-10-06 754 retry:
1d3576fd10f0d7 Sage Weil 2009-10-06 755 /* find oldest snap context with dirty data */
05455e1177f768 Yan, Zheng 2017-09-02 756 snapc = get_oldest_context(inode, &ceph_wbc, NULL);
1d3576fd10f0d7 Sage Weil 2009-10-06 757 if (!snapc) {
1d3576fd10f0d7 Sage Weil 2009-10-06 758 /* hmm, why does writepages get called when there
1d3576fd10f0d7 Sage Weil 2009-10-06 759 is no dirty data? */
1d3576fd10f0d7 Sage Weil 2009-10-06 760 dout(" no snap context with dirty data?\n");
1d3576fd10f0d7 Sage Weil 2009-10-06 761 goto out;
1d3576fd10f0d7 Sage Weil 2009-10-06 762 }
1d3576fd10f0d7 Sage Weil 2009-10-06 763 dout(" oldest snapc is %p seq %lld (%d snaps)\n",
1d3576fd10f0d7 Sage Weil 2009-10-06 764 snapc, snapc->seq, snapc->num_snaps);
fc2744aa12da71 Yan, Zheng 2013-05-31 765
2a2d927e35dd8d Yan, Zheng 2017-09-01 766 should_loop = false;
2a2d927e35dd8d Yan, Zheng 2017-09-01 767 if (ceph_wbc.head_snapc && snapc != last_snapc) {
2a2d927e35dd8d Yan, Zheng 2017-09-01 768 /* where to start/end? */
2a2d927e35dd8d Yan, Zheng 2017-09-01 769 if (wbc->range_cyclic) {
2a2d927e35dd8d Yan, Zheng 2017-09-01 770 index = start_index;
2a2d927e35dd8d Yan, Zheng 2017-09-01 771 end = -1;
2a2d927e35dd8d Yan, Zheng 2017-09-01 772 if (index > 0)
2a2d927e35dd8d Yan, Zheng 2017-09-01 773 should_loop = true;
2a2d927e35dd8d Yan, Zheng 2017-09-01 774 dout(" cyclic, start at %lu\n", index);
2a2d927e35dd8d Yan, Zheng 2017-09-01 775 } else {
2a2d927e35dd8d Yan, Zheng 2017-09-01 776 index = wbc->range_start >> PAGE_SHIFT;
2a2d927e35dd8d Yan, Zheng 2017-09-01 777 end = wbc->range_end >> PAGE_SHIFT;
2a2d927e35dd8d Yan, Zheng 2017-09-01 778 if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
2a2d927e35dd8d Yan, Zheng 2017-09-01 779 range_whole = true;
2a2d927e35dd8d Yan, Zheng 2017-09-01 780 dout(" not cyclic, %lu to %lu\n", index, end);
2a2d927e35dd8d Yan, Zheng 2017-09-01 781 }
2a2d927e35dd8d Yan, Zheng 2017-09-01 782 } else if (!ceph_wbc.head_snapc) {
2a2d927e35dd8d Yan, Zheng 2017-09-01 783 /* Do not respect wbc->range_{start,end}. Dirty pages
2a2d927e35dd8d Yan, Zheng 2017-09-01 784 * in that range can be associated with newer snapc.
2a2d927e35dd8d Yan, Zheng 2017-09-01 785 * They are not writeable until we write all dirty pages
2a2d927e35dd8d Yan, Zheng 2017-09-01 786 * associated with 'snapc' get written */
1582af2eaaf17c Yan, Zheng 2018-03-06 787 if (index > 0)
2a2d927e35dd8d Yan, Zheng 2017-09-01 788 should_loop = true;
2a2d927e35dd8d Yan, Zheng 2017-09-01 789 dout(" non-head snapc, range whole\n");
1d3576fd10f0d7 Sage Weil 2009-10-06 790 }
2a2d927e35dd8d Yan, Zheng 2017-09-01 791
2a2d927e35dd8d Yan, Zheng 2017-09-01 792 ceph_put_snap_context(last_snapc);
1d3576fd10f0d7 Sage Weil 2009-10-06 793 last_snapc = snapc;
1d3576fd10f0d7 Sage Weil 2009-10-06 794
af9cc401ce7452 Yan, Zheng 2018-03-04 795 while (!done && index <= end) {
5b64640cf65be4 Yan, Zheng 2016-01-07 796 int num_ops = 0, op_idx;
0e5ecac7168366 Yan, Zheng 2017-08-31 797 unsigned i, pvec_pages, max_pages, locked_pages = 0;
5b64640cf65be4 Yan, Zheng 2016-01-07 798 struct page **pages = NULL, **data_pages;
bd62d82fbd1b69 David Howells 2021-08-11 799 struct page *folio;
0e5ecac7168366 Yan, Zheng 2017-08-31 800 pgoff_t strip_unit_end = 0;
5b64640cf65be4 Yan, Zheng 2016-01-07 801 u64 offset = 0, len = 0;
a0102bda5bc099 Jeff Layton 2020-07-30 802 bool from_pool = false;
1d3576fd10f0d7 Sage Weil 2009-10-06 803
0e5ecac7168366 Yan, Zheng 2017-08-31 804 max_pages = wsize >> PAGE_SHIFT;
1d3576fd10f0d7 Sage Weil 2009-10-06 805
1d3576fd10f0d7 Sage Weil 2009-10-06 806 get_more_pages:
2e169296603470 Jeff Layton 2020-09-14 807 pvec_pages = pagevec_lookup_range_tag(&pvec, mapping, &index,
2e169296603470 Jeff Layton 2020-09-14 808 end, PAGECACHE_TAG_DIRTY);
0ed75fc8d288f4 Jan Kara 2017-11-15 809 dout("pagevec_lookup_range_tag got %d\n", pvec_pages);
1d3576fd10f0d7 Sage Weil 2009-10-06 810 if (!pvec_pages && !locked_pages)
1d3576fd10f0d7 Sage Weil 2009-10-06 811 break;
1d3576fd10f0d7 Sage Weil 2009-10-06 812 for (i = 0; i < pvec_pages && locked_pages < max_pages; i++) {
1d3576fd10f0d7 Sage Weil 2009-10-06 @813 page = pvec.pages[i];
bd62d82fbd1b69 David Howells 2021-08-11 @814 dout("? %p idx %lu\n", folio, folio_index(folio));
1d3576fd10f0d7 Sage Weil 2009-10-06 815 if (locked_pages == 0)
bd62d82fbd1b69 David Howells 2021-08-11 @816 folio_lock(folio); /* first page */
bd62d82fbd1b69 David Howells 2021-08-11 @817 else if (!folio_trylock(folio))
1d3576fd10f0d7 Sage Weil 2009-10-06 818 break;
1d3576fd10f0d7 Sage Weil 2009-10-06 819
1d3576fd10f0d7 Sage Weil 2009-10-06 820 /* only dirty pages, or our accounting breaks */
bd62d82fbd1b69 David Howells 2021-08-11 @821 if (unlikely(!folio_test_dirty(folio)) ||
bd62d82fbd1b69 David Howells 2021-08-11 @822 unlikely(folio_mapping(folio) != mapping)) {
1d3576fd10f0d7 Sage Weil 2009-10-06 823 dout("!dirty or !mapping %p\n", page);
bd62d82fbd1b69 David Howells 2021-08-11 @824 folio_unlock(folio);
0713e5f24b7deb Yan, Zheng 2017-08-31 825 continue;
1d3576fd10f0d7 Sage Weil 2009-10-06 826 }
af9cc401ce7452 Yan, Zheng 2018-03-04 827 /* only if matching snap context */
bd62d82fbd1b69 David Howells 2021-08-11 @828 pgsnapc = folio_snap_context(folio);
af9cc401ce7452 Yan, Zheng 2018-03-04 829 if (pgsnapc != snapc) {
af9cc401ce7452 Yan, Zheng 2018-03-04 830 dout("page snapc %p %lld != oldest %p %lld\n",
af9cc401ce7452 Yan, Zheng 2018-03-04 831 pgsnapc, pgsnapc->seq, snapc, snapc->seq);
1582af2eaaf17c Yan, Zheng 2018-03-06 832 if (!should_loop &&
1582af2eaaf17c Yan, Zheng 2018-03-06 833 !ceph_wbc.head_snapc &&
1582af2eaaf17c Yan, Zheng 2018-03-06 834 wbc->sync_mode != WB_SYNC_NONE)
1582af2eaaf17c Yan, Zheng 2018-03-06 835 should_loop = true;
bd62d82fbd1b69 David Howells 2021-08-11 @836 folio_unlock(folio);
af9cc401ce7452 Yan, Zheng 2018-03-04 837 continue;
1d3576fd10f0d7 Sage Weil 2009-10-06 838 }
bd62d82fbd1b69 David Howells 2021-08-11 @839 if (folio_file_pos(folio) >= ceph_wbc.i_size) {
1f934b00e90752 Yan, Zheng 2017-08-30 840 dout("%p page eof %llu\n",
1f934b00e90752 Yan, Zheng 2017-08-30 841 page, ceph_wbc.i_size);
c95f1c5f436bad Erqi Chen 2019-07-24 842 if ((ceph_wbc.size_stable ||
bd62d82fbd1b69 David Howells 2021-08-11 @843 folio_file_pos(folio) >= i_size_read(inode)) &&
c95f1c5f436bad Erqi Chen 2019-07-24 844 clear_page_dirty_for_io(page))
af9cc401ce7452 Yan, Zheng 2018-03-04 845 mapping->a_ops->invalidatepage(page,
bd62d82fbd1b69 David Howells 2021-08-11 @846 0, folio_size(folio));
bd62d82fbd1b69 David Howells 2021-08-11 847 folio_unlock(folio);
af9cc401ce7452 Yan, Zheng 2018-03-04 848 continue;
af9cc401ce7452 Yan, Zheng 2018-03-04 849 }
bd62d82fbd1b69 David Howells 2021-08-11 850 if (strip_unit_end && (folio_index(folio) > strip_unit_end)) {
af9cc401ce7452 Yan, Zheng 2018-03-04 851 dout("end of strip unit %p\n", page);
bd62d82fbd1b69 David Howells 2021-08-11 852 folio_unlock(folio);
1d3576fd10f0d7 Sage Weil 2009-10-06 853 break;
1d3576fd10f0d7 Sage Weil 2009-10-06 854 }
1d3576fd10f0d7 Sage Weil 2009-10-06 855 if (PageWriteback(page)) {
0713e5f24b7deb Yan, Zheng 2017-08-31 856 if (wbc->sync_mode == WB_SYNC_NONE) {
1d3576fd10f0d7 Sage Weil 2009-10-06 857 dout("%p under writeback\n", page);
bd62d82fbd1b69 David Howells 2021-08-11 858 folio_unlock(folio);
0713e5f24b7deb Yan, Zheng 2017-08-31 859 continue;
0713e5f24b7deb Yan, Zheng 2017-08-31 860 }
0713e5f24b7deb Yan, Zheng 2017-08-31 861 dout("waiting on writeback %p\n", page);
0713e5f24b7deb Yan, Zheng 2017-08-31 862 wait_on_page_writeback(page);
1d3576fd10f0d7 Sage Weil 2009-10-06 863 }
1d3576fd10f0d7 Sage Weil 2009-10-06 864
1d3576fd10f0d7 Sage Weil 2009-10-06 865 if (!clear_page_dirty_for_io(page)) {
1d3576fd10f0d7 Sage Weil 2009-10-06 866 dout("%p !clear_page_dirty_for_io\n", page);
bd62d82fbd1b69 David Howells 2021-08-11 867 folio_unlock(folio);
0713e5f24b7deb Yan, Zheng 2017-08-31 868 continue;
1d3576fd10f0d7 Sage Weil 2009-10-06 869 }
1d3576fd10f0d7 Sage Weil 2009-10-06 870
e5975c7c8eb6ae Alex Elder 2013-03-14 871 /*
e5975c7c8eb6ae Alex Elder 2013-03-14 872 * We have something to write. If this is
e5975c7c8eb6ae Alex Elder 2013-03-14 873 * the first locked page this time through,
5b64640cf65be4 Yan, Zheng 2016-01-07 874 * calculate max possinle write size and
5b64640cf65be4 Yan, Zheng 2016-01-07 875 * allocate a page array
e5975c7c8eb6ae Alex Elder 2013-03-14 876 */
1d3576fd10f0d7 Sage Weil 2009-10-06 877 if (locked_pages == 0) {
5b64640cf65be4 Yan, Zheng 2016-01-07 878 u64 objnum;
5b64640cf65be4 Yan, Zheng 2016-01-07 879 u64 objoff;
dccbf08005df80 Ilya Dryomov 2018-02-17 880 u32 xlen;
5b64640cf65be4 Yan, Zheng 2016-01-07 881
1d3576fd10f0d7 Sage Weil 2009-10-06 882 /* prepare async write request */
bd62d82fbd1b69 David Howells 2021-08-11 883 offset = (u64)folio_file_pos(folio);
dccbf08005df80 Ilya Dryomov 2018-02-17 884 ceph_calc_file_object_mapping(&ci->i_layout,
dccbf08005df80 Ilya Dryomov 2018-02-17 885 offset, wsize,
5b64640cf65be4 Yan, Zheng 2016-01-07 886 &objnum, &objoff,
dccbf08005df80 Ilya Dryomov 2018-02-17 887 &xlen);
dccbf08005df80 Ilya Dryomov 2018-02-17 888 len = xlen;
8c71897be2ddfd Henry C Chang 2011-05-03 889
3fb99d483e614b Yanhu Cao 2017-07-21 890 num_ops = 1;
bd62d82fbd1b69 David Howells 2021-08-11 891 strip_unit_end = folio_index(folio) +
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 892 ((len - 1) >> PAGE_SHIFT);
88486957f9fbf5 Alex Elder 2013-03-14 893
5b64640cf65be4 Yan, Zheng 2016-01-07 894 BUG_ON(pages);
88486957f9fbf5 Alex Elder 2013-03-14 895 max_pages = calc_pages_for(0, (u64)len);
6da2ec56059c3c Kees Cook 2018-06-12 896 pages = kmalloc_array(max_pages,
6da2ec56059c3c Kees Cook 2018-06-12 897 sizeof(*pages),
fc2744aa12da71 Yan, Zheng 2013-05-31 898 GFP_NOFS);
88486957f9fbf5 Alex Elder 2013-03-14 899 if (!pages) {
a0102bda5bc099 Jeff Layton 2020-07-30 900 from_pool = true;
a0102bda5bc099 Jeff Layton 2020-07-30 901 pages = mempool_alloc(ceph_wb_pagevec_pool, GFP_NOFS);
e5975c7c8eb6ae Alex Elder 2013-03-14 902 BUG_ON(!pages);
88486957f9fbf5 Alex Elder 2013-03-14 903 }
5b64640cf65be4 Yan, Zheng 2016-01-07 904
5b64640cf65be4 Yan, Zheng 2016-01-07 905 len = 0;
bd62d82fbd1b69 David Howells 2021-08-11 906 } else if (folio_index(folio) !=
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 907 (offset + len) >> PAGE_SHIFT) {
a0102bda5bc099 Jeff Layton 2020-07-30 908 if (num_ops >= (from_pool ? CEPH_OSD_SLAB_OPS :
5b64640cf65be4 Yan, Zheng 2016-01-07 909 CEPH_OSD_MAX_OPS)) {
5b64640cf65be4 Yan, Zheng 2016-01-07 910 redirty_page_for_writepage(wbc, page);
bd62d82fbd1b69 David Howells 2021-08-11 911 folio_unlock(folio);
5b64640cf65be4 Yan, Zheng 2016-01-07 912 break;
5b64640cf65be4 Yan, Zheng 2016-01-07 913 }
5b64640cf65be4 Yan, Zheng 2016-01-07 914
5b64640cf65be4 Yan, Zheng 2016-01-07 915 num_ops++;
bd62d82fbd1b69 David Howells 2021-08-11 916 offset = (u64)folio_file_pos(folio);
5b64640cf65be4 Yan, Zheng 2016-01-07 917 len = 0;
1d3576fd10f0d7 Sage Weil 2009-10-06 918 }
1d3576fd10f0d7 Sage Weil 2009-10-06 919
1d3576fd10f0d7 Sage Weil 2009-10-06 920 /* note position of first page in pvec */
1d3576fd10f0d7 Sage Weil 2009-10-06 921 dout("%p will write page %p idx %lu\n",
bd62d82fbd1b69 David Howells 2021-08-11 922 inode, page, folio_index(folio));
2baba25019ec56 Yehuda Sadeh 2009-12-18 923
5b64640cf65be4 Yan, Zheng 2016-01-07 924 if (atomic_long_inc_return(&fsc->writeback_count) >
5b64640cf65be4 Yan, Zheng 2016-01-07 925 CONGESTION_ON_THRESH(
3d14c5d2b6e15c Yehuda Sadeh 2010-04-06 926 fsc->mount_options->congestion_kb)) {
09dc9fc24ba714 Jan Kara 2017-04-12 927 set_bdi_congested(inode_to_bdi(inode),
213c99ee0cf17f Sage Weil 2010-08-03 928 BLK_RW_ASYNC);
2baba25019ec56 Yehuda Sadeh 2009-12-18 929 }
2baba25019ec56 Yehuda Sadeh 2009-12-18 930
0713e5f24b7deb Yan, Zheng 2017-08-31 931
0713e5f24b7deb Yan, Zheng 2017-08-31 932 pages[locked_pages++] = page;
0713e5f24b7deb Yan, Zheng 2017-08-31 933 pvec.pages[i] = NULL;
0713e5f24b7deb Yan, Zheng 2017-08-31 934
bd62d82fbd1b69 David Howells 2021-08-11 935 len += folio_size(folio);
1d3576fd10f0d7 Sage Weil 2009-10-06 936 }
1d3576fd10f0d7 Sage Weil 2009-10-06 937
1d3576fd10f0d7 Sage Weil 2009-10-06 938 /* did we get anything? */
1d3576fd10f0d7 Sage Weil 2009-10-06 939 if (!locked_pages)
1d3576fd10f0d7 Sage Weil 2009-10-06 940 goto release_pvec_pages;
1d3576fd10f0d7 Sage Weil 2009-10-06 941 if (i) {
0713e5f24b7deb Yan, Zheng 2017-08-31 942 unsigned j, n = 0;
0713e5f24b7deb Yan, Zheng 2017-08-31 943 /* shift unused page to beginning of pvec */
0713e5f24b7deb Yan, Zheng 2017-08-31 944 for (j = 0; j < pvec_pages; j++) {
0713e5f24b7deb Yan, Zheng 2017-08-31 945 if (!pvec.pages[j])
0713e5f24b7deb Yan, Zheng 2017-08-31 946 continue;
0713e5f24b7deb Yan, Zheng 2017-08-31 947 if (n < j)
0713e5f24b7deb Yan, Zheng 2017-08-31 948 pvec.pages[n] = pvec.pages[j];
0713e5f24b7deb Yan, Zheng 2017-08-31 949 n++;
0713e5f24b7deb Yan, Zheng 2017-08-31 950 }
0713e5f24b7deb Yan, Zheng 2017-08-31 951 pvec.nr = n;
1d3576fd10f0d7 Sage Weil 2009-10-06 952
1d3576fd10f0d7 Sage Weil 2009-10-06 953 if (pvec_pages && i == pvec_pages &&
1d3576fd10f0d7 Sage Weil 2009-10-06 954 locked_pages < max_pages) {
1d3576fd10f0d7 Sage Weil 2009-10-06 955 dout("reached end pvec, trying for more\n");
0713e5f24b7deb Yan, Zheng 2017-08-31 956 pagevec_release(&pvec);
1d3576fd10f0d7 Sage Weil 2009-10-06 957 goto get_more_pages;
1d3576fd10f0d7 Sage Weil 2009-10-06 958 }
1d3576fd10f0d7 Sage Weil 2009-10-06 959 }
1d3576fd10f0d7 Sage Weil 2009-10-06 960
5b64640cf65be4 Yan, Zheng 2016-01-07 961 new_request:
bd62d82fbd1b69 David Howells 2021-08-11 962 offset = folio_file_pos(pages[0]);
5b64640cf65be4 Yan, Zheng 2016-01-07 963 len = wsize;
5b64640cf65be4 Yan, Zheng 2016-01-07 964
5b64640cf65be4 Yan, Zheng 2016-01-07 965 req = ceph_osdc_new_request(&fsc->client->osdc,
5b64640cf65be4 Yan, Zheng 2016-01-07 966 &ci->i_layout, vino,
5b64640cf65be4 Yan, Zheng 2016-01-07 967 offset, &len, 0, num_ops,
1f934b00e90752 Yan, Zheng 2017-08-30 968 CEPH_OSD_OP_WRITE, CEPH_OSD_FLAG_WRITE,
1f934b00e90752 Yan, Zheng 2017-08-30 969 snapc, ceph_wbc.truncate_seq,
1f934b00e90752 Yan, Zheng 2017-08-30 970 ceph_wbc.truncate_size, false);
5b64640cf65be4 Yan, Zheng 2016-01-07 971 if (IS_ERR(req)) {
5b64640cf65be4 Yan, Zheng 2016-01-07 972 req = ceph_osdc_new_request(&fsc->client->osdc,
5b64640cf65be4 Yan, Zheng 2016-01-07 973 &ci->i_layout, vino,
5b64640cf65be4 Yan, Zheng 2016-01-07 974 offset, &len, 0,
5b64640cf65be4 Yan, Zheng 2016-01-07 975 min(num_ops,
5b64640cf65be4 Yan, Zheng 2016-01-07 976 CEPH_OSD_SLAB_OPS),
5b64640cf65be4 Yan, Zheng 2016-01-07 977 CEPH_OSD_OP_WRITE,
54ea0046b6fe36 Ilya Dryomov 2017-02-11 978 CEPH_OSD_FLAG_WRITE,
1f934b00e90752 Yan, Zheng 2017-08-30 979 snapc, ceph_wbc.truncate_seq,
1f934b00e90752 Yan, Zheng 2017-08-30 980 ceph_wbc.truncate_size, true);
5b64640cf65be4 Yan, Zheng 2016-01-07 981 BUG_ON(IS_ERR(req));
5b64640cf65be4 Yan, Zheng 2016-01-07 982 }
bd62d82fbd1b69 David Howells 2021-08-11 983 BUG_ON(len < folio_file_pos(pages[locked_pages - 1]) +
bd62d82fbd1b69 David Howells 2021-08-11 984 folio_size(folio) - offset);
5b64640cf65be4 Yan, Zheng 2016-01-07 985
5b64640cf65be4 Yan, Zheng 2016-01-07 986 req->r_callback = writepages_finish;
5b64640cf65be4 Yan, Zheng 2016-01-07 987 req->r_inode = inode;
5b64640cf65be4 Yan, Zheng 2016-01-07 988
5b64640cf65be4 Yan, Zheng 2016-01-07 989 /* Format the osd request message and submit the write */
5b64640cf65be4 Yan, Zheng 2016-01-07 990 len = 0;
5b64640cf65be4 Yan, Zheng 2016-01-07 991 data_pages = pages;
5b64640cf65be4 Yan, Zheng 2016-01-07 992 op_idx = 0;
5b64640cf65be4 Yan, Zheng 2016-01-07 993 for (i = 0; i < locked_pages; i++) {
5b64640cf65be4 Yan, Zheng 2016-01-07 994 u64 cur_offset = page_offset(pages[i]);
5b64640cf65be4 Yan, Zheng 2016-01-07 995 if (offset + len != cur_offset) {
3fb99d483e614b Yanhu Cao 2017-07-21 996 if (op_idx + 1 == req->r_num_ops)
5b64640cf65be4 Yan, Zheng 2016-01-07 997 break;
5b64640cf65be4 Yan, Zheng 2016-01-07 998 osd_req_op_extent_dup_last(req, op_idx,
5b64640cf65be4 Yan, Zheng 2016-01-07 999 cur_offset - offset);
5b64640cf65be4 Yan, Zheng 2016-01-07 1000 dout("writepages got pages at %llu~%llu\n",
5b64640cf65be4 Yan, Zheng 2016-01-07 1001 offset, len);
5b64640cf65be4 Yan, Zheng 2016-01-07 1002 osd_req_op_extent_osd_data_pages(req, op_idx,
5b64640cf65be4 Yan, Zheng 2016-01-07 1003 data_pages, len, 0,
a0102bda5bc099 Jeff Layton 2020-07-30 1004 from_pool, false);
5b64640cf65be4 Yan, Zheng 2016-01-07 1005 osd_req_op_extent_update(req, op_idx, len);
5b64640cf65be4 Yan, Zheng 2016-01-07 1006
5b64640cf65be4 Yan, Zheng 2016-01-07 1007 len = 0;
5b64640cf65be4 Yan, Zheng 2016-01-07 1008 offset = cur_offset;
5b64640cf65be4 Yan, Zheng 2016-01-07 1009 data_pages = pages + i;
5b64640cf65be4 Yan, Zheng 2016-01-07 1010 op_idx++;
5b64640cf65be4 Yan, Zheng 2016-01-07 1011 }
5b64640cf65be4 Yan, Zheng 2016-01-07 1012
5b64640cf65be4 Yan, Zheng 2016-01-07 1013 set_page_writeback(pages[i]);
bd62d82fbd1b69 David Howells 2021-08-11 1014 len += folio_size(folio);
5b64640cf65be4 Yan, Zheng 2016-01-07 1015 }
5b64640cf65be4 Yan, Zheng 2016-01-07 1016
1f934b00e90752 Yan, Zheng 2017-08-30 1017 if (ceph_wbc.size_stable) {
1f934b00e90752 Yan, Zheng 2017-08-30 1018 len = min(len, ceph_wbc.i_size - offset);
5b64640cf65be4 Yan, Zheng 2016-01-07 1019 } else if (i == locked_pages) {
e1966b49446a43 Yan, Zheng 2015-06-18 1020 /* writepages_finish() clears writeback pages
e1966b49446a43 Yan, Zheng 2015-06-18 1021 * according to the data length, so make sure
e1966b49446a43 Yan, Zheng 2015-06-18 1022 * data length covers all locked pages */
bd62d82fbd1b69 David Howells 2021-08-11 1023 u64 min_len = len + 1 - folio_size(folio);
1f934b00e90752 Yan, Zheng 2017-08-30 1024 len = get_writepages_data_length(inode, pages[i - 1],
1f934b00e90752 Yan, Zheng 2017-08-30 1025 offset);
5b64640cf65be4 Yan, Zheng 2016-01-07 1026 len = max(len, min_len);
e1966b49446a43 Yan, Zheng 2015-06-18 1027 }
5b64640cf65be4 Yan, Zheng 2016-01-07 1028 dout("writepages got pages at %llu~%llu\n", offset, len);
1d3576fd10f0d7 Sage Weil 2009-10-06 1029
5b64640cf65be4 Yan, Zheng 2016-01-07 1030 osd_req_op_extent_osd_data_pages(req, op_idx, data_pages, len,
a0102bda5bc099 Jeff Layton 2020-07-30 1031 0, from_pool, false);
5b64640cf65be4 Yan, Zheng 2016-01-07 1032 osd_req_op_extent_update(req, op_idx, len);
e5975c7c8eb6ae Alex Elder 2013-03-14 1033
5b64640cf65be4 Yan, Zheng 2016-01-07 1034 BUG_ON(op_idx + 1 != req->r_num_ops);
e5975c7c8eb6ae Alex Elder 2013-03-14 1035
a0102bda5bc099 Jeff Layton 2020-07-30 1036 from_pool = false;
5b64640cf65be4 Yan, Zheng 2016-01-07 1037 if (i < locked_pages) {
5b64640cf65be4 Yan, Zheng 2016-01-07 1038 BUG_ON(num_ops <= req->r_num_ops);
5b64640cf65be4 Yan, Zheng 2016-01-07 1039 num_ops -= req->r_num_ops;
5b64640cf65be4 Yan, Zheng 2016-01-07 1040 locked_pages -= i;
5b64640cf65be4 Yan, Zheng 2016-01-07 1041
5b64640cf65be4 Yan, Zheng 2016-01-07 1042 /* allocate new pages array for next request */
5b64640cf65be4 Yan, Zheng 2016-01-07 1043 data_pages = pages;
6da2ec56059c3c Kees Cook 2018-06-12 1044 pages = kmalloc_array(locked_pages, sizeof(*pages),
5b64640cf65be4 Yan, Zheng 2016-01-07 1045 GFP_NOFS);
5b64640cf65be4 Yan, Zheng 2016-01-07 1046 if (!pages) {
a0102bda5bc099 Jeff Layton 2020-07-30 1047 from_pool = true;
a0102bda5bc099 Jeff Layton 2020-07-30 1048 pages = mempool_alloc(ceph_wb_pagevec_pool, GFP_NOFS);
5b64640cf65be4 Yan, Zheng 2016-01-07 1049 BUG_ON(!pages);
5b64640cf65be4 Yan, Zheng 2016-01-07 1050 }
5b64640cf65be4 Yan, Zheng 2016-01-07 1051 memcpy(pages, data_pages + i,
5b64640cf65be4 Yan, Zheng 2016-01-07 1052 locked_pages * sizeof(*pages));
5b64640cf65be4 Yan, Zheng 2016-01-07 1053 memset(data_pages + i, 0,
5b64640cf65be4 Yan, Zheng 2016-01-07 1054 locked_pages * sizeof(*pages));
5b64640cf65be4 Yan, Zheng 2016-01-07 1055 } else {
5b64640cf65be4 Yan, Zheng 2016-01-07 1056 BUG_ON(num_ops != req->r_num_ops);
5b64640cf65be4 Yan, Zheng 2016-01-07 1057 index = pages[i - 1]->index + 1;
5b64640cf65be4 Yan, Zheng 2016-01-07 1058 /* request message now owns the pages array */
5b64640cf65be4 Yan, Zheng 2016-01-07 1059 pages = NULL;
5b64640cf65be4 Yan, Zheng 2016-01-07 1060 }
e5975c7c8eb6ae Alex Elder 2013-03-14 1061
fac02ddf910814 Arnd Bergmann 2018-07-13 1062 req->r_mtime = inode->i_mtime;
9d6fcb081a4770 Sage Weil 2011-05-12 1063 rc = ceph_osdc_start_request(&fsc->client->osdc, req, true);
9d6fcb081a4770 Sage Weil 2011-05-12 1064 BUG_ON(rc);
1d3576fd10f0d7 Sage Weil 2009-10-06 1065 req = NULL;
1d3576fd10f0d7 Sage Weil 2009-10-06 1066
5b64640cf65be4 Yan, Zheng 2016-01-07 1067 wbc->nr_to_write -= i;
5b64640cf65be4 Yan, Zheng 2016-01-07 1068 if (pages)
5b64640cf65be4 Yan, Zheng 2016-01-07 1069 goto new_request;
5b64640cf65be4 Yan, Zheng 2016-01-07 1070
2a2d927e35dd8d Yan, Zheng 2017-09-01 1071 /*
2a2d927e35dd8d Yan, Zheng 2017-09-01 1072 * We stop writing back only if we are not doing
2a2d927e35dd8d Yan, Zheng 2017-09-01 1073 * integrity sync. In case of integrity sync we have to
2a2d927e35dd8d Yan, Zheng 2017-09-01 1074 * keep going until we have written all the pages
2a2d927e35dd8d Yan, Zheng 2017-09-01 1075 * we tagged for writeback prior to entering this loop.
2a2d927e35dd8d Yan, Zheng 2017-09-01 1076 */
2a2d927e35dd8d Yan, Zheng 2017-09-01 1077 if (wbc->nr_to_write <= 0 && wbc->sync_mode == WB_SYNC_NONE)
af9cc401ce7452 Yan, Zheng 2018-03-04 1078 done = true;
1d3576fd10f0d7 Sage Weil 2009-10-06 1079
1d3576fd10f0d7 Sage Weil 2009-10-06 1080 release_pvec_pages:
1d3576fd10f0d7 Sage Weil 2009-10-06 1081 dout("pagevec_release on %d pages (%p)\n", (int)pvec.nr,
1d3576fd10f0d7 Sage Weil 2009-10-06 1082 pvec.nr ? pvec.pages[0] : NULL);
1d3576fd10f0d7 Sage Weil 2009-10-06 1083 pagevec_release(&pvec);
1d3576fd10f0d7 Sage Weil 2009-10-06 1084 }
1d3576fd10f0d7 Sage Weil 2009-10-06 1085
1d3576fd10f0d7 Sage Weil 2009-10-06 1086 if (should_loop && !done) {
1d3576fd10f0d7 Sage Weil 2009-10-06 1087 /* more to do; loop back to beginning of file */
1d3576fd10f0d7 Sage Weil 2009-10-06 1088 dout("writepages looping back to beginning of file\n");
2a2d927e35dd8d Yan, Zheng 2017-09-01 1089 end = start_index - 1; /* OK even when start_index == 0 */
f275635ee0b664 Yan, Zheng 2017-09-01 1090
f275635ee0b664 Yan, Zheng 2017-09-01 1091 /* to write dirty pages associated with next snapc,
f275635ee0b664 Yan, Zheng 2017-09-01 1092 * we need to wait until current writes complete */
f275635ee0b664 Yan, Zheng 2017-09-01 1093 if (wbc->sync_mode != WB_SYNC_NONE &&
f275635ee0b664 Yan, Zheng 2017-09-01 1094 start_index == 0 && /* all dirty pages were checked */
f275635ee0b664 Yan, Zheng 2017-09-01 1095 !ceph_wbc.head_snapc) {
f275635ee0b664 Yan, Zheng 2017-09-01 1096 struct page *page;
f275635ee0b664 Yan, Zheng 2017-09-01 1097 unsigned i, nr;
f275635ee0b664 Yan, Zheng 2017-09-01 1098 index = 0;
f275635ee0b664 Yan, Zheng 2017-09-01 1099 while ((index <= end) &&
f275635ee0b664 Yan, Zheng 2017-09-01 1100 (nr = pagevec_lookup_tag(&pvec, mapping, &index,
67fd707f468142 Jan Kara 2017-11-15 1101 PAGECACHE_TAG_WRITEBACK))) {
f275635ee0b664 Yan, Zheng 2017-09-01 1102 for (i = 0; i < nr; i++) {
f275635ee0b664 Yan, Zheng 2017-09-01 1103 page = pvec.pages[i];
bd62d82fbd1b69 David Howells 2021-08-11 1104 if (folio_snap_context(folio) != snapc)
f275635ee0b664 Yan, Zheng 2017-09-01 1105 continue;
f275635ee0b664 Yan, Zheng 2017-09-01 1106 wait_on_page_writeback(page);
f275635ee0b664 Yan, Zheng 2017-09-01 1107 }
f275635ee0b664 Yan, Zheng 2017-09-01 1108 pagevec_release(&pvec);
f275635ee0b664 Yan, Zheng 2017-09-01 1109 cond_resched();
f275635ee0b664 Yan, Zheng 2017-09-01 1110 }
f275635ee0b664 Yan, Zheng 2017-09-01 1111 }
f275635ee0b664 Yan, Zheng 2017-09-01 1112
2a2d927e35dd8d Yan, Zheng 2017-09-01 1113 start_index = 0;
1d3576fd10f0d7 Sage Weil 2009-10-06 1114 index = 0;
1d3576fd10f0d7 Sage Weil 2009-10-06 1115 goto retry;
1d3576fd10f0d7 Sage Weil 2009-10-06 1116 }
1d3576fd10f0d7 Sage Weil 2009-10-06 1117
1d3576fd10f0d7 Sage Weil 2009-10-06 1118 if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
1d3576fd10f0d7 Sage Weil 2009-10-06 1119 mapping->writeback_index = index;
1d3576fd10f0d7 Sage Weil 2009-10-06 1120
1d3576fd10f0d7 Sage Weil 2009-10-06 1121 out:
1d3576fd10f0d7 Sage Weil 2009-10-06 1122 ceph_osdc_put_request(req);
2a2d927e35dd8d Yan, Zheng 2017-09-01 1123 ceph_put_snap_context(last_snapc);
2a2d927e35dd8d Yan, Zheng 2017-09-01 1124 dout("writepages dend - startone, rc = %d\n", rc);
1d3576fd10f0d7 Sage Weil 2009-10-06 1125 return rc;
1d3576fd10f0d7 Sage Weil 2009-10-06 1126 }
1d3576fd10f0d7 Sage Weil 2009-10-06 1127
:::::: The code at line 813 was first introduced by commit
:::::: 1d3576fd10f0d7a104204267b81cf84a07028dad ceph: address space operations
:::::: TO: Sage Weil <sage@xxxxxxxxxxxx>
:::::: CC: Sage Weil <sage@xxxxxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip