linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Resizing bcache backing store
@ 2012-04-11 22:47 David Rhodes Clymer
       [not found] ` <CAB7K1hH_o7koST7RYTbw9ya0GMEvmpb=TYAt1MqEVDhtBdRd1Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: David Rhodes Clymer @ 2012-04-11 22:47 UTC (permalink / raw)
  To: linux-bcache-u79uwXL29TY76Z2rM5mHXA

In the case where the bcache backing store is resizeable (eg. a
logical volume), is it possible to resize the backing store without
breaking bcache? Let's say, for example, that I would
unmount/unregister /dev/bcacheX, resize the backing store,
reregister/remount the cache.

I imagine a better approach would be to layer LVM on the cache device
itself. However, in this particular case, I set up the bcache before I
had learned how to get LVM to use a bcache device as a PV.

-davidc

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

* Re: Resizing bcache backing store
       [not found] ` <CAB7K1hH_o7koST7RYTbw9ya0GMEvmpb=TYAt1MqEVDhtBdRd1Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-04-11 23:55   ` Kent Overstreet
  2012-11-01 19:06     ` James Sefton
  0 siblings, 1 reply; 4+ messages in thread
From: Kent Overstreet @ 2012-04-11 23:55 UTC (permalink / raw)
  To: David Rhodes Clymer; +Cc: linux-bcache-u79uwXL29TY76Z2rM5mHXA

For the backing device, I think things will just work - you'll just
have to close and reopen the backing device in order for bcache to
notice the new size. Bcache's superblock doesn't remember the size, it
just goes off of what the size of the backing device is when it's
registered.

There's currently no way to make bcache notice the backing device has
grown to do it at runtime, though that ought to be fairly simple too.

On Wed, Apr 11, 2012 at 6:47 PM, David Rhodes Clymer
<david-LEGOU7lN1jbY0TyS/+Ba5Q@public.gmane.org> wrote:
> In the case where the bcache backing store is resizeable (eg. a
> logical volume), is it possible to resize the backing store without
> breaking bcache? Let's say, for example, that I would
> unmount/unregister /dev/bcacheX, resize the backing store,
> reregister/remount the cache.
>
> I imagine a better approach would be to layer LVM on the cache device
> itself. However, in this particular case, I set up the bcache before I
> had learned how to get LVM to use a bcache device as a PV.
>
> -davidc
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Resizing bcache backing store
  2012-04-11 23:55   ` Kent Overstreet
@ 2012-11-01 19:06     ` James Sefton
       [not found]       ` <loom.20121101T195722-160-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: James Sefton @ 2012-11-01 19:06 UTC (permalink / raw)
  To: linux-bcache-u79uwXL29TY76Z2rM5mHXA

Kent Overstreet <koverstreet@...> writes:

> 
> For the backing device, I think things will just work - you'll just
> have to close and reopen the backing device in order for bcache to
> notice the new size. Bcache's superblock doesn't remember the size, it
> just goes off of what the size of the backing device is when it's
> registered.
> 
> There's currently no way to make bcache notice the backing device has
> grown to do it at runtime, though that ought to be fairly simple too.
> 
> On Wed, Apr 11, 2012 at 6:47 PM, David Rhodes Clymer
> <david@...> wrote:
> > In the case where the bcache backing store is resizeable (eg. a
> > logical volume), is it possible to resize the backing store without
> > breaking bcache? Let's say, for example, that I would
> > unmount/unregister /dev/bcacheX, resize the backing store,
> > reregister/remount the cache.
> >
> > I imagine a better approach would be to layer LVM on the cache device
> > itself. However, in this particular case, I set up the bcache before I
> > had learned how to get LVM to use a bcache device as a PV.
> >
> > -davidc
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
> > the body of a message to majordomo@...
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


Hi Kent,

I am new to bcache and have a question relating to the above.
Resizing sounds pretty straight forward following the procedure you outlined 
above when you are growing the disk.   However, what would happen if you wanted 
to shrink the backing device and had writeback enabled.

We would obviously shrink the filesystem first through the cash so any blocks in 
the area beyond the new filesystem boundary that may still be dirty in the cache 
would not matter any more.

Then we would unregister the backing store and truncate the backing store block 
device before re-registering it.

I am wondering if any dirty blocks that are in the cache that are beyond the new 
size of the backing device are going to cause a problem?   It does not matter if 
they are simply discarded since the filesystem was resized but would bcache know 
what to do with them or could they cause a crash (or other undesirable effects) 
due to bcache trying to write to blocks that no longer exist on the backing 
device?

I hope that makes sense.

Many thanks,

James

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

* Re: Resizing bcache backing store
       [not found]       ` <loom.20121101T195722-160-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
@ 2012-11-02 15:20         ` Kent Overstreet
  0 siblings, 0 replies; 4+ messages in thread
From: Kent Overstreet @ 2012-11-02 15:20 UTC (permalink / raw)
  To: James Sefton; +Cc: linux-bcache-u79uwXL29TY76Z2rM5mHXA

On Thu, Nov 01, 2012 at 07:06:01PM +0000, James Sefton wrote:
> Kent Overstreet <koverstreet@...> writes:
> 
> > 
> > For the backing device, I think things will just work - you'll just
> > have to close and reopen the backing device in order for bcache to
> > notice the new size. Bcache's superblock doesn't remember the size, it
> > just goes off of what the size of the backing device is when it's
> > registered.
> > 
> > There's currently no way to make bcache notice the backing device has
> > grown to do it at runtime, though that ought to be fairly simple too.
> > 
> > On Wed, Apr 11, 2012 at 6:47 PM, David Rhodes Clymer
> > <david@...> wrote:
> > > In the case where the bcache backing store is resizeable (eg. a
> > > logical volume), is it possible to resize the backing store without
> > > breaking bcache? Let's say, for example, that I would
> > > unmount/unregister /dev/bcacheX, resize the backing store,
> > > reregister/remount the cache.
> > >
> > > I imagine a better approach would be to layer LVM on the cache device
> > > itself. However, in this particular case, I set up the bcache before I
> > > had learned how to get LVM to use a bcache device as a PV.
> > >
> > > -davidc
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-bcache" in
> > > the body of a message to majordomo@...
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> 
> 
> Hi Kent,
> 
> I am new to bcache and have a question relating to the above.
> Resizing sounds pretty straight forward following the procedure you outlined 
> above when you are growing the disk.   However, what would happen if you wanted 
> to shrink the backing device and had writeback enabled.
> 
> We would obviously shrink the filesystem first through the cash so any blocks in 
> the area beyond the new filesystem boundary that may still be dirty in the cache 
> would not matter any more.
> 
> Then we would unregister the backing store and truncate the backing store block 
> device before re-registering it.
> 
> I am wondering if any dirty blocks that are in the cache that are beyond the new 
> size of the backing device are going to cause a problem?   It does not matter if 
> they are simply discarded since the filesystem was resized but would bcache know 
> what to do with them or could they cause a crash (or other undesirable effects) 
> due to bcache trying to write to blocks that no longer exist on the backing 
> device?

Hmm, it most likely would.

You could certainly work around it by disabling writeback and waiting
for all the dirty data to be flushed, but this is something that could
be improved.

It'd be fairly straightforward to fix it so background writeback and
garbage collection took into account the current size of the device, but
to be honest I'm currently swamped with work and I'm not going to have
time to do it myself any time soon.

I'd be happy to help anyone who wanted to work on it, though.

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

end of thread, other threads:[~2012-11-02 15:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 22:47 Resizing bcache backing store David Rhodes Clymer
     [not found] ` <CAB7K1hH_o7koST7RYTbw9ya0GMEvmpb=TYAt1MqEVDhtBdRd1Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-11 23:55   ` Kent Overstreet
2012-11-01 19:06     ` James Sefton
     [not found]       ` <loom.20121101T195722-160-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
2012-11-02 15:20         ` Kent Overstreet

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