linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] DAX: use proper length when the range is not aligned to PAGE_SIZE
@ 2016-11-04 19:17 Liu Bo
  2016-11-04 21:48 ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: Liu Bo @ 2016-11-04 19:17 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Jan Kara, Ross Zwisler

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@oracle.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] DAX: use proper length when the range is not aligned to PAGE_SIZE
  2016-11-04 19:17 [PATCH] DAX: use proper length when the range is not aligned to PAGE_SIZE Liu Bo
@ 2016-11-04 21:48 ` Jan Kara
  2016-11-04 23:55   ` Liu Bo
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2016-11-04 21:48 UTC (permalink / raw)
  To: Liu Bo; +Cc: linux-fsdevel, Jan Kara, Ross Zwisler

On Fri 04-11-16 12:17:11, Liu Bo wrote:
> 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@oracle.com>

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

> ---
>  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
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] DAX: use proper length when the range is not aligned to PAGE_SIZE
  2016-11-04 21:48 ` Jan Kara
@ 2016-11-04 23:55   ` Liu Bo
  0 siblings, 0 replies; 3+ messages in thread
From: Liu Bo @ 2016-11-04 23:55 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-fsdevel, Ross Zwisler

On Fri, Nov 04, 2016 at 10:48:22PM +0100, Jan Kara wrote:
> On Fri 04-11-16 12:17:11, Liu Bo wrote:
> > 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@oracle.com>
> 
> 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
> 
> 								Honza
> 
> > ---
> >  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
> > 
> -- 
> Jan Kara <jack@suse.com>
> SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-04 23:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-04 19:17 [PATCH] DAX: use proper length when the range is not aligned to PAGE_SIZE Liu Bo
2016-11-04 21:48 ` Jan Kara
2016-11-04 23:55   ` Liu Bo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).