Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1641704

[PATCH 2/2] fs: xfs: add DAX dependency

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject [PATCH 2/2] fs: xfs: add DAX dependency
Date 2017-05-15 15:50 +0200
Message-ID <tHoxQ-pi-25@gated-at.bofh.it> (permalink)
References <tHoxP-pi-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


We can now build xfs while CONFIG_DAX is set to 'm', resulting in a
link error when xfs is built-in:

fs/xfs/xfs_iomap.o: In function `xfs_file_iomap_end':
fs/xfs/xfs_iomap.c:1152: undefined reference to `put_dax'
fs/xfs/xfs_iomap.o: In function `xfs_file_iomap_begin':
fs/xfs/xfs_iomap.c:1071: undefined reference to `dax_get_by_host'

Previously, XFS could only be built with CONFIG_DAX=y because of
the CONFIG_BLOCK dependency. The other users of dax handle this
differently:

- In ext2 and ext4, there are checks for CONFIG_FS_DAX around every
  API usage, and CONFIG_FS_DAX is only enabled when CONFIG_DAX is
  built-in.

- CONFIG_BLK_DEV_MD implies 'select DAX', so it's always enabled
  there as well.

This changes XFS to do the same as ext2/4 and only call into the
API conditionally.

Fixes: ef51042472f5 ("block, dax: move "select DAX" from BLOCK to FS_DAX")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/xfs/xfs_iomap.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index a63f61c256bd..b732ba6f892c 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -1067,7 +1067,7 @@ xfs_file_iomap_begin(
 
 	/* optionally associate a dax device with the iomap bdev */
 	bdev = iomap->bdev;
-	if (blk_queue_dax(bdev->bd_queue))
+	if (IS_ENABLED(CONFIG_FS_DAX) && blk_queue_dax(bdev->bd_queue))
 		iomap->dax_dev = dax_get_by_host(bdev->bd_disk->disk_name);
 	else
 		iomap->dax_dev = NULL;
@@ -1149,7 +1149,9 @@ xfs_file_iomap_end(
 	unsigned		flags,
 	struct iomap		*iomap)
 {
-	put_dax(iomap->dax_dev);
+	if (IS_ENABLED(CONFIG_FS_DAX))
+		put_dax(iomap->dax_dev);
+
 	if ((flags & IOMAP_WRITE) && iomap->type == IOMAP_DELALLOC)
 		return xfs_file_iomap_end_delalloc(XFS_I(inode), offset,
 				length, written, iomap);
-- 
2.9.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] dax: hide block device code in #ifdef Arnd Bergmann <arnd@arndb.de> - 2017-05-15 15:50 +0200
  [PATCH 2/2] fs: xfs: add DAX dependency Arnd Bergmann <arnd@arndb.de> - 2017-05-15 15:50 +0200
  Re: [PATCH 1/2] dax: hide block device code in #ifdef Dan Williams <dan.j.williams@intel.com> - 2017-05-15 16:20 +0200
    Re: [PATCH 1/2] dax: hide block device code in #ifdef Arnd Bergmann <arnd@arndb.de> - 2017-05-15 16:30 +0200
      Re: [PATCH 1/2] dax: hide block device code in #ifdef "Darrick J. Wong" <darrick.wong@oracle.com> - 2017-05-15 18:00 +0200
        Re: [PATCH 1/2] dax: hide block device code in #ifdef Arnd Bergmann <arnd@arndb.de> - 2017-05-16 13:20 +0200

csiph-web