All of lore.kernel.org
 help / color / mirror / Atom feed
* scrub backing device
@ 2016-04-29  2:13 ching lu
  2016-05-11  1:15 ` Eric Wheeler
  0 siblings, 1 reply; 10+ messages in thread
From: ching lu @ 2016-04-29  2:13 UTC (permalink / raw)
  To: linux-bcache

Hello,

i want to develop a script to perform data scrubbing periodically.

For my use case, i think it is meaningless to scrub cached data.

If i change the cache mode to "none", will it turn off the read cache too?

Furthermore, will this invalidate cached data? (i do not want to "warm
up" the cache again after the scrubbing)

Thanks in advance,
c

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

* Re: scrub backing device
  2016-04-29  2:13 scrub backing device ching lu
@ 2016-05-11  1:15 ` Eric Wheeler
  2016-05-11  1:36   ` ching lu
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Wheeler @ 2016-05-11  1:15 UTC (permalink / raw)
  To: ching lu; +Cc: linux-bcache

On Fri, 29 Apr 2016, ching lu wrote:

> Hello,
> 
> i want to develop a script to perform data scrubbing periodically.

I think you want to set dirty_percent to 0 and cache_mode=writethrough.  
Then wait a long time for dirty_percent to actually reach 0.

--
Eric Wheeler


> 
> For my use case, i think it is meaningless to scrub cached data.
> 
> If i change the cache mode to "none", will it turn off the read cache too?
> 
> Furthermore, will this invalidate cached data? (i do not want to "warm
> up" the cache again after the scrubbing)
> 
> Thanks in advance,
> c
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: scrub backing device
  2016-05-11  1:15 ` Eric Wheeler
@ 2016-05-11  1:36   ` ching lu
  2016-05-11 19:13     ` Eric Wheeler
  0 siblings, 1 reply; 10+ messages in thread
From: ching lu @ 2016-05-11  1:36 UTC (permalink / raw)
  To: Eric Wheeler; +Cc: linux-bcache

The read cache prevent the program to scrub the backing device directly.

if a few bits flipped in the backing device, the cache may still
return healthy data for a while.

Must i remove cache device before scrubbing?


On Wed, May 11, 2016 at 9:15 AM, Eric Wheeler <bcache@lists.ewheeler.net> wrote:
> On Fri, 29 Apr 2016, ching lu wrote:
>
>> Hello,
>>
>> i want to develop a script to perform data scrubbing periodically.
>
> I think you want to set dirty_percent to 0 and cache_mode=writethrough.
> Then wait a long time for dirty_percent to actually reach 0.
>
> --
> Eric Wheeler
>
>
>>
>> For my use case, i think it is meaningless to scrub cached data.
>>
>> If i change the cache mode to "none", will it turn off the read cache too?
>>
>> Furthermore, will this invalidate cached data? (i do not want to "warm
>> up" the cache again after the scrubbing)
>>
>> Thanks in advance,
>> c
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>

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

* Re: scrub backing device
  2016-05-11  1:36   ` ching lu
@ 2016-05-11 19:13     ` Eric Wheeler
  2016-05-11 23:34       ` ching
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Wheeler @ 2016-05-11 19:13 UTC (permalink / raw)
  To: ching lu; +Cc: linux-bcache

On Wed, 11 May 2016, ching lu wrote:

> The read cache prevent the program to scrub the backing device directly.
> 
> if a few bits flipped in the backing device, the cache may still
> return healthy data for a while.
> 
> Must i remove cache device before scrubbing?

What do you mean by scrub?

--
Eric Wheeler

> 
> 
> On Wed, May 11, 2016 at 9:15 AM, Eric Wheeler <bcache@lists.ewheeler.net> wrote:
> > On Fri, 29 Apr 2016, ching lu wrote:
> >
> >> Hello,
> >>
> >> i want to develop a script to perform data scrubbing periodically.
> >
> > I think you want to set dirty_percent to 0 and cache_mode=writethrough.
> > Then wait a long time for dirty_percent to actually reach 0.
> >
> > --
> > Eric Wheeler
> >
> >
> >>
> >> For my use case, i think it is meaningless to scrub cached data.
> >>
> >> If i change the cache mode to "none", will it turn off the read cache too?
> >>
> >> Furthermore, will this invalidate cached data? (i do not want to "warm
> >> up" the cache again after the scrubbing)
> >>
> >> Thanks in advance,
> >> c
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: scrub backing device
  2016-05-11 19:13     ` Eric Wheeler
@ 2016-05-11 23:34       ` ching
  2016-05-11 23:57         ` Marc MERLIN
  0 siblings, 1 reply; 10+ messages in thread
From: ching @ 2016-05-11 23:34 UTC (permalink / raw)
  To: Eric Wheeler; +Cc: linux-bcache

for example https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-scrub

On May 12, 2016 3:13:22 AM GMT+08:00, Eric Wheeler <bcache@lists.ewheeler.net> wrote:
>On Wed, 11 May 2016, ching lu wrote:
>
>> The read cache prevent the program to scrub the backing device
>directly.
>> 
>> if a few bits flipped in the backing device, the cache may still
>> return healthy data for a while.
>> 
>> Must i remove cache device before scrubbing?
>
>What do you mean by scrub?
>
>--
>Eric Wheeler
>
>> 
>> 
>> On Wed, May 11, 2016 at 9:15 AM, Eric Wheeler
><bcache@lists.ewheeler.net> wrote:
>> > On Fri, 29 Apr 2016, ching lu wrote:
>> >
>> >> Hello,
>> >>
>> >> i want to develop a script to perform data scrubbing periodically.
>> >
>> > I think you want to set dirty_percent to 0 and
>cache_mode=writethrough.
>> > Then wait a long time for dirty_percent to actually reach 0.
>> >
>> > --
>> > Eric Wheeler
>> >
>> >
>> >>
>> >> For my use case, i think it is meaningless to scrub cached data.
>> >>
>> >> If i change the cache mode to "none", will it turn off the read
>cache too?
>> >>
>> >> Furthermore, will this invalidate cached data? (i do not want to
>"warm
>> >> up" the cache again after the scrubbing)
>> >>
>> >> Thanks in advance,
>> >> c
>> >> --
>> >> To unsubscribe from this list: send the line "unsubscribe
>linux-bcache" in
>> >> the body of a message to majordomo@vger.kernel.org
>> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> >>
>> --
>> To unsubscribe from this list: send the line "unsubscribe
>linux-bcache" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> 

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

* Re: scrub backing device
  2016-05-11 23:34       ` ching
@ 2016-05-11 23:57         ` Marc MERLIN
  2016-05-12 10:25           ` ching
  2016-05-13 22:21           ` Kent Overstreet
  0 siblings, 2 replies; 10+ messages in thread
From: Marc MERLIN @ 2016-05-11 23:57 UTC (permalink / raw)
  To: ching; +Cc: Eric Wheeler, linux-bcache

On Thu, May 12, 2016 at 07:34:26AM +0800, ching wrote:
> for example https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-scrub
 
btrfs scrub is designed to make sure all the blocks and checksums are
consistent.
Ching makes a good point that it would be helpful to have a way to
access the underlying backing device directly to ensure it is
consistent.

I think currently you can use dmsetup with an offset to get the real
filesystem past the bcache header, mount that read only somewhere and
scrub that.
Not ideal because scrub will not be able to fix issues that are fixable,
but at least it should report errors.

Would that work?

Marc

> On May 12, 2016 3:13:22 AM GMT+08:00, Eric Wheeler <bcache@lists.ewheeler.net> wrote:
> >On Wed, 11 May 2016, ching lu wrote:
> >
> >> The read cache prevent the program to scrub the backing device
> >directly.
> >> 
> >> if a few bits flipped in the backing device, the cache may still
> >> return healthy data for a while.
> >> 
> >> Must i remove cache device before scrubbing?
> >
> >What do you mean by scrub?
> >
> >--
> >Eric Wheeler
> >
> >> 
> >> 
> >> On Wed, May 11, 2016 at 9:15 AM, Eric Wheeler
> ><bcache@lists.ewheeler.net> wrote:
> >> > On Fri, 29 Apr 2016, ching lu wrote:
> >> >
> >> >> Hello,
> >> >>
> >> >> i want to develop a script to perform data scrubbing periodically.
> >> >
> >> > I think you want to set dirty_percent to 0 and
> >cache_mode=writethrough.
> >> > Then wait a long time for dirty_percent to actually reach 0.
> >> >
> >> > --
> >> > Eric Wheeler
> >> >
> >> >
> >> >>
> >> >> For my use case, i think it is meaningless to scrub cached data.
> >> >>
> >> >> If i change the cache mode to "none", will it turn off the read
> >cache too?
> >> >>
> >> >> Furthermore, will this invalidate cached data? (i do not want to
> >"warm
> >> >> up" the cache again after the scrubbing)
> >> >>
> >> >> Thanks in advance,
> >> >> c
> >> >> --
> >> >> To unsubscribe from this list: send the line "unsubscribe
> >linux-bcache" in
> >> >> the body of a message to majordomo@vger.kernel.org
> >> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe
> >linux-bcache" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/                         | PGP 1024R/763BE901

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

* Re: scrub backing device
  2016-05-11 23:57         ` Marc MERLIN
@ 2016-05-12 10:25           ` ching
  2016-05-13 22:10             ` Marc MERLIN
  2016-05-13 22:21           ` Kent Overstreet
  1 sibling, 1 reply; 10+ messages in thread
From: ching @ 2016-05-12 10:25 UTC (permalink / raw)
  To: Marc MERLIN; +Cc: Eric Wheeler, linux-bcache

it may be a mess that if there is 2 btrfs partition (1 via bcache, 1 via dm) with same UUID appear at the same time.

https://btrfs.wiki.kernel.org/index.php/Gotchas

Currently, i think removing cache device would be simpler.


On May 12, 2016 7:57:48 AM GMT+08:00, Marc MERLIN <marc@merlins.org> wrote:
>On Thu, May 12, 2016 at 07:34:26AM +0800, ching wrote:
>> for example
>https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-scrub
> 
>btrfs scrub is designed to make sure all the blocks and checksums are
>consistent.
>Ching makes a good point that it would be helpful to have a way to
>access the underlying backing device directly to ensure it is
>consistent.
>
>I think currently you can use dmsetup with an offset to get the real
>filesystem past the bcache header, mount that read only somewhere and
>scrub that.
>Not ideal because scrub will not be able to fix issues that are
>fixable,
>but at least it should report errors.
>
>Would that work?
>
>Marc
>
>> On May 12, 2016 3:13:22 AM GMT+08:00, Eric Wheeler
><bcache@lists.ewheeler.net> wrote:
>> >On Wed, 11 May 2016, ching lu wrote:
>> >
>> >> The read cache prevent the program to scrub the backing device
>> >directly.
>> >> 
>> >> if a few bits flipped in the backing device, the cache may still
>> >> return healthy data for a while.
>> >> 
>> >> Must i remove cache device before scrubbing?
>> >
>> >What do you mean by scrub?
>> >
>> >--
>> >Eric Wheeler
>> >
>> >> 
>> >> 
>> >> On Wed, May 11, 2016 at 9:15 AM, Eric Wheeler
>> ><bcache@lists.ewheeler.net> wrote:
>> >> > On Fri, 29 Apr 2016, ching lu wrote:
>> >> >
>> >> >> Hello,
>> >> >>
>> >> >> i want to develop a script to perform data scrubbing
>periodically.
>> >> >
>> >> > I think you want to set dirty_percent to 0 and
>> >cache_mode=writethrough.
>> >> > Then wait a long time for dirty_percent to actually reach 0.
>> >> >
>> >> > --
>> >> > Eric Wheeler
>> >> >
>> >> >
>> >> >>
>> >> >> For my use case, i think it is meaningless to scrub cached
>data.
>> >> >>
>> >> >> If i change the cache mode to "none", will it turn off the read
>> >cache too?
>> >> >>
>> >> >> Furthermore, will this invalidate cached data? (i do not want
>to
>> >"warm
>> >> >> up" the cache again after the scrubbing)
>> >> >>
>> >> >> Thanks in advance,
>> >> >> c
>> >> >> --
>> >> >> To unsubscribe from this list: send the line "unsubscribe
>> >linux-bcache" in
>> >> >> the body of a message to majordomo@vger.kernel.org
>> >> >> More majordomo info at 
>http://vger.kernel.org/majordomo-info.html
>> >> >>
>> >> --
>> >> To unsubscribe from this list: send the line "unsubscribe
>> >linux-bcache" in
>> >> the body of a message to majordomo@vger.kernel.org
>> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> >> 
>> 
>> --
>> To unsubscribe from this list: send the line "unsubscribe
>linux-bcache" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> 

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

* Re: scrub backing device
  2016-05-12 10:25           ` ching
@ 2016-05-13 22:10             ` Marc MERLIN
  0 siblings, 0 replies; 10+ messages in thread
From: Marc MERLIN @ 2016-05-13 22:10 UTC (permalink / raw)
  To: ching; +Cc: Eric Wheeler, linux-bcache

On Thu, May 12, 2016 at 06:25:27PM +0800, ching wrote:
> it may be a mess that if there is 2 btrfs partition (1 via bcache, 1 via dm) with same UUID appear at the same time.
> 
> https://btrfs.wiki.kernel.org/index.php/Gotchas
> 
> Currently, i think removing cache device would be simpler.

You make a good point, and I agree with your assessment.

Marc
-- 
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/                         | PGP 1024R/763BE901

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

* Re: scrub backing device
  2016-05-11 23:57         ` Marc MERLIN
  2016-05-12 10:25           ` ching
@ 2016-05-13 22:21           ` Kent Overstreet
  2016-05-15 23:56             ` ching
  1 sibling, 1 reply; 10+ messages in thread
From: Kent Overstreet @ 2016-05-13 22:21 UTC (permalink / raw)
  To: Marc MERLIN; +Cc: ching, Eric Wheeler, linux-bcache

On Wed, May 11, 2016 at 04:57:48PM -0700, Marc MERLIN wrote:
> On Thu, May 12, 2016 at 07:34:26AM +0800, ching wrote:
> > for example https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-scrub
>  
> btrfs scrub is designed to make sure all the blocks and checksums are
> consistent.
> Ching makes a good point that it would be helpful to have a way to
> access the underlying backing device directly to ensure it is
> consistent.
> 
> I think currently you can use dmsetup with an offset to get the real
> filesystem past the bcache header, mount that read only somewhere and
> scrub that.
> Not ideal because scrub will not be able to fix issues that are fixable,
> but at least it should report errors.

Look at the verify code in drivers/md/bcache/debug.c, there's a
CONFIG_BCACHE_DEBUG mode where every time it reads clean cached data it reads
the data from the backing device and compares.

But for a scrub though you really want to walk all the _cached_ data, so it'd
take a bit more code than that.

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

* Re: scrub backing device
  2016-05-13 22:21           ` Kent Overstreet
@ 2016-05-15 23:56             ` ching
  0 siblings, 0 replies; 10+ messages in thread
From: ching @ 2016-05-15 23:56 UTC (permalink / raw)
  To: Kent Overstreet, Marc MERLIN; +Cc: Eric Wheeler, linux-bcache

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

it seems to be a kernel config, and the kernel panic cannot be handled by userspace program

On May 14, 2016 6:21:33 AM GMT+08:00, Kent Overstreet <kent.overstreet@gmail.com> wrote:
>On Wed, May 11, 2016 at 04:57:48PM -0700, Marc MERLIN wrote:
>> On Thu, May 12, 2016 at 07:34:26AM +0800, ching wrote:
>> > for example
>https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-scrub
>>
>> btrfs scrub is designed to make sure all the blocks and checksums are
>> consistent.
>> Ching makes a good point that it would be helpful to have a way to
>> access the underlying backing device directly to ensure it is
>> consistent.
>>
>> I think currently you can use dmsetup with an offset to get the real
>> filesystem past the bcache header, mount that read only somewhere and
>> scrub that.
>> Not ideal because scrub will not be able to fix issues that are
>fixable,
>> but at least it should report errors.
>
>Look at the verify code in drivers/md/bcache/debug.c, there's a
>CONFIG_BCACHE_DEBUG mode where every time it reads clean cached data it
>reads
>the data from the backing device and compares.
>
>But for a scrub though you really want to walk all the _cached_ data,
>so it'd
>take a bit more code than that.
-----BEGIN PGP SIGNATURE-----
Version: APG v1.1.1

iQQ6BAEBCgAkBQJXOQy8HRxjaGluZyA8dG9tLmx1QGFsdW1uaS51c3QuaGs+AAoJ
EJh7yMFRxEtkK/cgAN9XBFqqZ7mhctx8IzSKKZx5GrP4xv7Ew7rITiX4J6J2JLq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OvTq/bAPSdoM/wibsU9f
LmxEs2y5tX+AEHsT62o2FT1hc6ilvHzuRdJzNY+MPIsIFTBCPMF0wJFeL77tYYWE
71SUNDrBL8zT/eqeeneqfn1rbgEuDxucKOUuwLz0oYkWYGk0bhYieoWBrqyZGuq8
CKg2KPUB+2KJuS9Y9wXfL93QohzQOLc8RzOwf2oqCio7uVKn+DNyyE0gF66k0WOV
HfSvyfdcSb83CnQxXwVtQbEz9jHyUFe0J5Y6CK4=
=aTFB
-----END PGP SIGNATURE-----

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

end of thread, other threads:[~2016-05-15 23:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-29  2:13 scrub backing device ching lu
2016-05-11  1:15 ` Eric Wheeler
2016-05-11  1:36   ` ching lu
2016-05-11 19:13     ` Eric Wheeler
2016-05-11 23:34       ` ching
2016-05-11 23:57         ` Marc MERLIN
2016-05-12 10:25           ` ching
2016-05-13 22:10             ` Marc MERLIN
2016-05-13 22:21           ` Kent Overstreet
2016-05-15 23:56             ` ching

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.