[linux-next:master 2619/2735] fs/dax.c:988:42: error: implicit declaration of function '__dax_dbg'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   8babd99a86f51315697523470924eeb7435b9c34
commit: c1da6853b50923e8e400acefcdc51c558d5cc02e [2619/2735] dax: support for transparent PUD pages
config: x86_64-randconfig-s4-02031530 (attached as .config)
reproduce:
        git checkout c1da6853b50923e8e400acefcdc51c558d5cc02e
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   fs/dax.c: In function 'dax_pud_fault':
>> fs/dax.c:988:42: error: implicit declaration of function '__dax_dbg' [-Werror=implicit-function-declaration]
    #define dax_pud_dbg(bh, address, reason) __dax_dbg(bh, address, reason, "dax_pud")
                                             ^
>> fs/dax.c:1014:3: note: in expansion of macro 'dax_pud_dbg'
      dax_pud_dbg(NULL, address, "cow write");
      ^
>> fs/dax.c:1152:17: error: 'THP_FAULT_FALLBACK' undeclared (first use in this function)
     count_vm_event(THP_FAULT_FALLBACK);
                    ^
   fs/dax.c:1152:17: note: each undeclared identifier is reported only once for each function it appears in
   cc1: some warnings being treated as errors

vim +/__dax_dbg +988 fs/dax.c

   982	/*
   983	 * The 'colour' (ie low bits) within a PUD of a page offset.  This comes up
   984	 * more often than one might expect in the below function.
   985	 */
   986	#define PG_PUD_COLOUR	((PUD_SIZE >> PAGE_SHIFT) - 1)
   987	
 > 988	#define dax_pud_dbg(bh, address, reason)	__dax_dbg(bh, address, reason, "dax_pud")
   989	
   990	static int dax_pud_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
   991			get_block_t get_block, dax_iodone_t complete_unwritten)
   992	{
   993		struct file *file = vma->vm_file;
   994		struct address_space *mapping = file->f_mapping;
   995		struct inode *inode = mapping->host;
   996		struct buffer_head bh;
   997		unsigned blkbits = inode->i_blkbits;
   998		unsigned long address = (unsigned long)vmf->virtual_address;
   999		unsigned long pud_addr = address & PUD_MASK;
  1000		bool write = vmf->flags & FAULT_FLAG_WRITE;
  1001		struct block_device *bdev;
  1002		pgoff_t size, pgoff;
  1003		sector_t block;
  1004		int result = 0;
  1005		bool alloc = false;
  1006	
  1007		/* dax pud mappings require pfn_t_devmap() */
  1008		if (!IS_ENABLED(CONFIG_FS_DAX_PMD))
  1009			return VM_FAULT_FALLBACK;
  1010	
  1011		/* Fall back to PTEs if we're going to COW */
  1012		if (write && !(vma->vm_flags & VM_SHARED)) {
  1013			split_huge_pud(vma, vmf->pud, address);
> 1014			dax_pud_dbg(NULL, address, "cow write");
  1015			return VM_FAULT_FALLBACK;
  1016		}
  1017		/* If the PUD would extend outside the VMA */
  1018		if (pud_addr < vma->vm_start) {
  1019			dax_pud_dbg(NULL, address, "vma start unaligned");
  1020			return VM_FAULT_FALLBACK;
  1021		}
  1022		if ((pud_addr + PUD_SIZE) > vma->vm_end) {
  1023			dax_pud_dbg(NULL, address, "vma end unaligned");
  1024			return VM_FAULT_FALLBACK;
  1025		}
  1026	
  1027		pgoff = linear_page_index(vma, pud_addr);
  1028		size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT;
  1029		if (pgoff >= size)
  1030			return VM_FAULT_SIGBUS;
  1031		/* If the PUD would cover blocks out of the file */
  1032		if ((pgoff | PG_PUD_COLOUR) >= size) {
  1033			dax_pud_dbg(NULL, address,
  1034					"offset + huge page size > file size");
  1035			return VM_FAULT_FALLBACK;
  1036		}
  1037	
  1038		memset(&bh, 0, sizeof(bh));
  1039		bh.b_bdev = inode->i_sb->s_bdev;
  1040		block = (sector_t)pgoff << (PAGE_SHIFT - blkbits);
  1041	
  1042		bh.b_size = PUD_SIZE;
  1043	
  1044		if (get_block(inode, block, &bh, 0) != 0)
  1045			return VM_FAULT_SIGBUS;
  1046	
  1047		if (!buffer_mapped(&bh) && write) {
  1048			if (get_block(inode, block, &bh, 1) != 0)
  1049				return VM_FAULT_SIGBUS;
  1050			alloc = true;
  1051		}
  1052	
  1053		bdev = bh.b_bdev;
  1054	
  1055		/*
  1056		 * If the filesystem isn't willing to tell us the length of a hole,
  1057		 * just fall back to PMDs.  Calling get_block 512 times in a loop
  1058		 * would be silly.
  1059		 */
  1060		if (!buffer_size_valid(&bh) || bh.b_size < PUD_SIZE) {
  1061			dax_pud_dbg(&bh, address, "allocated block too small");
  1062			return VM_FAULT_FALLBACK;
  1063		}
  1064	
  1065		/*
  1066		 * If we allocated new storage, make sure no process has any
  1067		 * zero pages covering this hole
  1068		 */
  1069		if (alloc) {
  1070			loff_t lstart = pgoff << PAGE_SHIFT;
  1071			loff_t lend = lstart + PUD_SIZE - 1; /* inclusive */
  1072	
  1073			truncate_pagecache_range(inode, lstart, lend);
  1074		}
  1075	
  1076		i_mmap_lock_read(mapping);
  1077	
  1078		/*
  1079		 * If a truncate happened while we were allocating blocks, we may
  1080		 * leave blocks allocated to the file that are beyond EOF.  We can't
  1081		 * take i_mutex here, so just leave them hanging; they'll be freed
  1082		 * when the file is deleted.
  1083		 */
  1084		size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT;
  1085		if (pgoff >= size) {
  1086			result = VM_FAULT_SIGBUS;
  1087			goto out;
  1088		}
  1089		if ((pgoff | PG_PUD_COLOUR) >= size) {
  1090			dax_pud_dbg(&bh, address, "page extends outside VMA");
  1091			goto fallback;
  1092		}
  1093	
  1094		if (!write && !buffer_mapped(&bh) && buffer_uptodate(&bh)) {
  1095			dax_pud_dbg(&bh, address, "no zero page");
  1096			goto fallback;
  1097		} else {
  1098			struct blk_dax_ctl dax = {
  1099				.sector = to_sector(&bh, inode),
  1100				.size = PUD_SIZE,
  1101			};
  1102			long length = dax_map_atomic(bdev, &dax);
  1103	
  1104			if (length < 0) {
  1105				result = VM_FAULT_SIGBUS;
  1106				goto out;
  1107			}
  1108			if (length < PUD_SIZE) {
  1109				dax_pud_dbg(&bh, address, "dax-length too small");
  1110				dax_unmap_atomic(bdev, &dax);
  1111				goto fallback;
  1112			}
  1113			if (pfn_t_to_pfn(dax.pfn) & PG_PUD_COLOUR) {
  1114				dax_pud_dbg(&bh, address, "pfn unaligned");
  1115				dax_unmap_atomic(bdev, &dax);
  1116				goto fallback;
  1117			}
  1118	
  1119			if (!pfn_t_devmap(dax.pfn)) {
  1120				dax_unmap_atomic(bdev, &dax);
  1121				dax_pud_dbg(&bh, address, "pfn not in memmap");
  1122				goto fallback;
  1123			}
  1124	
  1125			if (buffer_unwritten(&bh) || buffer_new(&bh)) {
  1126				clear_pmem(dax.addr, PUD_SIZE);
  1127				wmb_pmem();
  1128				count_vm_event(PGMAJFAULT);
  1129				mem_cgroup_count_vm_event(vma->vm_mm, PGMAJFAULT);
  1130				result |= VM_FAULT_MAJOR;
  1131			}
  1132			dax_unmap_atomic(bdev, &dax);
  1133	
  1134			dev_dbg(part_to_dev(bdev->bd_part),
  1135					"%s: %s addr: %lx pfn: %lx sect: %llx\n",
  1136					__func__, current->comm, address,
  1137					pfn_t_to_pfn(dax.pfn),
  1138					(unsigned long long) dax.sector);
  1139			result |= vmf_insert_pfn_pud(vma, address, vmf->pud,
  1140					dax.pfn, write);
  1141		}
  1142	
  1143	 out:
  1144		i_mmap_unlock_read(mapping);
  1145	
  1146		if (buffer_unwritten(&bh))
  1147			complete_unwritten(&bh, !(result & VM_FAULT_ERROR));
  1148	
  1149		return result;
  1150	
  1151	 fallback:
> 1152		count_vm_event(THP_FAULT_FALLBACK);
  1153		result = VM_FAULT_FALLBACK;
  1154		goto out;
  1155	}

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: Binary data


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]