Skip to content

Commit

Permalink
Merge tag 'dax-fixes-5.6-rc1' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/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()
  • Loading branch information
torvalds committed Feb 12, 2020
2 parents 61a7595 + 96222d5 commit 359c92c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 24 deletions.
2 changes: 1 addition & 1 deletion drivers/dax/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev)
{
if (!blk_queue_dax(bdev->bd_queue))
return NULL;
return fs_dax_get_by_host(bdev->bd_disk->disk_name);
return dax_get_by_host(bdev->bd_disk->disk_name);
}
EXPORT_SYMBOL_GPL(fs_dax_get_by_bdev);
#endif
Expand Down
11 changes: 4 additions & 7 deletions fs/dax.c
Original file line number Diff line number Diff line change
Expand Up @@ -937,12 +937,11 @@ static int dax_writeback_one(struct xa_state *xas, struct dax_device *dax_dev,
* on persistent storage prior to completion of the operation.
*/
int dax_writeback_mapping_range(struct address_space *mapping,
struct block_device *bdev, struct writeback_control *wbc)
struct dax_device *dax_dev, struct writeback_control *wbc)
{
XA_STATE(xas, &mapping->i_pages, wbc->range_start >> PAGE_SHIFT);
struct inode *inode = mapping->host;
pgoff_t end_index = wbc->range_end >> PAGE_SHIFT;
struct dax_device *dax_dev;
void *entry;
int ret = 0;
unsigned int scanned = 0;
Expand All @@ -953,10 +952,6 @@ int dax_writeback_mapping_range(struct address_space *mapping,
if (!mapping->nrexceptional || wbc->sync_mode != WB_SYNC_ALL)
return 0;

dax_dev = dax_get_by_host(bdev->bd_disk->disk_name);
if (!dax_dev)
return -EIO;

trace_dax_writeback_range(inode, xas.xa_index, end_index);

tag_pages_for_writeback(mapping, xas.xa_index, end_index);
Expand All @@ -977,7 +972,6 @@ int dax_writeback_mapping_range(struct address_space *mapping,
xas_lock_irq(&xas);
}
xas_unlock_irq(&xas);
put_dax(dax_dev);
trace_dax_writeback_range_done(inode, xas.xa_index, end_index);
return ret;
}
Expand Down Expand Up @@ -1207,6 +1201,9 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
lockdep_assert_held(&inode->i_rwsem);
}

if (iocb->ki_flags & IOCB_NOWAIT)
flags |= IOMAP_NOWAIT;

while (iov_iter_count(iter)) {
ret = iomap_apply(inode, pos, iov_iter_count(iter), flags, ops,
iter, dax_iomap_actor);
Expand Down
5 changes: 3 additions & 2 deletions fs/ext2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -960,8 +960,9 @@ ext2_writepages(struct address_space *mapping, struct writeback_control *wbc)
static int
ext2_dax_writepages(struct address_space *mapping, struct writeback_control *wbc)
{
return dax_writeback_mapping_range(mapping,
mapping->host->i_sb->s_bdev, wbc);
struct ext2_sb_info *sbi = EXT2_SB(mapping->host->i_sb);

return dax_writeback_mapping_range(mapping, sbi->s_daxdev, wbc);
}

const struct address_space_operations ext2_aops = {
Expand Down
2 changes: 1 addition & 1 deletion fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2867,7 +2867,7 @@ static int ext4_dax_writepages(struct address_space *mapping,
percpu_down_read(&sbi->s_journal_flag_rwsem);
trace_ext4_writepages(inode, wbc);

ret = dax_writeback_mapping_range(mapping, inode->i_sb->s_bdev, wbc);
ret = dax_writeback_mapping_range(mapping, sbi->s_daxdev, wbc);
trace_ext4_writepages_result(inode, wbc, ret,
nr_to_write - wbc->nr_to_write);
percpu_up_read(&sbi->s_journal_flag_rwsem);
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/xfs_aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ xfs_dax_writepages(

xfs_iflags_clear(ip, XFS_ITRUNCATED);
return dax_writeback_mapping_range(mapping,
xfs_inode_buftarg(ip)->bt_bdev, wbc);
xfs_inode_buftarg(ip)->bt_daxdev, wbc);
}

STATIC sector_t
Expand Down
14 changes: 2 additions & 12 deletions include/linux/dax.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,14 @@ static inline bool generic_fsdax_supported(struct dax_device *dax_dev,
sectors);
}

static inline struct dax_device *fs_dax_get_by_host(const char *host)
{
return dax_get_by_host(host);
}

static inline void fs_put_dax(struct dax_device *dax_dev)
{
put_dax(dax_dev);
}

struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev);
int dax_writeback_mapping_range(struct address_space *mapping,
struct block_device *bdev, struct writeback_control *wbc);
struct dax_device *dax_dev, struct writeback_control *wbc);

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

static inline struct dax_device *fs_dax_get_by_host(const char *host)
{
return NULL;
}

static inline void fs_put_dax(struct dax_device *dax_dev)
{
}
Expand All @@ -180,7 +170,7 @@ static inline struct page *dax_layout_busy_page(struct address_space *mapping)
}

static inline int dax_writeback_mapping_range(struct address_space *mapping,
struct block_device *bdev, struct writeback_control *wbc)
struct dax_device *dax_dev, struct writeback_control *wbc)
{
return -EOPNOTSUPP;
}
Expand Down

0 comments on commit 359c92c

Please sign in to comment.