All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: remove redundant calls to flush_dcache_page
@ 2022-06-01 11:47 David Sterba
  2022-06-01 12:14 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2022-06-01 11:47 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

memzero_page already calls flush_dcache_page so we can remove the calls
from btrfs code.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/compression.c | 2 --
 fs/btrfs/extent_io.c   | 7 +------
 fs/btrfs/inode.c       | 6 ++----
 fs/btrfs/reflink.c     | 5 +----
 4 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 6ab82e142f1f..2536754656b6 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -760,7 +760,6 @@ static noinline int add_ra_bio_pages(struct inode *inode,
 				int zeros;
 				zeros = PAGE_SIZE - zero_offset;
 				memzero_page(page, zero_offset, zeros);
-				flush_dcache_page(page);
 			}
 		}
 
@@ -1476,7 +1475,6 @@ int btrfs_decompress_buf2page(const char *buf, u32 buf_len,
 		ASSERT(copy_start - decompressed < buf_len);
 		memcpy_to_page(bvec.bv_page, bvec.bv_offset,
 			       buf + copy_start - decompressed, copy_len);
-		flush_dcache_page(bvec.bv_page);
 		cur_offset += copy_len;
 
 		bio_advance(orig_bio, copy_len);
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index b3122700dfbf..b9d431ed20b4 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3639,7 +3639,6 @@ static int btrfs_do_readpage(struct page *page, struct extent_map **em_cached,
 		if (zero_offset) {
 			iosize = PAGE_SIZE - zero_offset;
 			memzero_page(page, zero_offset, iosize);
-			flush_dcache_page(page);
 		}
 	}
 	begin_page_read(fs_info, page);
@@ -3654,7 +3653,6 @@ static int btrfs_do_readpage(struct page *page, struct extent_map **em_cached,
 
 			iosize = PAGE_SIZE - pg_offset;
 			memzero_page(page, pg_offset, iosize);
-			flush_dcache_page(page);
 			set_extent_uptodate(tree, cur, cur + iosize - 1,
 					    &cached, GFP_NOFS);
 			unlock_extent_cached(tree, cur,
@@ -3738,7 +3736,6 @@ static int btrfs_do_readpage(struct page *page, struct extent_map **em_cached,
 			struct extent_state *cached = NULL;
 
 			memzero_page(page, pg_offset, iosize);
-			flush_dcache_page(page);
 
 			set_extent_uptodate(tree, cur, cur + iosize - 1,
 					    &cached, GFP_NOFS);
@@ -4156,10 +4153,8 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
 		return 0;
 	}
 
-	if (page->index == end_index) {
+	if (page->index == end_index)
 		memzero_page(page, pg_offset, PAGE_SIZE - pg_offset);
-		flush_dcache_page(page);
-	}
 
 	ret = set_page_extent_mapped(page);
 	if (ret < 0) {
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index ba913ea6f4d1..ca7e8214e45b 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4872,7 +4872,6 @@ int btrfs_truncate_block(struct btrfs_inode *inode, loff_t from, loff_t len,
 		else
 			memzero_page(page, (block_start - page_offset(page)) + offset,
 				     len);
-		flush_dcache_page(page);
 	}
 	btrfs_page_clear_checked(fs_info, page, block_start,
 				 block_end + 1 - block_start);
@@ -8585,10 +8584,9 @@ vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf)
 	else
 		zero_start = PAGE_SIZE;
 
-	if (zero_start != PAGE_SIZE) {
+	if (zero_start != PAGE_SIZE)
 		memzero_page(page, zero_start, PAGE_SIZE - zero_start);
-		flush_dcache_page(page);
-	}
+
 	btrfs_page_clear_checked(fs_info, page, page_start, PAGE_SIZE);
 	btrfs_page_set_dirty(fs_info, page, page_start, end + 1 - page_start);
 	btrfs_page_set_uptodate(fs_info, page, page_start, end + 1 - page_start);
diff --git a/fs/btrfs/reflink.c b/fs/btrfs/reflink.c
index c39f8b3a5a4a..c01fcbf22bb5 100644
--- a/fs/btrfs/reflink.c
+++ b/fs/btrfs/reflink.c
@@ -110,7 +110,6 @@ static int copy_inline_to_page(struct btrfs_inode *inode,
 	if (comp_type == BTRFS_COMPRESS_NONE) {
 		memcpy_to_page(page, offset_in_page(file_offset), data_start,
 			       datal);
-		flush_dcache_page(page);
 	} else {
 		ret = btrfs_decompress(comp_type, data_start, page,
 				       offset_in_page(file_offset),
@@ -132,10 +131,8 @@ static int copy_inline_to_page(struct btrfs_inode *inode,
 	 *
 	 * So what's in the range [500, 4095] corresponds to zeroes.
 	 */
-	if (datal < block_size) {
+	if (datal < block_size)
 		memzero_page(page, datal, block_size - datal);
-		flush_dcache_page(page);
-	}
 
 	btrfs_page_set_uptodate(fs_info, page, file_offset, block_size);
 	btrfs_page_clear_checked(fs_info, page, file_offset, block_size);
-- 
2.36.1


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

* Re: [PATCH] btrfs: remove redundant calls to flush_dcache_page
  2022-06-01 11:47 [PATCH] btrfs: remove redundant calls to flush_dcache_page David Sterba
@ 2022-06-01 12:14 ` Christoph Hellwig
  2022-06-01 12:44   ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2022-06-01 12:14 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs

On Wed, Jun 01, 2022 at 01:47:54PM +0200, David Sterba wrote:
> memzero_page already calls flush_dcache_page so we can remove the calls
> from btrfs code.

This is for a mix of memcpy_to_page and memzero_page, but the statement
is true for both of them.  So with a slightly fixed commit log:

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH] btrfs: remove redundant calls to flush_dcache_page
  2022-06-01 12:14 ` Christoph Hellwig
@ 2022-06-01 12:44   ` David Sterba
  0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2022-06-01 12:44 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: David Sterba, linux-btrfs

On Wed, Jun 01, 2022 at 05:14:21AM -0700, Christoph Hellwig wrote:
> On Wed, Jun 01, 2022 at 01:47:54PM +0200, David Sterba wrote:
> > memzero_page already calls flush_dcache_page so we can remove the calls
> > from btrfs code.
> 
> This is for a mix of memcpy_to_page and memzero_page, but the statement
> is true for both of them.  So with a slightly fixed commit log:

Right, I'll update it, thanks.

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

end of thread, other threads:[~2022-06-01 12:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01 11:47 [PATCH] btrfs: remove redundant calls to flush_dcache_page David Sterba
2022-06-01 12:14 ` Christoph Hellwig
2022-06-01 12:44   ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.