public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* MAP_SYNC in libnvdimm-for-next and collision fixups
@ 2017-11-03  3:20 Williams, Dan J
  0 siblings, 0 replies; only message in thread
From: Williams, Dan J @ 2017-11-03  3:20 UTC (permalink / raw)
  To: sfr@canb.auug.org.au
  Cc: darrick.wong@oracle.com, linux-kernel@vger.kernel.org,
	jack@suse.cz, linux-fsdevel@vger.kernel.org

Hi Stephen,

I've pushed a new libnvdimm-for-next branch that includes the libnvdimm
update for 4.15 as well as the MAP_SYNC patch set for -next exposure.
It has some collisions with code already pending in -next. My proposed
merge resolution is here:

https://git.kernel.org/pub/scm/linux/kernel/git/djbw/nvdimm.git/log/?h=
libnvdimm-vs-next-20171102

---
commit 2adeca04276acb4e747dbe7a5668efe03b164566
Merge: fa8785e862ef c29c91a9daa3
Author: Dan Williams <dan.j.williams@intel.com>
Date:   Thu Nov 2 19:20:59 2017 -0700

    Merge branch 'libnvdimm-for-next' into test

diff --cc fs/dax.c
index 3652b26a0048,78233c716757..f3a7fb804a50
--- a/fs/dax.c
+++ b/fs/dax.c
@@@ -825,38 -820,42 +825,42 @@@ out
  }
  EXPORT_SYMBOL_GPL(dax_writeback_mapping_range);
  
- static int dax_insert_mapping(struct address_space *mapping,
- 		struct block_device *bdev, struct dax_device *dax_dev,
- 		sector_t sector, size_t size, void *entry,
- 		struct vm_area_struct *vma, struct vm_fault *vmf)
+ static sector_t dax_iomap_sector(struct iomap *iomap, loff_t pos)
  {
- 	unsigned long vaddr = vmf->address;
- 	void *ret, *kaddr;
 -	return iomap->blkno + (((pos & PAGE_MASK) - iomap->offset) >> 9);
++	return (iomap->addr + (pos & PAGE_MASK) - iomap->offset) >> 9;
+ }
+ 
+ static int dax_iomap_pfn(struct iomap *iomap, loff_t pos, size_t size,
+ 			 pfn_t *pfnp)
+ {
+ 	const sector_t sector = dax_iomap_sector(iomap, pos);
  	pgoff_t pgoff;
+ 	void *kaddr;
  	int id, rc;
- 	pfn_t pfn;
+ 	long length;
  
- 	rc = bdev_dax_pgoff(bdev, sector, size, &pgoff);
+ 	rc = bdev_dax_pgoff(iomap->bdev, sector, size, &pgoff);
  	if (rc)
  		return rc;
- 
  	id = dax_read_lock();
- 	rc = dax_direct_access(dax_dev, pgoff, PHYS_PFN(size), &kaddr, &pfn);
- 	if (rc < 0) {
- 		dax_read_unlock(id);
- 		return rc;
+ 	length = dax_direct_access(iomap->dax_dev, pgoff, PHYS_PFN(size),
+ 				   &kaddr, pfnp);
+ 	if (length < 0) {
+ 		rc = length;
+ 		goto out;
  	}
+ 	rc = -EINVAL;
+ 	if (PFN_PHYS(length) < size)
+ 		goto out;
+ 	if (pfn_t_to_pfn(*pfnp) & (PHYS_PFN(size)-1))
+ 		goto out;
+ 	/* For larger pages we need devmap */
+ 	if (length > 1 && !pfn_t_devmap(*pfnp))
+ 		goto out;
+ 	rc = 0;
+ out:
  	dax_read_unlock(id);
- 
- 	ret = dax_insert_mapping_entry(mapping, vmf, entry, sector, 0);
- 	if (IS_ERR(ret))
- 		return PTR_ERR(ret);
- 
- 	trace_dax_insert_mapping(mapping->host, vmf, ret);
- 	if (vmf->flags & FAULT_FLAG_WRITE)
- 		return vm_insert_mixed_mkwrite(vma, vaddr, pfn);
- 	else
- 		return vm_insert_mixed(vma, vaddr, pfn);
+ 	return rc;
  }
  
  /*
diff --cc fs/ext4/inode.c
index 59d31fec67ae,13a198924a0f..7250861f0f7b
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@@ -3383,6 -3393,20 +3383,19 @@@ static int ext4_releasepage(struct pag
  		return try_to_free_buffers(page);
  }
  
 -#ifdef CONFIG_FS_DAX
+ static bool ext4_inode_datasync_dirty(struct inode *inode)
+ {
+ 	journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
+ 
+ 	if (journal)
+ 		return !jbd2_transaction_committed(journal,
+ 					EXT4_I(inode)->i_datasync_tid);
+ 	/* Any metadata buffers to write? */
+ 	if (!list_empty(&inode->i_mapping->private_list))
+ 		return true;
+ 	return inode->i_state & I_DIRTY_DATASYNC;
+ }
+ 
  static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
  			    unsigned flags, struct iomap *iomap)
  {
diff --cc include/linux/iomap.h
index a61be86710b5,73e3b7085dbe..a309d611d380
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@@ -21,8 -21,12 +21,13 @@@ struct vm_fault
  /*
   * Flags for all iomap mappings:
   */
 -#define IOMAP_F_NEW	0x01	/* blocks have been newly allocated */
 +#define IOMAP_F_NEW		0x01	/* blocks have been newly allocated */
 +#define IOMAP_F_BOUNDARY	0x02	/* mapping ends at metadata boundary */
+ /*
+  * IOMAP_F_DIRTY indicates the inode has uncommitted metadata needed to access
+  * written data and requires fdatasync to commit them to persistent storage.
+  */
 -#define IOMAP_F_DIRTY	0x02
++#define IOMAP_F_DIRTY		0x04
  
  /*
   * Flags that only need to be reported for IOMAP_REPORT requests:

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-11-03  3:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-03  3:20 MAP_SYNC in libnvdimm-for-next and collision fixups Williams, Dan J

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox