linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 1/1 linux-next] btrfs: don't opencode zero_user_segment
@ 2014-10-14 17:46 Fabian Frederick
  2014-10-14 19:15 ` Zach Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Fabian Frederick @ 2014-10-14 17:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: Fabian Frederick, Chris Mason, Josef Bacik, linux-btrfs

use function defined in include/linux/highmem.h
Note that this reverts 2 last function call order

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/btrfs/scrub.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index efa0831..fa063cd 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -1503,13 +1503,9 @@ static int scrub_write_page_to_dev_replace(struct scrub_block *sblock,
 	struct scrub_page *spage = sblock->pagev[page_num];
 
 	BUG_ON(spage->page == NULL);
-	if (spage->io_error) {
-		void *mapped_buffer = kmap_atomic(spage->page);
+	if (spage->io_error)
+		zero_user_segment(spage->page, 0, PAGE_CACHE_SIZE);
 
-		memset(mapped_buffer, 0, PAGE_CACHE_SIZE);
-		flush_dcache_page(spage->page);
-		kunmap_atomic(mapped_buffer);
-	}
 	return scrub_add_page_to_wr_bio(sblock->sctx, spage);
 }
 
-- 
1.9.3


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

* Re: [RFC 1/1 linux-next] btrfs: don't opencode zero_user_segment
  2014-10-14 17:46 [RFC 1/1 linux-next] btrfs: don't opencode zero_user_segment Fabian Frederick
@ 2014-10-14 19:15 ` Zach Brown
  2014-10-14 20:18   ` Fabian Frederick
  0 siblings, 1 reply; 4+ messages in thread
From: Zach Brown @ 2014-10-14 19:15 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: linux-kernel, Chris Mason, Josef Bacik, linux-btrfs

On Tue, Oct 14, 2014 at 07:46:14PM +0200, Fabian Frederick wrote:
> use function defined in include/linux/highmem.h
> Note that this reverts 2 last function call order

And adds a BUG_ON(PAGE_CACHE_SIZE > PAGE_SIZE).  We can take bets on
whether that will ever trigger.

- z

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

* Re: [RFC 1/1 linux-next] btrfs: don't opencode zero_user_segment
  2014-10-14 19:15 ` Zach Brown
@ 2014-10-14 20:18   ` Fabian Frederick
  2014-10-15 17:08     ` Zach Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Fabian Frederick @ 2014-10-14 20:18 UTC (permalink / raw)
  To: Zach Brown; +Cc: Josef Bacik, linux-kernel, linux-btrfs, Chris Mason



> On 14 October 2014 at 21:15 Zach Brown <zab@zabbo.net> wrote:
>
>
> On Tue, Oct 14, 2014 at 07:46:14PM +0200, Fabian Frederick wrote:
> > use function defined in include/linux/highmem.h
> > Note that this reverts 2 last function call order
>
> And adds a BUG_ON(PAGE_CACHE_SIZE > PAGE_SIZE).  We can take bets on
> whether that will ever trigger.

There are 36 zero_user_segment with PAGE_CACHE_SIZE callsites.
Maybe we could add some specific function to avoid BUG_ON tests ?

Fabian
>
> - z

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

* Re: [RFC 1/1 linux-next] btrfs: don't opencode zero_user_segment
  2014-10-14 20:18   ` Fabian Frederick
@ 2014-10-15 17:08     ` Zach Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Zach Brown @ 2014-10-15 17:08 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: Josef Bacik, linux-kernel, linux-btrfs, Chris Mason

On Tue, Oct 14, 2014 at 10:18:09PM +0200, Fabian Frederick wrote:
> 
> 
> > On 14 October 2014 at 21:15 Zach Brown <zab@zabbo.net> wrote:
> >
> >
> > On Tue, Oct 14, 2014 at 07:46:14PM +0200, Fabian Frederick wrote:
> > > use function defined in include/linux/highmem.h
> > > Note that this reverts 2 last function call order
> >
> > And adds a BUG_ON(PAGE_CACHE_SIZE > PAGE_SIZE).  We can take bets on
> > whether that will ever trigger.
> 
> There are 36 zero_user_segment with PAGE_CACHE_SIZE callsites.
> Maybe we could add some specific function to avoid BUG_ON tests ?

Nah, I wouldn't bother.

A lot of us have long rolled our eyes at the distinction between
PAGE_SIZE and PAGE_CACHE_SIZE given how much will break if they're ever
actually different.  That's what I was referencing there :).

- z 

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

end of thread, other threads:[~2014-10-15 17:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-14 17:46 [RFC 1/1 linux-next] btrfs: don't opencode zero_user_segment Fabian Frederick
2014-10-14 19:15 ` Zach Brown
2014-10-14 20:18   ` Fabian Frederick
2014-10-15 17:08     ` Zach Brown

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).