The attached patch implements shrinking of completely empty allocation
groups. The patch is against current CVS and modifies two files:
- xfs_trans.c to remove two asserts in which prevent lowering the
number of AGs or filesystem blocks;
- xfs_fsops.c where it does:
- modify xfs_growfs_data() to branch to either
xfs_growfs_data_private or xfs_shrinkfs_data private depending on
the new size of the fs
- abstract the last part of xfs_growfs_data_private (the modify of
all the superblocks) into a separate function, xfs_update_sb(),
which is called both from shrink and grow
- add the new xfs_shrinkfs_data_private function, mostly based on
the growfs function
There are many printk()'s left in the patch, I left them as they show
where I compute some important values. There are also many FIXMEs in the
comments showing what parts I didn't understand or was not sure about
(not that these are the only ones...). Probably for a real patch,
xfs-specific debug hooks need to be added and the printk()s removed.
The patch works on UML and QEMU virtual machines, both in UP and SMP. I
just tested many shrink/grow operations and verified with xfs_repair
that the fs is not corrupted. The free space counters seem to be correct
after shrink.
Note that you also need to remove the check from xfs_growfs.c of not
allowing to shrink the filesystem.
regards,
iustin
patch-nice-4
Description: Text document
signature.asc
Description: Digital signature
|