[linux-next:master 9533/9538] fs/dax.c:916:5: note: in expansion of macro 'dax_pmd_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:   719d6c1b9f86112fd9b5771ff009f678c1e00845
commit: 3cb108f941debe7449cb5de6e9898822d341a49c [9533/9538] dax-add-support-for-fsync-sync-v6
config: arm64-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 3cb108f941debe7449cb5de6e9898822d341a49c
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

All warnings (new ones prefixed by >>):

   fs/dax.c: In function '__dax_pmd_fault':
   fs/dax.c:754:42: warning: passing argument 1 of '__dax_dbg' from incompatible pointer type
    #define dax_pmd_dbg(bh, address, reason) __dax_dbg(bh, address, reason, "dax_pmd")
                                             ^
>> fs/dax.c:916:5: note: in expansion of macro 'dax_pmd_dbg'
        dax_pmd_dbg(bdev, address,
        ^
   fs/dax.c:738:13: note: expected 'struct buffer_head *' but argument is of type 'struct block_device *'
    static void __dax_dbg(struct buffer_head *bh, unsigned long address,
                ^

vim +/dax_pmd_dbg +916 fs/dax.c

   748		} else {
   749			pr_debug("%s: %s addr: %lx fallback: %s\n", fn,
   750				current->comm, address, reason);
   751		}
   752	}
   753	
 > 754	#define dax_pmd_dbg(bh, address, reason)	__dax_dbg(bh, address, reason, "dax_pmd")
   755	
   756	int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
   757			pmd_t *pmd, unsigned int flags, get_block_t get_block,
   758			dax_iodone_t complete_unwritten)
   759	{
   760		struct file *file = vma->vm_file;
   761		struct address_space *mapping = file->f_mapping;
   762		struct inode *inode = mapping->host;
   763		struct buffer_head bh;
   764		unsigned blkbits = inode->i_blkbits;
   765		unsigned long pmd_addr = address & PMD_MASK;
   766		bool write = flags & FAULT_FLAG_WRITE;
   767		struct block_device *bdev;
   768		pgoff_t size, pgoff;
   769		sector_t block;
   770		int error, result = 0;
   771	
   772		/* dax pmd mappings require pfn_t_devmap() */
   773		if (!IS_ENABLED(CONFIG_FS_DAX_PMD))
   774			return VM_FAULT_FALLBACK;
   775	
   776		/* Fall back to PTEs if we're going to COW */
   777		if (write && !(vma->vm_flags & VM_SHARED)) {
   778			split_huge_pmd(vma, pmd, address);
   779			dax_pmd_dbg(NULL, address, "cow write");
   780			return VM_FAULT_FALLBACK;
   781		}
   782		/* If the PMD would extend outside the VMA */
   783		if (pmd_addr < vma->vm_start) {
   784			dax_pmd_dbg(NULL, address, "vma start unaligned");
   785			return VM_FAULT_FALLBACK;
   786		}
   787		if ((pmd_addr + PMD_SIZE) > vma->vm_end) {
   788			dax_pmd_dbg(NULL, address, "vma end unaligned");
   789			return VM_FAULT_FALLBACK;
   790		}
   791	
   792		pgoff = linear_page_index(vma, pmd_addr);
   793		size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT;
   794		if (pgoff >= size)
   795			return VM_FAULT_SIGBUS;
   796		/* If the PMD would cover blocks out of the file */
   797		if ((pgoff | PG_PMD_COLOUR) >= size) {
   798			dax_pmd_dbg(NULL, address,
   799					"offset + huge page size > file size");
   800			return VM_FAULT_FALLBACK;
   801		}
   802	
   803		memset(&bh, 0, sizeof(bh));
   804		block = (sector_t)pgoff << (PAGE_SHIFT - blkbits);
   805	
   806		bh.b_size = PMD_SIZE;
   807		if (get_block(inode, block, &bh, write) != 0)
   808			return VM_FAULT_SIGBUS;
   809		bdev = bh.b_bdev;
   810		i_mmap_lock_read(mapping);
   811	
   812		/*
   813		 * If the filesystem isn't willing to tell us the length of a hole,
   814		 * just fall back to PTEs.  Calling get_block 512 times in a loop
   815		 * would be silly.
   816		 */
   817		if (!buffer_size_valid(&bh) || bh.b_size < PMD_SIZE) {
   818			dax_pmd_dbg(&bh, address, "allocated block too small");
   819			goto fallback;
   820		}
   821	
   822		/*
   823		 * If we allocated new storage, make sure no process has any
   824		 * zero pages covering this hole
   825		 */
   826		if (buffer_new(&bh)) {
   827			i_mmap_unlock_read(mapping);
   828			unmap_mapping_range(mapping, pgoff << PAGE_SHIFT, PMD_SIZE, 0);
   829			i_mmap_lock_read(mapping);
   830		}
   831	
   832		/*
   833		 * If a truncate happened while we were allocating blocks, we may
   834		 * leave blocks allocated to the file that are beyond EOF.  We can't
   835		 * take i_mutex here, so just leave them hanging; they'll be freed
   836		 * when the file is deleted.
   837		 */
   838		size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT;
   839		if (pgoff >= size) {
   840			result = VM_FAULT_SIGBUS;
   841			goto out;
   842		}
   843		if ((pgoff | PG_PMD_COLOUR) >= size) {
   844			dax_pmd_dbg(&bh, address, "pgoff unaligned");
   845			goto fallback;
   846		}
   847	
   848		if (!write && !buffer_mapped(&bh) && buffer_uptodate(&bh)) {
   849			spinlock_t *ptl;
   850			pmd_t entry;
   851			struct page *zero_page = get_huge_zero_page();
   852	
   853			if (unlikely(!zero_page)) {
   854				dax_pmd_dbg(&bh, address, "no zero page");
   855				goto fallback;
   856			}
   857	
   858			ptl = pmd_lock(vma->vm_mm, pmd);
   859			if (!pmd_none(*pmd)) {
   860				spin_unlock(ptl);
   861				dax_pmd_dbg(&bh, address, "pmd already present");
   862				goto fallback;
   863			}
   864	
   865			dev_dbg(part_to_dev(bdev->bd_part),
   866					"%s: %s addr: %lx pfn: <zero> sect: %llx\n",
   867					__func__, current->comm, address,
   868					(unsigned long long) to_sector(&bh, inode));
   869	
   870			entry = mk_pmd(zero_page, vma->vm_page_prot);
   871			entry = pmd_mkhuge(entry);
   872			set_pmd_at(vma->vm_mm, pmd_addr, pmd, entry);
   873			result = VM_FAULT_NOPAGE;
   874			spin_unlock(ptl);
   875		} else {
   876			struct blk_dax_ctl dax = {
   877				.sector = to_sector(&bh, inode),
   878				.size = PMD_SIZE,
   879			};
   880			long length = dax_map_atomic(bdev, &dax);
   881	
   882			if (length < 0) {
   883				result = VM_FAULT_SIGBUS;
   884				goto out;
   885			}
   886			if (length < PMD_SIZE) {
   887				dax_pmd_dbg(&bh, address, "dax-length too small");
   888				dax_unmap_atomic(bdev, &dax);
   889				goto fallback;
   890			}
   891			if (pfn_t_to_pfn(dax.pfn) & PG_PMD_COLOUR) {
   892				dax_pmd_dbg(&bh, address, "pfn unaligned");
   893				dax_unmap_atomic(bdev, &dax);
   894				goto fallback;
   895			}
   896	
   897			if (!pfn_t_devmap(dax.pfn)) {
   898				dax_unmap_atomic(bdev, &dax);
   899				dax_pmd_dbg(&bh, address, "pfn not in memmap");
   900				goto fallback;
   901			}
   902	
   903			if (buffer_unwritten(&bh) || buffer_new(&bh)) {
   904				clear_pmem(dax.addr, PMD_SIZE);
   905				wmb_pmem();
   906				count_vm_event(PGMAJFAULT);
   907				mem_cgroup_count_vm_event(vma->vm_mm, PGMAJFAULT);
   908				result |= VM_FAULT_MAJOR;
   909			}
   910			dax_unmap_atomic(bdev, &dax);
   911	
   912			if (write) {
   913				error = dax_radix_entry(mapping, pgoff, dax.sector,
   914						true, true);
   915				if (error) {
 > 916					dax_pmd_dbg(bdev, address,
   917							"PMD radix insertion failed");
   918					goto fallback;
   919				}

---
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]