Re: [RFC] Live resize of backing device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> 2022年8月3日 18:05,Andrea Tomassetti <andrea.tomassetti-opensource@xxxxxxxx> 写道:
> 
> Hi Coly,
> In one of our previous emails you said that
>> Currently bcache doesn’t support cache or backing device resize
> 
> I was investigating this point and I actually found a solution. I
> briefly tested it and it seems to work fine.
> Basically what I'm doing is:
>  1. Check if there's any discrepancy between the nr of sectors
> reported by the bcache backing device (holder) and the nr of sectors
> reported by its parent (slave).
>  2. If the number of sectors of the two devices are not the same,
> then call set_capacity_and_notify on the bcache device.
>  3. From user space, depending on the fs used, grow the fs with some
> utility (e.g. xfs_growfs)
> 
> This works without any need of unmounting the mounted fs nor stopping
> the bcache backing device.
> 
> So my question is: am I missing something? Can this live resize cause
> some problems (e.g. data loss)? Would it be useful if I send a patch
> on this?

Hi Andrea,

It sounds good. You may look at bcache_device_init() to see how the following items are initialized,
- d->nr_stripes
- d->stripe_sectors_dirty
- d->full_dirty_stripes

And you may check calc_cached_dev_sectors() to see how this item is initilaized,
- c->cached_dev_sectors

All the above items are writeback related, when they are updated with the size increased, you should use proper locks to avoid potential race from where they are referenced in the writeback code flow (maybe somewhere else too).

The overall idea should work, I’d like to see your tested patch :-)

Coly Li



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux ARM Kernel]     [Linux Filesystem Development]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux