[PATCH] DAX: use proper length when the range is not aligned to PAGE_SIZE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently if we write to [2k, 6k] where pos is 2k and end is 6k,
get_block() will be called twice, but we can save one get_block
by sending two blocks together to get_block.

Signed-off-by: Liu Bo <bo.li.liu@xxxxxxxxxx>
---
 fs/dax.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/dax.c b/fs/dax.c
index 53eb6a0..8d4bd5f 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -172,7 +172,7 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
 			long size;
 
 			if (pos == bh_max) {
-				bh->b_size = PAGE_ALIGN(end - pos);
+				bh->b_size = PAGE_ALIGN(end - (pos - first));
 				bh->b_state = 0;
 				rc = get_block(inode, block, bh, rw == WRITE);
 				if (rc)
-- 
2.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux