[PATCH 2/9] xfsprogs: Fix miscellaneous warnings in libxfs
Christoph Hellwig
hch at infradead.org
Sun Jan 17 05:53:36 CST 2010
> -/* space allocation */
> +/* space allocation - use static inlines to avoid unused var warnings */
> #define xfs_alloc_search_busy(tp,ag,b,len) ((void) 0)
> -#define xfs_alloc_mark_busy(tp,ag,b,len) ((void) 0)
> +static inline void xfs_alloc_mark_busy(xfs_trans_t *tp,
> + xfs_agnumber_t agno, xfs_agblock_t bno, xfs_extlen_t len) {}
> #define xfs_rotorstep 1
> #define xfs_bmap_rtalloc(a) (ENOSYS)
> #define xfs_rtpick_extent(mp,tp,len,p) (ENOSYS)
Maybe just convert all these to inlines so that we make sure all
arguments are evaluated?
> diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c
> index cf1123a..4cc6431 100644
> --- a/libxfs/xfs_bmap.c
> +++ b/libxfs/xfs_bmap.c
> @@ -4274,7 +4274,7 @@ xfs_bmapi(
> xfs_fsblock_t abno; /* allocated block number */
> xfs_extlen_t alen; /* allocated extent length */
> xfs_fileoff_t aoff; /* allocated file offset */
> - xfs_bmalloca_t bma; /* args for xfs_bmap_alloc */
> + xfs_bmalloca_t bma = { 0 }; /* args for xfs_bmap_alloc */
> xfs_btree_cur_t *cur; /* bmap btree cursor */
> xfs_fileoff_t end; /* end of mapped file region */
> int eof; /* we've hit the end of extents */
Not nice but okay..
> diff --git a/libxfs/xfs_mount.c b/libxfs/xfs_mount.c
> index 02bff42..662c8d2 100644
> --- a/libxfs/xfs_mount.c
> +++ b/libxfs/xfs_mount.c
> @@ -400,15 +400,14 @@ xfs_mod_sb(xfs_trans_t *tp, __int64_t fields)
>
> xfs_sb_to_disk(XFS_BUF_TO_SBP(bp), &mp->m_sb, fields);
>
> - /* find modified range */
> + /* find modified range - get last first to avoid spurious warning */
> + f = (xfs_sb_field_t)xfs_highbit64((__uint64_t)fields);
> + ASSERT((1LL << f) & XFS_SB_MOD_BITS);
> + last = xfs_sb_info[f + 1].offset - 1;
>
> f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields);
> ASSERT((1LL << f) & XFS_SB_MOD_BITS);
> first = xfs_sb_info[f].offset;
>
> - f = (xfs_sb_field_t)xfs_highbit64((__uint64_t)fields);
> - ASSERT((1LL << f) & XFS_SB_MOD_BITS);
> - last = xfs_sb_info[f + 1].offset - 1;
> -
I don't see how this can shut up a warning, but as it doesn't cause harm
I'm fine with it. But this and the above one really need to go in via
the kernel tree first.
More information about the xfs
mailing list