aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-19 20:35:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-19 20:35:34 -0400
commit8c3fc1643d13ff70110701d08beaf77dc20c7c0a (patch)
tree23f9688fe2ddcff44fb46fc9d84bac37e91e1e9a
parent0bdc6fd2329e51b9659d5192f4281493c15e95b3 (diff)
parentf5705aa8cfed142d980ecac12bee0d81b756479e (diff)
Merge branch 'libnvdimm-for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm fixes from Dan Williams: "A couple of compile fixes. With the removal of the ->direct_access() method from block_device_operations in favor of a new dax_device + dax_operations we broke two configurations. The CONFIG_BLOCK=n case is fixed by compiling out the block+dax helpers in the dax core. Configurations with FS_DAX=n EXT4=y / XFS=y and DAX=m fail due to the helpers the builtin filesystem needs being in a module, so we stub out the helpers in the FS_DAX=n case." * 'libnvdimm-for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: dax, xfs, ext4: compile out iomap-dax paths in the FS_DAX=n case dax: fix false CONFIG_BLOCK dependency
-rw-r--r--drivers/dax/super.c2
-rw-r--r--fs/ext2/inode.c4
-rw-r--r--fs/ext4/inode.c4
-rw-r--r--fs/xfs/xfs_iomap.c4
-rw-r--r--include/linux/dax.h34
5 files changed, 35 insertions, 13 deletions
diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index ebf43f531ada..6ed32aac8bbe 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -44,6 +44,7 @@ void dax_read_unlock(int id)
44} 44}
45EXPORT_SYMBOL_GPL(dax_read_unlock); 45EXPORT_SYMBOL_GPL(dax_read_unlock);
46 46
47#ifdef CONFIG_BLOCK
47int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size, 48int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size,
48 pgoff_t *pgoff) 49 pgoff_t *pgoff)
49{ 50{
@@ -112,6 +113,7 @@ int __bdev_dax_supported(struct super_block *sb, int blocksize)
112 return 0; 113 return 0;
113} 114}
114EXPORT_SYMBOL_GPL(__bdev_dax_supported); 115EXPORT_SYMBOL_GPL(__bdev_dax_supported);
116#endif
115 117
116/** 118/**
117 * struct dax_device - anchor object for dax services 119 * struct dax_device - anchor object for dax services
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 26d77f9f8c12..2dcbd5698884 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -817,7 +817,7 @@ static int ext2_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
817 iomap->bdev = bdev; 817 iomap->bdev = bdev;
818 iomap->offset = (u64)first_block << blkbits; 818 iomap->offset = (u64)first_block << blkbits;
819 if (blk_queue_dax(bdev->bd_queue)) 819 if (blk_queue_dax(bdev->bd_queue))
820 iomap->dax_dev = dax_get_by_host(bdev->bd_disk->disk_name); 820 iomap->dax_dev = fs_dax_get_by_host(bdev->bd_disk->disk_name);
821 else 821 else
822 iomap->dax_dev = NULL; 822 iomap->dax_dev = NULL;
823 823
@@ -841,7 +841,7 @@ static int
841ext2_iomap_end(struct inode *inode, loff_t offset, loff_t length, 841ext2_iomap_end(struct inode *inode, loff_t offset, loff_t length,
842 ssize_t written, unsigned flags, struct iomap *iomap) 842 ssize_t written, unsigned flags, struct iomap *iomap)
843{ 843{
844 put_dax(iomap->dax_dev); 844 fs_put_dax(iomap->dax_dev);
845 if (iomap->type == IOMAP_MAPPED && 845 if (iomap->type == IOMAP_MAPPED &&
846 written < length && 846 written < length &&
847 (flags & IOMAP_WRITE)) 847 (flags & IOMAP_WRITE))
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 5834c4d76be8..1bd0bfa547f6 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3412,7 +3412,7 @@ retry:
3412 bdev = inode->i_sb->s_bdev; 3412 bdev = inode->i_sb->s_bdev;
3413 iomap->bdev = bdev; 3413 iomap->bdev = bdev;
3414 if (blk_queue_dax(bdev->bd_queue)) 3414 if (blk_queue_dax(bdev->bd_queue))
3415 iomap->dax_dev = dax_get_by_host(bdev->bd_disk->disk_name); 3415 iomap->dax_dev = fs_dax_get_by_host(bdev->bd_disk->disk_name);
3416 else 3416 else
3417 iomap->dax_dev = NULL; 3417 iomap->dax_dev = NULL;
3418 iomap->offset = first_block << blkbits; 3418 iomap->offset = first_block << blkbits;
@@ -3447,7 +3447,7 @@ static int ext4_iomap_end(struct inode *inode, loff_t offset, loff_t length,
3447 int blkbits = inode->i_blkbits; 3447 int blkbits = inode->i_blkbits;
3448 bool truncate = false; 3448 bool truncate = false;
3449 3449
3450 put_dax(iomap->dax_dev); 3450 fs_put_dax(iomap->dax_dev);
3451 if (!(flags & IOMAP_WRITE) || (flags & IOMAP_FAULT)) 3451 if (!(flags & IOMAP_WRITE) || (flags & IOMAP_FAULT))
3452 return 0; 3452 return 0;
3453 3453
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index a63f61c256bd..94e5bdf7304c 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -1068,7 +1068,7 @@ xfs_file_iomap_begin(
1068 /* optionally associate a dax device with the iomap bdev */ 1068 /* optionally associate a dax device with the iomap bdev */
1069 bdev = iomap->bdev; 1069 bdev = iomap->bdev;
1070 if (blk_queue_dax(bdev->bd_queue)) 1070 if (blk_queue_dax(bdev->bd_queue))
1071 iomap->dax_dev = dax_get_by_host(bdev->bd_disk->disk_name); 1071 iomap->dax_dev = fs_dax_get_by_host(bdev->bd_disk->disk_name);
1072 else 1072 else
1073 iomap->dax_dev = NULL; 1073 iomap->dax_dev = NULL;
1074 1074
@@ -1149,7 +1149,7 @@ xfs_file_iomap_end(
1149 unsigned flags, 1149 unsigned flags,
1150 struct iomap *iomap) 1150 struct iomap *iomap)
1151{ 1151{
1152 put_dax(iomap->dax_dev); 1152 fs_put_dax(iomap->dax_dev);
1153 if ((flags & IOMAP_WRITE) && iomap->type == IOMAP_DELALLOC) 1153 if ((flags & IOMAP_WRITE) && iomap->type == IOMAP_DELALLOC)
1154 return xfs_file_iomap_end_delalloc(XFS_I(inode), offset, 1154 return xfs_file_iomap_end_delalloc(XFS_I(inode), offset,
1155 length, written, iomap); 1155 length, written, iomap);
diff --git a/include/linux/dax.h b/include/linux/dax.h
index 00ebac854bb7..5ec1f6c47716 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -18,6 +18,20 @@ struct dax_operations {
18 void **, pfn_t *); 18 void **, pfn_t *);
19}; 19};
20 20
21#if IS_ENABLED(CONFIG_DAX)
22struct dax_device *dax_get_by_host(const char *host);
23void put_dax(struct dax_device *dax_dev);
24#else
25static inline struct dax_device *dax_get_by_host(const char *host)
26{
27 return NULL;
28}
29
30static inline void put_dax(struct dax_device *dax_dev)
31{
32}
33#endif
34
21int bdev_dax_pgoff(struct block_device *, sector_t, size_t, pgoff_t *pgoff); 35int bdev_dax_pgoff(struct block_device *, sector_t, size_t, pgoff_t *pgoff);
22#if IS_ENABLED(CONFIG_FS_DAX) 36#if IS_ENABLED(CONFIG_FS_DAX)
23int __bdev_dax_supported(struct super_block *sb, int blocksize); 37int __bdev_dax_supported(struct super_block *sb, int blocksize);
@@ -25,23 +39,29 @@ static inline int bdev_dax_supported(struct super_block *sb, int blocksize)
25{ 39{
26 return __bdev_dax_supported(sb, blocksize); 40 return __bdev_dax_supported(sb, blocksize);
27} 41}
42
43static inline struct dax_device *fs_dax_get_by_host(const char *host)
44{
45 return dax_get_by_host(host);
46}
47
48static inline void fs_put_dax(struct dax_device *dax_dev)
49{
50 put_dax(dax_dev);
51}
52
28#else 53#else
29static inline int bdev_dax_supported(struct super_block *sb, int blocksize) 54static inline int bdev_dax_supported(struct super_block *sb, int blocksize)
30{ 55{
31 return -EOPNOTSUPP; 56 return -EOPNOTSUPP;
32} 57}
33#endif
34 58
35#if IS_ENABLED(CONFIG_DAX) 59static inline struct dax_device *fs_dax_get_by_host(const char *host)
36struct dax_device *dax_get_by_host(const char *host);
37void put_dax(struct dax_device *dax_dev);
38#else
39static inline struct dax_device *dax_get_by_host(const char *host)
40{ 60{
41 return NULL; 61 return NULL;
42} 62}
43 63
44static inline void put_dax(struct dax_device *dax_dev) 64static inline void fs_put_dax(struct dax_device *dax_dev)
45{ 65{
46} 66}
47#endif 67#endif