xfs: fix non-debug build warnings
authorDave Chinner <dchinner@redhat.com>
Tue, 25 Aug 2015 00:05:13 +0000 (10:05 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 25 Aug 2015 00:05:13 +0000 (10:05 +1000)
There seem to be a couple of new set-but-unused build warnings
that gcc 4.9.3 is now warning about. These are not regressions, just
the compiler being more picky.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_buf.c
fs/xfs/xfs_buf_item.c
fs/xfs/xfs_buf_item.h

index a4b7d92e946c1e827355e6197538bc854514e759..fbf4c269a7b77be22a996a5f8bcd28f26adbfc0e 100644 (file)
@@ -438,7 +438,6 @@ _xfs_buf_find(
        xfs_buf_flags_t         flags,
        xfs_buf_t               *new_bp)
 {
-       size_t                  numbytes;
        struct xfs_perag        *pag;
        struct rb_node          **rbp;
        struct rb_node          *parent;
@@ -450,10 +449,9 @@ _xfs_buf_find(
 
        for (i = 0; i < nmaps; i++)
                numblks += map[i].bm_len;
-       numbytes = BBTOB(numblks);
 
        /* Check for IOs smaller than the sector size / not sector aligned */
-       ASSERT(!(numbytes < btp->bt_meta_sectorsize));
+       ASSERT(!(BBTOB(numblks) < btp->bt_meta_sectorsize));
        ASSERT(!(BBTOB(blkno) & (xfs_off_t)btp->bt_meta_sectormask));
 
        /*
index 092d652bc03df3153b6bcf427ed972ffe480fd86..9cf3a86a22011ca09b3d73bd1b7cc41b7fd8c478 100644 (file)
@@ -750,13 +750,13 @@ xfs_buf_item_free_format(
  * buffer (see xfs_buf_attach_iodone() below), then put the
  * buf log item at the front.
  */
-void
+int
 xfs_buf_item_init(
-       xfs_buf_t       *bp,
-       xfs_mount_t     *mp)
+       struct xfs_buf  *bp,
+       struct xfs_mount *mp)
 {
-       xfs_log_item_t          *lip = bp->b_fspriv;
-       xfs_buf_log_item_t      *bip;
+       struct xfs_log_item     *lip = bp->b_fspriv;
+       struct xfs_buf_log_item *bip;
        int                     chunks;
        int                     map_size;
        int                     error;
@@ -770,12 +770,11 @@ xfs_buf_item_init(
         */
        ASSERT(bp->b_target->bt_mount == mp);
        if (lip != NULL && lip->li_type == XFS_LI_BUF)
-               return;
+               return 0;
 
        bip = kmem_zone_zalloc(xfs_buf_item_zone, KM_SLEEP);
        xfs_log_item_init(mp, &bip->bli_item, XFS_LI_BUF, &xfs_buf_item_ops);
        bip->bli_buf = bp;
-       xfs_buf_hold(bp);
 
        /*
         * chunks is the number of XFS_BLF_CHUNK size pieces the buffer
@@ -788,6 +787,11 @@ xfs_buf_item_init(
         */
        error = xfs_buf_item_get_format(bip, bp->b_map_count);
        ASSERT(error == 0);
+       if (error) {    /* to stop gcc throwing set-but-unused warnings */
+               kmem_zone_free(xfs_buf_item_zone, bip);
+               return error;
+       }
+
 
        for (i = 0; i < bip->bli_format_count; i++) {
                chunks = DIV_ROUND_UP(BBTOB(bp->b_maps[i].bm_len),
@@ -807,6 +811,8 @@ xfs_buf_item_init(
        if (bp->b_fspriv)
                bip->bli_item.li_bio_list = bp->b_fspriv;
        bp->b_fspriv = bip;
+       xfs_buf_hold(bp);
+       return 0;
 }
 
 
index 3f3455a415102de167271a7467725da410a21f24..f7eba99d19dde9404c1517633fd8f34f16a36599 100644 (file)
@@ -61,7 +61,7 @@ typedef struct xfs_buf_log_item {
        struct xfs_buf_log_format __bli_format; /* embedded in-log header */
 } xfs_buf_log_item_t;
 
-void   xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
+int    xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
 void   xfs_buf_item_relse(struct xfs_buf *);
 void   xfs_buf_item_log(xfs_buf_log_item_t *, uint, uint);
 uint   xfs_buf_item_dirty(xfs_buf_log_item_t *);