| To: | Steve Lord <lord@xxxxxxx> |
|---|---|
| Subject: | Re: how to free a used ag? |
| From: | Markus Lidel <Markus.Lidel@xxxxxxxxxxxxxxxxx> |
| Date: | Wed, 18 Aug 2004 17:55:30 +0200 |
| Cc: | linux-xfs@xxxxxxxxxxx |
| In-reply-to: | <41236AF7.4030708@xfs.org> |
| References: | <412136CC.5070708@shadowconnect.com> <41222FD4.9060601@xfs.org> <41232698.2050103@shadowconnect.com> <41236AF7.4030708@xfs.org> |
| Sender: | linux-xfs-bounce@xxxxxxxxxxx |
| User-agent: | Mozilla Thunderbird 0.6 (Windows/20040502) |
Hello, Steve Lord wrote: Markus Lidel wrote:Steve Lord wrote:Markus Lidel wrote:Thanks you very much for the advice... But do you think it's better to work on the on-disk structure, or do you think it's better to work with the in-core inodes?could someone help me with freeing a used ag?Make sure you traverse all the inodes - there will probably be inodes Okay, i want to do it transactional... But to e. g. locate an inode i could do it using xfs_iget (in-core) or split the inode into agno and agino and locate the inode using the on-disk API, right? Probably in my previous e-mail i've wrote a little bit confusing :-) The two potential approaches here are really to add some extensions to the kernel and use thinks like bulkstat and swapext to do the work on the live filesystem. Everything will be transactional, if the machine goes down or crashes in the middle, you should end up with a working
filesystem. The alternative is to use something like libxfs and manipulate the fs from user space - if you crash you are left with bits and pieces of a filesystem. If the kernel approach is to expensive (in term of code size), it should be not a big deal to split it and put some logic into user space... So i think i take the first way, and decide later if it is necessary to remove some parts from kernel... So taking the use the transaction system approach: Add the logic to turn off new allocates in the allocation group, sounds like you are making progress on this. Oh, no i could remove a unused AG from the filesystem, but i do this on the on-disk structure (like the growfs stuff)... I don't know if setting the per AG freelist to 0 would prevent the allocator to allocate something in this AG... It only work in best case, e. g. nothing is allocated in the AG :-) The defragmenter uses swapext to move extents from one file to another. I would build on this approach, so have a user space app which scans the fs for target inodes. Use the code from the defragmenter, without the logic which says it has to be less fragmented afterwards, to move the space to elsewhere in the fs - since allocations will not be allowed in the ag you are emptying, you end up with an inode and extents which are in other allocation groups.
This leaves directories with blocks in the ag to rebuild, a mkdir of a temporary dir and some renames should take care of that. Other things to watch out for: There is the log in the middle allocation group, you cannot empty that one. Sometimes when you free space it actually wants to allocate blocks in that ag to put the free space tree into. Eventually the free space btree will collapse, but there could be some interim steps where an allocate is required to free space. There will need to be special logic to allow these allocates to happen.
Best regards,
Shadow Connect GmbH Carl-Reisch-Weg 12 D-86381 Krumbach Germany Phone: +49 82 82/99 51-0 Fax: +49 82 82/99 51-11 E-Mail: Markus.Lidel@xxxxxxxxxxxxxxxxx URL: http://www.shadowconnect.com |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: how to free a used ag?, Steve Lord |
|---|---|
| Next by Date: | Does XFS Support UNICODE ?????, Michael Gasch |
| Previous by Thread: | Re: how to free a used ag?, Steve Lord |
| Next by Thread: | errata list available?, James G. Sack (jim) |
| Indexes: | [Date] [Thread] [Top] [All Lists] |