DAX: use proper length when the range is not aligned to PAGE_SIZE
Subsystems (2)
PATCH 1/1 DAX: use proper length when the range is not aligned to PAGE_SIZE
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.
--- fs/dax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/dax.c +1 -1
@@ -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)
Signature · 1 line
2.5.5
Jan Kara
reviewerQuoted 5 lines · Liu Bo
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 oneget_blockby sending two blocks together toget_block.Signed-off-by Liu Bo <[email protected]>
Thanks for the patch but this code is going to be ripped out soon (in the next merge window) in favor of iomap DAX implementation. So there's not much point in fixing this...
Honza
Quoted 20 lines
--- fs/dax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/dax.c +1
-1@@ -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)Signature · 1 line
2.5.5
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Quoted 10 lines · Jan Kara
Quoted 5 lines · Liu Bo
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 oneget_blockby sending two blocks together toget_block.Signed-off-by Liu Bo <[email protected]>Thanks for the patch but this code is going to be ripped out soon (in the next merge window) in favor of iomap DAX implementation. So there's not much point in fixing this...
I see, thanks for the explanation.
Thanks,
-liubo
Quoted 26 lines
Honza
Quoted 20 lines
--- fs/dax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/dax.c +1
-1@@ -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)Signature · 1 line
2.5.5Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR