Skip to content

Commit bdd3c50

Browse files
Christoph Hellwigdjbw
authored andcommitted
dax: remove bdev_dax_supported
All callers already have a dax_device obtained from fs_dax_get_by_bdev at hand, so just pass that to dax_supported() insted of doing another lookup. 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 a384f08 commit bdd3c50

File tree

5 files changed

+7
-56
lines changed

5 files changed

+7
-56
lines changed

drivers/dax/super.c

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -220,47 +220,7 @@ bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,
220220
}
221221
EXPORT_SYMBOL_GPL(dax_supported);
222222
#endif /* CONFIG_FS_DAX */
223-
224-
/**
225-
* __bdev_dax_supported() - Check if the device supports dax for filesystem
226-
* @bdev: block device to check
227-
* @blocksize: The block size of the device
228-
*
229-
* This is a library function for filesystems to check if the block device
230-
* can be mounted with dax option.
231-
*
232-
* Return: true if supported, false if unsupported
233-
*/
234-
bool __bdev_dax_supported(struct block_device *bdev, int blocksize)
235-
{
236-
struct dax_device *dax_dev;
237-
struct request_queue *q;
238-
char buf[BDEVNAME_SIZE];
239-
bool ret;
240-
241-
q = bdev_get_queue(bdev);
242-
if (!q || !blk_queue_dax(q)) {
243-
pr_debug("%s: error: request queue doesn't support dax\n",
244-
bdevname(bdev, buf));
245-
return false;
246-
}
247-
248-
dax_dev = dax_get_by_host(bdev->bd_disk->disk_name);
249-
if (!dax_dev) {
250-
pr_debug("%s: error: device does not support dax\n",
251-
bdevname(bdev, buf));
252-
return false;
253-
}
254-
255-
ret = dax_supported(dax_dev, bdev, blocksize, 0,
256-
i_size_read(bdev->bd_inode) / 512);
257-
258-
put_dax(dax_dev);
259-
260-
return ret;
261-
}
262-
EXPORT_SYMBOL_GPL(__bdev_dax_supported);
263-
#endif
223+
#endif /* CONFIG_BLOCK */
264224

265225
enum dax_device_flags {
266226
/* !alive + rcu grace period == no new operations / mappings */

fs/ext2/super.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
949949
blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);
950950

951951
if (test_opt(sb, DAX)) {
952-
if (!bdev_dax_supported(sb->s_bdev, blocksize)) {
952+
if (!dax_supported(dax_dev, sb->s_bdev, blocksize, 0,
953+
bdev_nr_sectors(sb->s_bdev))) {
953954
ext2_msg(sb, KERN_ERR,
954955
"DAX unsupported by block device. Turning off DAX.");
955956
clear_opt(sbi->s_mount_opt, DAX);

fs/ext4/super.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4435,7 +4435,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
44354435
goto failed_mount;
44364436
}
44374437

4438-
if (bdev_dax_supported(sb->s_bdev, blocksize))
4438+
if (dax_supported(dax_dev, sb->s_bdev, blocksize, 0,
4439+
bdev_nr_sectors(sb->s_bdev)))
44394440
set_bit(EXT4_FLAGS_BDEV_IS_DAX, &sbi->s_ext4_flags);
44404441

44414442
if (sbi->s_mount_opt & EXT4_MOUNT_DAX_ALWAYS) {

fs/xfs/xfs_super.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,8 @@ xfs_buftarg_is_dax(
319319
struct super_block *sb,
320320
struct xfs_buftarg *bt)
321321
{
322-
return bdev_dax_supported(bt->bt_bdev, sb->s_blocksize);
322+
return dax_supported(bt->bt_daxdev, bt->bt_bdev, sb->s_blocksize, 0,
323+
bdev_nr_sectors(bt->bt_bdev));
323324
}
324325

325326
STATIC int

include/linux/dax.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,6 @@ static inline bool daxdev_mapping_supported(struct vm_area_struct *vma,
109109
struct writeback_control;
110110
int bdev_dax_pgoff(struct block_device *, sector_t, size_t, pgoff_t *pgoff);
111111
#if IS_ENABLED(CONFIG_FS_DAX)
112-
bool __bdev_dax_supported(struct block_device *bdev, int blocksize);
113-
static inline bool bdev_dax_supported(struct block_device *bdev, int blocksize)
114-
{
115-
return __bdev_dax_supported(bdev, blocksize);
116-
}
117-
118112
bool generic_fsdax_supported(struct dax_device *dax_dev,
119113
struct block_device *bdev, int blocksize, sector_t start,
120114
sector_t sectors);
@@ -136,12 +130,6 @@ struct page *dax_layout_busy_page_range(struct address_space *mapping, loff_t st
136130
dax_entry_t dax_lock_page(struct page *page);
137131
void dax_unlock_page(struct page *page, dax_entry_t cookie);
138132
#else
139-
static inline bool bdev_dax_supported(struct block_device *bdev,
140-
int blocksize)
141-
{
142-
return false;
143-
}
144-
145133
#define generic_fsdax_supported NULL
146134

147135
static inline bool dax_supported(struct dax_device *dax_dev,

0 commit comments

Comments
 (0)