summaryrefslogtreecommitdiffstats
path: root/fs/dax.c
diff options
context:
space:
mode:
authorRoss Zwisler2016-11-08 01:31:14 +0100
committerDave Chinner2016-11-08 01:31:14 +0100
commitfa0d3fce7ceff0aae62f3e19678713bc5a7f3377 (patch)
treebc8d3241926aed790b10ae1a440f2c6298a6ae90 /fs/dax.c
parentext4: tell DAX the size of allocation holes (diff)
downloadkernel-qcow2-linux-fa0d3fce7ceff0aae62f3e19678713bc5a7f3377.tar.gz
kernel-qcow2-linux-fa0d3fce7ceff0aae62f3e19678713bc5a7f3377.tar.xz
kernel-qcow2-linux-fa0d3fce7ceff0aae62f3e19678713bc5a7f3377.zip
dax: remove buffer_size_valid()
Now that ext4 properly sets bh.b_size when we call get_block() for a hole, rely on that value and remove the buffer_size_valid() sanity check. Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/dax.c')
-rw-r--r--fs/dax.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/fs/dax.c b/fs/dax.c
index 014defd2e744..b09817ac6f87 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -123,19 +123,6 @@ static bool buffer_written(struct buffer_head *bh)
return buffer_mapped(bh) && !buffer_unwritten(bh);
}
-/*
- * When ext4 encounters a hole, it returns without modifying the buffer_head
- * which means that we can't trust b_size. To cope with this, we set b_state
- * to 0 before calling get_block and, if any bit is set, we know we can trust
- * b_size. Unfortunate, really, since ext4 knows precisely how long a hole is
- * and would save us time calling get_block repeatedly.
- */
-static bool buffer_size_valid(struct buffer_head *bh)
-{
- return bh->b_state != 0;
-}
-
-
static sector_t to_sector(const struct buffer_head *bh,
const struct inode *inode)
{
@@ -177,8 +164,6 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
rc = get_block(inode, block, bh, rw == WRITE);
if (rc)
break;
- if (!buffer_size_valid(bh))
- bh->b_size = 1 << blkbits;
bh_max = pos - first + bh->b_size;
bdev = bh->b_bdev;
/*
@@ -1012,12 +997,7 @@ int dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
bdev = bh.b_bdev;
- /*
- * If the filesystem isn't willing to tell us the length of a hole,
- * just fall back to PTEs. Calling get_block 512 times in a loop
- * would be silly.
- */
- if (!buffer_size_valid(&bh) || bh.b_size < PMD_SIZE) {
+ if (bh.b_size < PMD_SIZE) {
dax_pmd_dbg(&bh, address, "allocated block too small");
return VM_FAULT_FALLBACK;
}