On Mon, 20 Feb 2023, mingzhe wrote: > 在 2023/2/19 17:39, Coly Li 写道: > >> Subject: [PATCH v2] bcache: Add support for live resize of backing devices > >> > >> Signed-off-by: Andrea Tomassetti > > > > Hi Andrea, > > > > I am fine with this patch and added it in my test queue now. Do you have an > > updated version, (e.g. more coding refine or adding commit log), then I can > > update my local version. > > > > > Hi, Coly > > I posted some patchsets about online resize. > > -[PATCH v5 1/3] bcache: add dirty_data in struct bcache_device > -[PATCH v5 2/3] bcache: allocate stripe memory when partial_stripes_expensive > is true > -[PATCH v5 3/3] bcache: support online resizing of cached_dev > > There are some differences: > 1. Create /sys/block/bcache0/bcache/size in sysfs to trigger resize Can the final version name the sysfs entry "resize", because "size" sounds like you are setting a specific size, not triggering a resize. -- Eric Wheeler > 2. Allocate stripe memory only if partial_stripes_expensive is true > 3. Simplify bcache_dev_sectors_dirty() > > Since the bcache superblock uses some sectors, the actual space of the bcache > device is smaller than the backing. In order to provide a bcache device with a > user-specified size, we need to create a backing device with a larger space, > and then resize bcache. So resize can specify the size is very necessary. > > > > > > > > > >> --- > >> Hi Coly, > >> this is the second version of the patch. As you correctly pointed out, > >> I implemented roll-back functionalities in case of error. > >> I'm testing this funcionality using QEMU/KVM vm via libvirt. > >> Here the steps: > >> 1. make-bcache --writeback -B /dev/vdb -C /dev/vdc > >> 2. mkfs.xfs /dev/bcache0 > >> 3. mount /dev/bcache0 /mnt > >> 3. dd if=/dev/random of=/mnt/random0 bs=1M count=1000 > >> 4. md5sum /mnt/random0 | tee /mnt/random0.md5 > >> 5. [HOST] virsh blockresize --path --size > >> > >> 6. xfs_growfs /dev/bcache0 > >> 6. Repeat steps 3 and 4 with a different file name (e.g. random1.md5) > >> 7. umount/reboot/remount and check that the md5 hashes are correct with > >> md5sum -c /mnt/random?.md5 > >> > >> drivers/md/bcache/super.c | 84 ++++++++++++++++++++++++++++++++++++++- > >> 1 file changed, 83 insertions(+), 1 deletion(-) > >> > >> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c > >> index ba3909bb6bea..1435a3f605f8 100644 > >> --- a/drivers/md/bcache/super.c > >> +++ b/drivers/md/bcache/super.c > >>> > > > > [snipped] > > > > > >