mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [f2fs-dev][PATCH v2] udf: avoid redundant memcpy when writing data in ICB
@ 2014-07-15  1:38 Chao Yu
  2014-07-15 14:35 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Chao Yu @ 2014-07-15  1:38 UTC (permalink / raw)
  To: jack; +Cc: linux-kernel

Valid data within i_size in page cache will be copied to ICB cache when we
writeback the page by invoking udf_adinicb_writepage, so the copy in
udf_adinicb_write_end is redundant.
After we remove the copy, it's better to use simple_write_end directly in
udf_adinicb_aops instead of udf_adinicb_write_end.

v2:
 o fix to remove redundant code correctly and use simple_write_end directly in
udf_adinicb_aops pointed out by Jan Kara.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
---
 fs/udf/file.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/fs/udf/file.c b/fs/udf/file.c
index d80738f..3d06489 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -100,24 +100,6 @@ static int udf_adinicb_write_begin(struct file *file,
 	return 0;
 }
 
-static int udf_adinicb_write_end(struct file *file,
-			struct address_space *mapping,
-			loff_t pos, unsigned len, unsigned copied,
-			struct page *page, void *fsdata)
-{
-	struct inode *inode = mapping->host;
-	unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
-	char *kaddr;
-	struct udf_inode_info *iinfo = UDF_I(inode);
-
-	kaddr = kmap_atomic(page);
-	memcpy(iinfo->i_ext.i_data + iinfo->i_lenEAttr + offset,
-		kaddr + offset, copied);
-	kunmap_atomic(kaddr);
-
-	return simple_write_end(file, mapping, pos, len, copied, page, fsdata);
-}
-
 static ssize_t udf_adinicb_direct_IO(int rw, struct kiocb *iocb,
 				     struct iov_iter *iter,
 				     loff_t offset)
@@ -130,7 +112,7 @@ const struct address_space_operations udf_adinicb_aops = {
 	.readpage	= udf_adinicb_readpage,
 	.writepage	= udf_adinicb_writepage,
 	.write_begin	= udf_adinicb_write_begin,
-	.write_end	= udf_adinicb_write_end,
+	.write_end	= simple_write_end,
 	.direct_IO	= udf_adinicb_direct_IO,
 };
 
-- 
2.0.1.474.g72c7794



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

* Re: [f2fs-dev][PATCH v2] udf: avoid redundant memcpy when writing data in ICB
  2014-07-15  1:38 [f2fs-dev][PATCH v2] udf: avoid redundant memcpy when writing data in ICB Chao Yu
@ 2014-07-15 14:35 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2014-07-15 14:35 UTC (permalink / raw)
  To: Chao Yu; +Cc: jack, linux-kernel

On Tue 15-07-14 09:38:51, Chao Yu wrote:
> Valid data within i_size in page cache will be copied to ICB cache when we
> writeback the page by invoking udf_adinicb_writepage, so the copy in
> udf_adinicb_write_end is redundant.
> After we remove the copy, it's better to use simple_write_end directly in
> udf_adinicb_aops instead of udf_adinicb_write_end.
> 
> v2:
>  o fix to remove redundant code correctly and use simple_write_end directly in
> udf_adinicb_aops pointed out by Jan Kara.
  Thanks! I've merged the patch.

								Honza
> 
> Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> ---
>  fs/udf/file.c | 20 +-------------------
>  1 file changed, 1 insertion(+), 19 deletions(-)
> 
> diff --git a/fs/udf/file.c b/fs/udf/file.c
> index d80738f..3d06489 100644
> --- a/fs/udf/file.c
> +++ b/fs/udf/file.c
> @@ -100,24 +100,6 @@ static int udf_adinicb_write_begin(struct file *file,
>  	return 0;
>  }
>  
> -static int udf_adinicb_write_end(struct file *file,
> -			struct address_space *mapping,
> -			loff_t pos, unsigned len, unsigned copied,
> -			struct page *page, void *fsdata)
> -{
> -	struct inode *inode = mapping->host;
> -	unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
> -	char *kaddr;
> -	struct udf_inode_info *iinfo = UDF_I(inode);
> -
> -	kaddr = kmap_atomic(page);
> -	memcpy(iinfo->i_ext.i_data + iinfo->i_lenEAttr + offset,
> -		kaddr + offset, copied);
> -	kunmap_atomic(kaddr);
> -
> -	return simple_write_end(file, mapping, pos, len, copied, page, fsdata);
> -}
> -
>  static ssize_t udf_adinicb_direct_IO(int rw, struct kiocb *iocb,
>  				     struct iov_iter *iter,
>  				     loff_t offset)
> @@ -130,7 +112,7 @@ const struct address_space_operations udf_adinicb_aops = {
>  	.readpage	= udf_adinicb_readpage,
>  	.writepage	= udf_adinicb_writepage,
>  	.write_begin	= udf_adinicb_write_begin,
> -	.write_end	= udf_adinicb_write_end,
> +	.write_end	= simple_write_end,
>  	.direct_IO	= udf_adinicb_direct_IO,
>  };
>  
> -- 
> 2.0.1.474.g72c7794
> 
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

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

end of thread, other threads:[~2014-07-15 14:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-15  1:38 [f2fs-dev][PATCH v2] udf: avoid redundant memcpy when writing data in ICB Chao Yu
2014-07-15 14:35 ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®