lkml.org 
[lkml]   [2021]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[dhowells-fs:netfs-folio 3/3] fs/ceph/addr.c:553:2: warning: #warning ^^^ which page?
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__' ARCH=arm

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (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,


vim +553 fs/ceph/addr.c

481
482 /*
483 * Write a single folio, but leave the folio locked.
484 *
485 * If we get a write error, mark the mapping for error, but still adjust the
486 * dirty folio accounting (i.e., folio is no longer dirty).
487 */
488 static int writepage_nounlock(struct folio *folio, struct writeback_control *wbc)
489 {
490 struct inode *inode = folio_mapping(folio)->host;
491 struct ceph_inode_info *ci = ceph_inode(inode);
492 struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
493 struct ceph_snap_context *snapc, *oldest;
494 loff_t page_pos = folio_file_pos(folio);
495 int err;
496 loff_t len = folio_size(folio);
497 struct ceph_writeback_ctl ceph_wbc;
498 struct ceph_osd_client *osdc = &fsc->client->osdc;
499 struct ceph_osd_request *req;
500 struct page *pages[1];
501
502 dout("writepage %p idx %lu\n", folio, folio_index(folio));
503
504 /* verify this is a writeable snap context */
505 snapc = folio_snap_context(folio);
506 if (!snapc) {
507 dout("writepage %p folio %p not dirty?\n", inode, folio);
508 return 0;
509 }
510 oldest = get_oldest_context(inode, &ceph_wbc, snapc);
511 if (snapc->seq > oldest->seq) {
512 dout("writepage %p folio %p snapc %p not writeable - noop\n",
513 inode, folio, snapc);
514 /* we should only noop if called by kswapd */
515 WARN_ON(!(current->flags & PF_MEMALLOC));
516 ceph_put_snap_context(oldest);
517 folio_redirty_for_writepage(wbc, folio);
518 return 0;
519 }
520 ceph_put_snap_context(oldest);
521
522 /* is this a partial page at end of file? */
523 if (page_pos >= ceph_wbc.i_size) {
524 dout("%p folio eof %llu\n", folio, ceph_wbc.i_size);
525 folio_mapping(folio)->a_ops->invalidatepage(&folio->page, 0, folio_size(folio));
526 return 0;
527 }
528
529 if (ceph_wbc.i_size < page_pos + len)
530 len = ceph_wbc.i_size - page_pos;
531
532 dout("writepage %p folio %p index %lu on %llu~%llu snapc %p seq %lld\n",
533 inode, folio, folio_index(folio), page_pos, len, snapc, snapc->seq);
534
535 if (atomic_long_inc_return(&fsc->writeback_count) >
536 CONGESTION_ON_THRESH(fsc->mount_options->congestion_kb))
537 set_bdi_congested(inode_to_bdi(inode), BLK_RW_ASYNC);
538
539 folio_start_writeback(folio);
540 req = ceph_osdc_new_request(osdc, &ci->i_layout, ceph_vino(inode), page_pos, &len, 0, 1,
541 CEPH_OSD_OP_WRITE, CEPH_OSD_FLAG_WRITE, snapc,
542 ceph_wbc.truncate_seq, ceph_wbc.truncate_size,
543 true);
544 if (IS_ERR(req)) {
545 folio_redirty_for_writepage(wbc, folio);
546 folio_end_writeback(folio);
547 return PTR_ERR(req);
548 }
549
550 /* it may be a short write due to an object boundary */
551 WARN_ON_ONCE(len > folio_size(folio));
552 pages[0] = &folio->page;
> 553 #warning ^^^ which page?
554 osd_req_op_extent_osd_data_pages(req, 0, pages, len, 0, false, false);
555 dout("writepage %llu~%llu (%llu bytes)\n", page_pos, len, len);
556
557 req->r_mtime = inode->i_mtime;
558 err = ceph_osdc_start_request(osdc, req, true);
559 if (!err)
560 err = ceph_osdc_wait_request(osdc, req);
561
562 ceph_update_write_metrics(&fsc->mdsc->metric, req->r_start_latency,
563 req->r_end_latency, len, err);
564
565 ceph_osdc_put_request(req);
566 if (err == 0)
567 err = len;
568
569 if (err < 0) {
570 struct writeback_control tmp_wbc;
571 if (!wbc)
572 wbc = &tmp_wbc;
573 if (err == -ERESTARTSYS) {
574 /* killed by SIGKILL */
575 dout("writepage interrupted folio %p\n", folio);
576 folio_redirty_for_writepage(wbc, folio);
577 folio_end_writeback(folio);
578 return err;
579 }
580 if (err == -EBLOCKLISTED)
581 fsc->blocklisted = true;
582 dout("writepage setting folio/mapping error %d %p\n",
583 err, folio);
584 mapping_set_error(&inode->i_data, err);
585 wbc->pages_skipped += folio_nr_pages(folio);
586 } else {
587 dout("writepage cleaned folio %p\n", folio);
588 err = 0; /* vfs expects us to return 0 */
589 }
590 oldest = folio_detach_private(folio);
591 WARN_ON_ONCE(oldest != snapc);
592 folio_end_writeback(folio);
593 ceph_put_wrbuffer_cap_refs(ci, 1, snapc);
594 ceph_put_snap_context(snapc); /* folios's reference */
595
596 if (atomic_long_dec_return(&fsc->writeback_count) <
597 CONGESTION_OFF_THRESH(fsc->mount_options->congestion_kb))
598 clear_bdi_congested(inode_to_bdi(inode), BLK_RW_ASYNC);
599
600 return err;
601 }
602
603 static int ceph_writepage(struct page *subpage, struct writeback_control *wbc)
604 {
605 struct folio *folio = page_folio(subpage);
606 int err;
607 struct inode *inode = folio_mapping(folio)->host;
608 BUG_ON(!inode);
609 ihold(inode);
610 err = writepage_nounlock(folio, wbc);
611 if (err == -ERESTARTSYS) {
612 /* direct memory reclaimer was killed by SIGKILL. return 0
613 * to prevent caller from setting mapping/page error */
614 err = 0;
615 }
616 folio_unlock(folio);
617 iput(inode);
618 return err;
619 }
620
621 /*
622 * async writeback completion handler.
623 *
624 * If we get an error, set the mapping error bit, but not the individual
625 * page error bits.
626 */
627 static void writepages_finish(struct ceph_osd_request *req)
628 {
629 struct inode *inode = req->r_inode;
630 struct ceph_inode_info *ci = ceph_inode(inode);
631 struct ceph_osd_data *osd_data;
632 struct folio *folio;
633 int num_pages, total_pages = 0;
634 int i, j;
635 int rc = req->r_result;
636 struct ceph_snap_context *snapc = req->r_snapc;
637 struct address_space *mapping = inode->i_mapping;
638 struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
639 unsigned int len = 0;
640 bool remove_page;
641
642 dout("writepages_finish %p rc %d\n", inode, rc);
643 if (rc < 0) {
644 mapping_set_error(mapping, rc);
645 ceph_set_error_write(ci);
646 if (rc == -EBLOCKLISTED)
647 fsc->blocklisted = true;
648 } else {
649 ceph_clear_error_write(ci);
650 }
651
652 /*
653 * We lost the cache cap, need to truncate the page before
654 * it is unlocked, otherwise we'd truncate it later in the
655 * page truncation thread, possibly losing some data that
656 * raced its way in
657 */
658 remove_page = !(ceph_caps_issued(ci) &
659 (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO));
660
661 /* clean all pages */
662 for (i = 0; i < req->r_num_ops; i++) {
663 if (req->r_ops[i].op != CEPH_OSD_OP_WRITE)
664 break;
665
666 osd_data = osd_req_op_extent_osd_data(req, i);
667 BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES);
668 len += osd_data->length;
669 num_pages = calc_pages_for((u64)osd_data->alignment,
670 (u64)osd_data->length);
671 total_pages += num_pages;
672 for (j = 0; j < num_pages; j++) {
673 folio = page_folio(osd_data->pages[j]);
> 674 #warning ^^^ page or folio?
675 BUG_ON(!folio);
676 WARN_ON(!folio_test_uptodate(folio));
677
678 if (atomic_long_dec_return(&fsc->writeback_count) <
679 CONGESTION_OFF_THRESH(
680 fsc->mount_options->congestion_kb))
681 clear_bdi_congested(inode_to_bdi(inode),
682 BLK_RW_ASYNC);
683
684 ceph_put_snap_context(folio_detach_private(folio));
685 folio_end_writeback(folio);
686 dout("unlocking %p\n", folio);
687
688 if (remove_page)
689 generic_error_remove_page(inode->i_mapping,
690 &folio->page);
691
692 folio_unlock(folio);
693 }
694 dout("writepages_finish %p wrote %llu bytes cleaned %d pages\n",
695 inode, osd_data->length, rc >= 0 ? num_pages : 0);
696
697 release_pages(osd_data->pages, num_pages);
698 }
699
700 ceph_update_write_metrics(&fsc->mdsc->metric, req->r_start_latency,
701 req->r_end_latency, len, rc);
702
703 ceph_put_wrbuffer_cap_refs(ci, total_pages, snapc);
704
705 osd_data = osd_req_op_extent_osd_data(req, 0);
706 if (osd_data->pages_from_pool)
707 mempool_free(osd_data->pages, ceph_wb_pagevec_pool);
708 else
709 kfree(osd_data->pages);
710 ceph_osdc_put_request(req);
711 }
712

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2021-08-12 17:18    [W:0.052 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site