diff options
author | Ross Zwisler <ross.zwisler@linux.intel.com> | 2016-02-26 18:19:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-02-27 13:28:52 -0500 |
commit | 20a90f58997245749c2bdfaea9e51f785ec90d0b (patch) | |
tree | 540cbf9b1ffd509b82bdf6f1c38d9dcba8c59f91 /fs/xfs | |
parent | 73f34a5e2ceddfca27c999c170620e6354aaf6d7 (diff) |
dax: give DAX clearing code correct bdev
dax_clear_blocks() needs a valid struct block_device and previously it
was using inode->i_sb->s_bdev in all cases. This is correct for normal
inodes on mounted ext2, ext4 and XFS filesystems, but is incorrect for
DAX raw block devices and for XFS real-time devices.
Instead, rename dax_clear_blocks() to dax_clear_sectors(), and change
its arguments to take a bdev and a sector instead of an inode and a
block. This better reflects what the function does, and it allows the
filesystem and raw block device code to pass in an appropriate struct
block_device.
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Suggested-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Al Viro <viro@ftp.linux.org.uk>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Jens Axboe <axboe@fb.com>
Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_aops.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_aops.h | 1 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap_util.c | 3 |
3 files changed, 4 insertions, 2 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 379c089fb051..fc20518e2398 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c | |||
@@ -55,7 +55,7 @@ xfs_count_page_state( | |||
55 | } while ((bh = bh->b_this_page) != head); | 55 | } while ((bh = bh->b_this_page) != head); |
56 | } | 56 | } |
57 | 57 | ||
58 | STATIC struct block_device * | 58 | struct block_device * |
59 | xfs_find_bdev_for_inode( | 59 | xfs_find_bdev_for_inode( |
60 | struct inode *inode) | 60 | struct inode *inode) |
61 | { | 61 | { |
diff --git a/fs/xfs/xfs_aops.h b/fs/xfs/xfs_aops.h index f6ffc9ae5ceb..a4343c63fb38 100644 --- a/fs/xfs/xfs_aops.h +++ b/fs/xfs/xfs_aops.h | |||
@@ -62,5 +62,6 @@ int xfs_get_blocks_dax_fault(struct inode *inode, sector_t offset, | |||
62 | struct buffer_head *map_bh, int create); | 62 | struct buffer_head *map_bh, int create); |
63 | 63 | ||
64 | extern void xfs_count_page_state(struct page *, int *, int *); | 64 | extern void xfs_count_page_state(struct page *, int *, int *); |
65 | extern struct block_device *xfs_find_bdev_for_inode(struct inode *); | ||
65 | 66 | ||
66 | #endif /* __XFS_AOPS_H__ */ | 67 | #endif /* __XFS_AOPS_H__ */ |
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 45ec9e40150c..6c876012b2e5 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c | |||
@@ -75,7 +75,8 @@ xfs_zero_extent( | |||
75 | ssize_t size = XFS_FSB_TO_B(mp, count_fsb); | 75 | ssize_t size = XFS_FSB_TO_B(mp, count_fsb); |
76 | 76 | ||
77 | if (IS_DAX(VFS_I(ip))) | 77 | if (IS_DAX(VFS_I(ip))) |
78 | return dax_clear_blocks(VFS_I(ip), block, size); | 78 | return dax_clear_sectors(xfs_find_bdev_for_inode(VFS_I(ip)), |
79 | sector, size); | ||
79 | 80 | ||
80 | /* | 81 | /* |
81 | * let the block layer decide on the fastest method of | 82 | * let the block layer decide on the fastest method of |