Re: [PATCH 17/30] db: rewrite IO engine to use libxfs

Christoph Hellwig
2013-10-31T15:10:50Z

On Wed, Oct 30, 2013 at 03:31:08PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> Now that we have buffers and xfs_buf_maps, it is relatively easy to
> convert the IO engine to use libxfs routines. This gets rid of the
> most of the differences between mapped and straight buffer reads,
> and tracks xfs_bufs directly in the IO context that is being used.
>
> This is not yet a perfect solution, as xfs_db does different sized
> IOs for the same block range which will throw warnings like:
>
> xfs_db> inode 64
> 7ffff7fde740: Badness in key lookup (length)
> bp=(bno 0x40, len 8192 bytes) key=(bno 0x40, len 4096 bytes)
> xfs_db>

Maybe we should use uncached buffer I/O in xfs_db, similar to what we do
in the mount path in the kernel?

> mp->m_flags = (LIBXFS_MOUNT_32BITINODES|LIBXFS_MOUNT_32BITINOOPT);
> + if (flags & LIBXFS_MOUNT_ROOTINOS)
> + mp->m_flags |= LIBXFS_MOUNT_ROOTINOS;
> +
> mp->m_sb = *sb;
> INIT_RADIX_TREE(&mp->m_perag_tree, GFP_KERNEL);
> sbp = &(mp->m_sb);
> @@ -866,6 +869,8 @@ libxfs_umount(xfs_mount_t *mp)
> int agno;
>
> libxfs_rtmount_destroy(mp);
> + if ((mp->m_flags & LIBXFS_MOUNT_ROOTINOS) && mp->m_rootip)
> + libxfs_iput(mp->m_rootip, 0);

Seems like the patch to remove m_rootip should go before this one?

> -struct xfs_buf *
> -libxfs_readbuf_map(struct xfs_buftarg *btp, struct xfs_buf_map *map, int nmaps,
> - int flags, const struct xfs_buf_ops *ops)
> +int
> +libxfs_readbufr_map(struct xfs_buftarg *btp, struct xfs_buf *bp,
> + struct xfs_buf_map *map, int nmaps, int flags)

Shouldn't these sort of changes go into a separate patch?

Otherwise looks good to me.