diff mbox series

[31/52] dax: Pass dax_dev to dax_writeback_mapping_range()

Message ID 20181210171318.16998-32-vgoyal@redhat.com (mailing list archive)
State New, archived
Headers show
Series virtio-fs: shared file system for virtual machines | expand

Commit Message

Vivek Goyal Dec. 10, 2018, 5:12 p.m. UTC
Right now dax_writeback_mapping_range() is passed a bdev and dax_dev
is searched from that bdev name.

virtio-fs does not have a bdev. So pass in dax_dev also to
dax_writeback_mapping_range(). If dax_dev is passed in, bdev is not
used otherwise dax_dev is searched using bdev.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
 fs/dax.c            | 16 ++++++++++------
 fs/ext4/inode.c     |  2 +-
 fs/xfs/xfs_aops.c   |  2 +-
 include/linux/dax.h |  6 ++++--
 4 files changed, 16 insertions(+), 10 deletions(-)

Comments

kernel test robot Dec. 11, 2018, 6:12 a.m. UTC | #1
Hi Vivek,

I love your patch! Yet something to improve:

[auto build test ERROR on fuse/for-next]
[also build test ERROR on v4.20-rc6]
[cannot apply to next-20181210]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Vivek-Goyal/virtio-fs-shared-file-system-for-virtual-machines/20181211-103034
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git for-next
config: i386-randconfig-x006-201849 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   fs//ext2/inode.c: In function 'ext2_dax_writepages':
>> fs//ext2/inode.c:959:33: error: passing argument 3 of 'dax_writeback_mapping_range' from incompatible pointer type [-Werror=incompatible-pointer-types]
       mapping->host->i_sb->s_bdev, wbc);
                                    ^~~
   In file included from fs//ext2/inode.c:29:0:
   include/linux/dax.h:120:19: note: expected 'struct dax_device *' but argument is of type 'struct writeback_control *'
    static inline int dax_writeback_mapping_range(struct address_space *mapping,
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> fs//ext2/inode.c:958:9: error: too few arguments to function 'dax_writeback_mapping_range'
     return dax_writeback_mapping_range(mapping,
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from fs//ext2/inode.c:29:0:
   include/linux/dax.h:120:19: note: declared here
    static inline int dax_writeback_mapping_range(struct address_space *mapping,
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/dax_writeback_mapping_range +959 fs//ext2/inode.c

7f6d5b52 Ross Zwisler   2016-02-26  954  
fb094c90 Dan Williams   2017-12-21  955  static int
fb094c90 Dan Williams   2017-12-21  956  ext2_dax_writepages(struct address_space *mapping, struct writeback_control *wbc)
fb094c90 Dan Williams   2017-12-21  957  {
fb094c90 Dan Williams   2017-12-21 @958  	return dax_writeback_mapping_range(mapping,
fb094c90 Dan Williams   2017-12-21 @959  			mapping->host->i_sb->s_bdev, wbc);
^1da177e Linus Torvalds 2005-04-16  960  }
^1da177e Linus Torvalds 2005-04-16  961  

:::::: The code at line 959 was first introduced by commit
:::::: fb094c90748fbeba1063927eeb751add147b35b9 ext2, dax: introduce ext2_dax_aops

:::::: TO: Dan Williams <dan.j.williams@intel.com>
:::::: CC: Dan Williams <dan.j.williams@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Dec. 11, 2018, 5:38 p.m. UTC | #2
Hi Vivek,

I love your patch! Perhaps something to improve:

[auto build test WARNING on fuse/for-next]
[also build test WARNING on v4.20-rc6]
[cannot apply to next-20181211]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Vivek-Goyal/virtio-fs-shared-file-system-for-virtual-machines/20181211-103034
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git for-next
config: arm64-allmodconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=arm64 

All warnings (new ones prefixed by >>):

   fs/ext2/inode.c: In function 'ext2_dax_writepages':
   fs/ext2/inode.c:959:33: error: passing argument 3 of 'dax_writeback_mapping_range' from incompatible pointer type [-Werror=incompatible-pointer-types]
       mapping->host->i_sb->s_bdev, wbc);
                                    ^~~
   In file included from fs/ext2/inode.c:29:0:
   include/linux/dax.h:87:5: note: expected 'struct dax_device *' but argument is of type 'struct writeback_control *'
    int dax_writeback_mapping_range(struct address_space *mapping,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ext2/inode.c:958:9: error: too few arguments to function 'dax_writeback_mapping_range'
     return dax_writeback_mapping_range(mapping,
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from fs/ext2/inode.c:29:0:
   include/linux/dax.h:87:5: note: declared here
    int dax_writeback_mapping_range(struct address_space *mapping,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>> fs/ext2/inode.c:960:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^
   cc1: some warnings being treated as errors

vim +960 fs/ext2/inode.c

7f6d5b52 Ross Zwisler   2016-02-26  954  
fb094c90 Dan Williams   2017-12-21  955  static int
fb094c90 Dan Williams   2017-12-21  956  ext2_dax_writepages(struct address_space *mapping, struct writeback_control *wbc)
fb094c90 Dan Williams   2017-12-21  957  {
fb094c90 Dan Williams   2017-12-21 @958  	return dax_writeback_mapping_range(mapping,
fb094c90 Dan Williams   2017-12-21  959  			mapping->host->i_sb->s_bdev, wbc);
^1da177e Linus Torvalds 2005-04-16 @960  }
^1da177e Linus Torvalds 2005-04-16  961  

:::::: The code at line 960 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

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

Patch

diff --git a/fs/dax.c b/fs/dax.c
index 6431c3aba182..1ae3a60c17d4 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -911,12 +911,12 @@  static int dax_writeback_one(struct xa_state *xas, struct dax_device *dax_dev,
  * on persistent storage prior to completion of the operation.
  */
 int dax_writeback_mapping_range(struct address_space *mapping,
-		struct block_device *bdev, struct writeback_control *wbc)
+		struct block_device *bdev, struct dax_device *dax_dev,
+		struct writeback_control *wbc)
 {
 	XA_STATE(xas, &mapping->i_pages, wbc->range_start >> PAGE_SHIFT);
 	struct inode *inode = mapping->host;
 	pgoff_t end_index = wbc->range_end >> PAGE_SHIFT;
-	struct dax_device *dax_dev;
 	void *entry;
 	int ret = 0;
 	unsigned int scanned = 0;
@@ -927,9 +927,12 @@  int dax_writeback_mapping_range(struct address_space *mapping,
 	if (!mapping->nrexceptional || wbc->sync_mode != WB_SYNC_ALL)
 		return 0;
 
-	dax_dev = dax_get_by_host(bdev->bd_disk->disk_name);
-	if (!dax_dev)
-		return -EIO;
+	if (bdev) {
+		WARN_ON(dax_dev);
+		dax_dev = dax_get_by_host(bdev->bd_disk->disk_name);
+		if (!dax_dev)
+			return -EIO;
+	}
 
 	trace_dax_writeback_range(inode, xas.xa_index, end_index);
 
@@ -951,7 +954,8 @@  int dax_writeback_mapping_range(struct address_space *mapping,
 		xas_lock_irq(&xas);
 	}
 	xas_unlock_irq(&xas);
-	put_dax(dax_dev);
+	if (bdev)
+		put_dax(dax_dev);
 	trace_dax_writeback_range_done(inode, xas.xa_index, end_index);
 	return ret;
 }
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 22a9d8159720..3569c260a3bd 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2978,7 +2978,7 @@  static int ext4_dax_writepages(struct address_space *mapping,
 	percpu_down_read(&sbi->s_journal_flag_rwsem);
 	trace_ext4_writepages(inode, wbc);
 
-	ret = dax_writeback_mapping_range(mapping, inode->i_sb->s_bdev, wbc);
+	ret = dax_writeback_mapping_range(mapping, inode->i_sb->s_bdev, NULL, wbc);
 	trace_ext4_writepages_result(inode, wbc, ret,
 				     nr_to_write - wbc->nr_to_write);
 	percpu_up_read(&sbi->s_journal_flag_rwsem);
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 338b9d9984e0..b1947beec50a 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -951,7 +951,7 @@  xfs_dax_writepages(
 {
 	xfs_iflags_clear(XFS_I(mapping->host), XFS_ITRUNCATED);
 	return dax_writeback_mapping_range(mapping,
-			xfs_find_bdev_for_inode(mapping->host), wbc);
+			xfs_find_bdev_for_inode(mapping->host), NULL, wbc);
 }
 
 STATIC int
diff --git a/include/linux/dax.h b/include/linux/dax.h
index 450b28db9533..a8461841f148 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -85,7 +85,8 @@  static inline void fs_put_dax(struct dax_device *dax_dev)
 
 struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev);
 int dax_writeback_mapping_range(struct address_space *mapping,
-		struct block_device *bdev, struct writeback_control *wbc);
+		struct block_device *bdev, struct dax_device *dax_dev,
+		struct writeback_control *wbc);
 
 struct page *dax_layout_busy_page(struct address_space *mapping);
 bool dax_lock_mapping_entry(struct page *page);
@@ -117,7 +118,8 @@  static inline struct page *dax_layout_busy_page(struct address_space *mapping)
 }
 
 static inline int dax_writeback_mapping_range(struct address_space *mapping,
-		struct block_device *bdev, struct writeback_control *wbc)
+		struct block_device *bdev, struct dax_device *dax_dev,
+		struct writeback_control *wbc)
 {
 	return -EOPNOTSUPP;
 }