Skip to content

Commit 60b8340

Browse files
Christoph Hellwigdjbw
authored andcommitted
dax: stub out dax_supported for !CONFIG_FS_DAX
dax_supported calls into ->dax_supported which checks for fsdax support. Don't bother building it for !CONFIG_FS_DAX as it will always return false. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Dan Williams <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dan Williams <[email protected]>
1 parent cd93a2a commit 60b8340

File tree

2 files changed

+28
-26
lines changed

2 files changed

+28
-26
lines changed

drivers/dax/super.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,24 @@ bool generic_fsdax_supported(struct dax_device *dax_dev,
201201
return true;
202202
}
203203
EXPORT_SYMBOL_GPL(generic_fsdax_supported);
204+
205+
bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,
206+
int blocksize, sector_t start, sector_t len)
207+
{
208+
bool ret = false;
209+
int id;
210+
211+
if (!dax_dev)
212+
return false;
213+
214+
id = dax_read_lock();
215+
if (dax_alive(dax_dev) && dax_dev->ops->dax_supported)
216+
ret = dax_dev->ops->dax_supported(dax_dev, bdev, blocksize,
217+
start, len);
218+
dax_read_unlock(id);
219+
return ret;
220+
}
221+
EXPORT_SYMBOL_GPL(dax_supported);
204222
#endif /* CONFIG_FS_DAX */
205223

206224
/**
@@ -350,24 +368,6 @@ long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages,
350368
}
351369
EXPORT_SYMBOL_GPL(dax_direct_access);
352370

353-
bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,
354-
int blocksize, sector_t start, sector_t len)
355-
{
356-
bool ret = false;
357-
int id;
358-
359-
if (!dax_dev)
360-
return false;
361-
362-
id = dax_read_lock();
363-
if (dax_alive(dax_dev) && dax_dev->ops->dax_supported)
364-
ret = dax_dev->ops->dax_supported(dax_dev, bdev, blocksize,
365-
start, len);
366-
dax_read_unlock(id);
367-
return ret;
368-
}
369-
EXPORT_SYMBOL_GPL(dax_supported);
370-
371371
size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
372372
size_t bytes, struct iov_iter *i)
373373
{

include/linux/dax.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ static inline void set_dax_synchronous(struct dax_device *dax_dev)
5757
{
5858
__set_dax_synchronous(dax_dev);
5959
}
60-
bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,
61-
int blocksize, sector_t start, sector_t len);
6260
/*
6361
* Check if given mapping is supported by the file / underlying device.
6462
*/
@@ -101,12 +99,6 @@ static inline bool dax_synchronous(struct dax_device *dax_dev)
10199
static inline void set_dax_synchronous(struct dax_device *dax_dev)
102100
{
103101
}
104-
static inline bool dax_supported(struct dax_device *dax_dev,
105-
struct block_device *bdev, int blocksize, sector_t start,
106-
sector_t len)
107-
{
108-
return false;
109-
}
110102
static inline bool daxdev_mapping_supported(struct vm_area_struct *vma,
111103
struct dax_device *dax_dev)
112104
{
@@ -127,6 +119,9 @@ bool generic_fsdax_supported(struct dax_device *dax_dev,
127119
struct block_device *bdev, int blocksize, sector_t start,
128120
sector_t sectors);
129121

122+
bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,
123+
int blocksize, sector_t start, sector_t len);
124+
130125
static inline void fs_put_dax(struct dax_device *dax_dev)
131126
{
132127
put_dax(dax_dev);
@@ -149,6 +144,13 @@ static inline bool bdev_dax_supported(struct block_device *bdev,
149144

150145
#define generic_fsdax_supported NULL
151146

147+
static inline bool dax_supported(struct dax_device *dax_dev,
148+
struct block_device *bdev, int blocksize, sector_t start,
149+
sector_t len)
150+
{
151+
return false;
152+
}
153+
152154
static inline void fs_put_dax(struct dax_device *dax_dev)
153155
{
154156
}

0 commit comments

Comments
 (0)