[Top] [All Lists]

Where/how to submit for review patch for shrink support?

To: linux-xfs@xxxxxxxxxxx
Subject: Where/how to submit for review patch for shrink support?
From: Iustin Pop <iusty@xxxxxxxxx>
Date: Mon, 5 Sep 2005 21:52:21 +0300
Mail-followup-to: linux-xfs@xxxxxxxxxxx
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.10i
Hello to all,

I would like to know in what form should I submit my patch and where
(probably to the list). The diff I have was made against and
applies/compiles cleanly against 2.6.13 also.

Detailed explanation: I've completed the first part of the shrink
 - first patch: permits shrink of the filesystem if all requested blocks
   are free;
 - second patch (not yet finished): add support for marking allocation
   groups offline with regard to space and inode allocation so that you
   can clear out the space;
 - third part, probably userspace, which will help clear the indented
   space (using xfs_swap_extents and inode switch maybe).

Now, regarding the first patch. What it does is enable the kernel to
shrink a filesystem if it passes certain checks, which ensure (I
believe) that the space to be removed is free.

The code is almost non-intrusive:
 - it adds a function xfs_shrink_data_private to xfs_fsops.c
 - it modifies xfs_growfs_data_private to call the above function if
 - it adds one function to xfs_alloc_btree.c to enable calculation of
   the bno or cnt btree
 - it adds one function to xfs_ialloc_btree.c to enable calculation of
   the inode btree and the space used by the inode chunks
 - (only intrusive item) it removes from xfs_trans_mod_sb the

Except for the ASSERT() removal, the code is called only and only when

Example of behavior: you have a filesystem of 8 a.g. of 1000 blocks
each, and want to shrink the filesystem from 8000 to 5500 blocks. The
new routine will:
 - check if you have an internal journal and abort if you would trip
   over it;
 - check that you have enough space by making an xfs_trans_reserve
 - for (in this example) the a.g. 6 & 7 (starting from 0), which will be
   completely removed:
   * check that no allocated inodes exist in that a.g. (agi_freecount
      == agi_count)
   * check that the used space in that a.g. is used only by metadata:
     deleted and unreclaimed inodes, inode allocation btrees, bno and
     cnt allocation btrees and freelist
 - for the a.g. 5, it will try and make an exact allocation of space
   from block 500 to the end, which would fail if anything is in that
   space; thus, if the allocation succeeds, it means we can chop off
   that space;

Now the patch does not include memory management stuff (except for a
simple resizing of mp->m_perag if we chop an entire a.g.), since I
didn't understand this issue. Also I'm not sure what can happen in some
inodes or data is in the cache but not flushed, or if this can even
happen when using transactions. Since xfs_growfs_data_private didn't
contain any such stuff, I presumed shrink doesn't also. Probably wrong

Testing was done using user mode linux on an i386 host. In the
current state, I can't seem to generate any oops or panics (using
XFS_DEBUG=y manually set in the Makefile), and xfs_check and xfs_repair
do not complain. I also was able to grow-shrink-grow-shrink-.... a
filesystem without problems.

I would like to know if this has any chance of being considered for
inclusion... or if I wasted my time :)

Iustin Pop

Attachment: signature.asc
Description: Digital signature

<Prev in Thread] Current Thread [Next in Thread>