Skip to content

Commit 359c92c

Browse files
committed
Merge tag 'dax-fixes-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull dax fixes from Dan Williams: "A fix for an xfstest failure and some and an update that removes an fsdax dependency on block devices. Summary: - Fix RWF_NOWAIT writes to properly return -EAGAIN - Clean up an unused helper - Update dax_writeback_mapping_range to not need a block_device argument" * tag 'dax-fixes-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: dax: pass NOWAIT flag to iomap_apply dax: Get rid of fs_dax_get_by_host() helper dax: Pass dax_dev instead of bdev to dax_writeback_mapping_range()
2 parents 61a7595 + 96222d5 commit 359c92c

File tree

6 files changed

+12
-24
lines changed

6 files changed

+12
-24
lines changed

drivers/dax/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev)
6161
{
6262
if (!blk_queue_dax(bdev->bd_queue))
6363
return NULL;
64-
return fs_dax_get_by_host(bdev->bd_disk->disk_name);
64+
return dax_get_by_host(bdev->bd_disk->disk_name);
6565
}
6666
EXPORT_SYMBOL_GPL(fs_dax_get_by_bdev);
6767
#endif

fs/dax.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -937,12 +937,11 @@ static int dax_writeback_one(struct xa_state *xas, struct dax_device *dax_dev,
937937
* on persistent storage prior to completion of the operation.
938938
*/
939939
int dax_writeback_mapping_range(struct address_space *mapping,
940-
struct block_device *bdev, struct writeback_control *wbc)
940+
struct dax_device *dax_dev, struct writeback_control *wbc)
941941
{
942942
XA_STATE(xas, &mapping->i_pages, wbc->range_start >> PAGE_SHIFT);
943943
struct inode *inode = mapping->host;
944944
pgoff_t end_index = wbc->range_end >> PAGE_SHIFT;
945-
struct dax_device *dax_dev;
946945
void *entry;
947946
int ret = 0;
948947
unsigned int scanned = 0;
@@ -953,10 +952,6 @@ int dax_writeback_mapping_range(struct address_space *mapping,
953952
if (!mapping->nrexceptional || wbc->sync_mode != WB_SYNC_ALL)
954953
return 0;
955954

956-
dax_dev = dax_get_by_host(bdev->bd_disk->disk_name);
957-
if (!dax_dev)
958-
return -EIO;
959-
960955
trace_dax_writeback_range(inode, xas.xa_index, end_index);
961956

962957
tag_pages_for_writeback(mapping, xas.xa_index, end_index);
@@ -977,7 +972,6 @@ int dax_writeback_mapping_range(struct address_space *mapping,
977972
xas_lock_irq(&xas);
978973
}
979974
xas_unlock_irq(&xas);
980-
put_dax(dax_dev);
981975
trace_dax_writeback_range_done(inode, xas.xa_index, end_index);
982976
return ret;
983977
}
@@ -1207,6 +1201,9 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
12071201
lockdep_assert_held(&inode->i_rwsem);
12081202
}
12091203

1204+
if (iocb->ki_flags & IOCB_NOWAIT)
1205+
flags |= IOMAP_NOWAIT;
1206+
12101207
while (iov_iter_count(iter)) {
12111208
ret = iomap_apply(inode, pos, iov_iter_count(iter), flags, ops,
12121209
iter, dax_iomap_actor);

fs/ext2/inode.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -960,8 +960,9 @@ ext2_writepages(struct address_space *mapping, struct writeback_control *wbc)
960960
static int
961961
ext2_dax_writepages(struct address_space *mapping, struct writeback_control *wbc)
962962
{
963-
return dax_writeback_mapping_range(mapping,
964-
mapping->host->i_sb->s_bdev, wbc);
963+
struct ext2_sb_info *sbi = EXT2_SB(mapping->host->i_sb);
964+
965+
return dax_writeback_mapping_range(mapping, sbi->s_daxdev, wbc);
965966
}
966967

967968
const struct address_space_operations ext2_aops = {

fs/ext4/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2867,7 +2867,7 @@ static int ext4_dax_writepages(struct address_space *mapping,
28672867
percpu_down_read(&sbi->s_journal_flag_rwsem);
28682868
trace_ext4_writepages(inode, wbc);
28692869

2870-
ret = dax_writeback_mapping_range(mapping, inode->i_sb->s_bdev, wbc);
2870+
ret = dax_writeback_mapping_range(mapping, sbi->s_daxdev, wbc);
28712871
trace_ext4_writepages_result(inode, wbc, ret,
28722872
nr_to_write - wbc->nr_to_write);
28732873
percpu_up_read(&sbi->s_journal_flag_rwsem);

fs/xfs/xfs_aops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ xfs_dax_writepages(
587587

588588
xfs_iflags_clear(ip, XFS_ITRUNCATED);
589589
return dax_writeback_mapping_range(mapping,
590-
xfs_inode_buftarg(ip)->bt_bdev, wbc);
590+
xfs_inode_buftarg(ip)->bt_daxdev, wbc);
591591
}
592592

593593
STATIC sector_t

include/linux/dax.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,14 @@ static inline bool generic_fsdax_supported(struct dax_device *dax_dev,
129129
sectors);
130130
}
131131

132-
static inline struct dax_device *fs_dax_get_by_host(const char *host)
133-
{
134-
return dax_get_by_host(host);
135-
}
136-
137132
static inline void fs_put_dax(struct dax_device *dax_dev)
138133
{
139134
put_dax(dax_dev);
140135
}
141136

142137
struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev);
143138
int dax_writeback_mapping_range(struct address_space *mapping,
144-
struct block_device *bdev, struct writeback_control *wbc);
139+
struct dax_device *dax_dev, struct writeback_control *wbc);
145140

146141
struct page *dax_layout_busy_page(struct address_space *mapping);
147142
dax_entry_t dax_lock_page(struct page *page);
@@ -160,11 +155,6 @@ static inline bool generic_fsdax_supported(struct dax_device *dax_dev,
160155
return false;
161156
}
162157

163-
static inline struct dax_device *fs_dax_get_by_host(const char *host)
164-
{
165-
return NULL;
166-
}
167-
168158
static inline void fs_put_dax(struct dax_device *dax_dev)
169159
{
170160
}
@@ -180,7 +170,7 @@ static inline struct page *dax_layout_busy_page(struct address_space *mapping)
180170
}
181171

182172
static inline int dax_writeback_mapping_range(struct address_space *mapping,
183-
struct block_device *bdev, struct writeback_control *wbc)
173+
struct dax_device *dax_dev, struct writeback_control *wbc)
184174
{
185175
return -EOPNOTSUPP;
186176
}

0 commit comments

Comments
 (0)