Re: [PATCH 4/8] xfsprogs: mkfs.xfs: let libxfs_umount() do its thing

Christoph Hellwig
2011-11-13T12:04:24Z

On Thu, Nov 10, 2011 at 02:35:14PM -0600, Alex Elder wrote:
> From: Kevan Rehm <kfr@sgi.com>
>
> In the mkfs.xfs main() routine (which is gargantuan, by the way),
> there are a few function calls intended to do some clean up before
> unmounting the filesystem.
>
> The first function drops references that will be dropped again in
> the unmnount call. The others assume all references will go away as
> a result of the purge, but the filesystem's root inode reference
> will remain.
>
> Let the unmount function take care of destroying the real-time
> structures. And instead of purging the inode and block caches, just
> flush them (at least the block cache) and let the unmount code take
> care of the final purge.
>
> Signed-off-by: Alex Elder <aelder@sgi.com>
> ---
> mkfs/xfs_mkfs.c | 4 +---
> 1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> index f527f3d..213cc74 100644
> --- a/mkfs/xfs_mkfs.c
> +++ b/mkfs/xfs_mkfs.c
> @@ -2674,9 +2674,7 @@ an AG size that is one stripe unit smaller, for example %llu.\n"),
> * Dump all inodes and buffers before marking us all done.
> * Need to drop references to inodes we still hold, first.
> */
> - libxfs_rtmount_destroy(mp);

After his libxfs_rtmount_destroy should be marked static.
> - libxfs_icache_purge();
> - libxfs_bcache_purge();
> + libxfs_bcache_flush();

Why don't we need a flush for the inode cache here?