Skip to contentSkip to conversation

misc: fix more stupid compiler warnings

PATCH In review Darrick J. Wong 2 participants 2 messages Sep 4, 2017 – Sep 8, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 misc: fix more stupid compiler warnings

Fix more compiler warnings about pointless checks, unchecked return values, brace problems, and missing parentheses.

---
 db/check.c           |    2 --
 libxfs/libxfs_priv.h |    4 ++--
 libxfs/xfs_bmap.c    |    2 +-
 repair/phase6.c      |    4 ----
 repair/rmap.c        |    2 +-
 5 files changed, 4 insertions(+), 10 deletions(-)
db/check.c +0 -2
index 12a0aed..6076540 100644
@@ -3220,9 +3220,7 @@ process_leaf_node_dir_v2_free(
 		return;
 	}
 	if (be32_to_cpu(free->hdr.nvalid) > maxent ||
-				be32_to_cpu(free->hdr.nvalid) < 0 ||
 				be32_to_cpu(free->hdr.nused) > maxent ||
-				be32_to_cpu(free->hdr.nused) < 0 ||
 				be32_to_cpu(free->hdr.nused) >
 					be32_to_cpu(free->hdr.nvalid)) {
 		if (!sflag || v)
libxfs/libxfs_priv.h +2 -2
index 19bdbdb..94804fe 100644
@@ -504,8 +504,8 @@ int libxfs_zero_extent(struct xfs_inode *ip, xfs_fsblock_t start_fsb,
 bool xfs_log_check_lsn(struct xfs_mount *, xfs_lsn_t);
 
 /* xfs_icache.c */
-#define xfs_inode_set_cowblocks_tag(ip)
-#define xfs_inode_set_eofblocks_tag(ip)
+#define xfs_inode_set_cowblocks_tag(ip)	do { } while (0)
+#define xfs_inode_set_eofblocks_tag(ip)	do { } while (0)
 
 /* xfs_stats.h */
 #define XFS_STATS_CALC_INDEX(member)	0
libxfs/xfs_bmap.c +1 -1
index 31a631a..ab5853d 100644
@@ -570,7 +570,7 @@ xfs_bmap_validate_ret(
 
 #else
 #define xfs_bmap_check_leaf_extents(cur, ip, whichfork)		do { } while (0)
-#define	xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap)
+#define	xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap)	do { } while (0)
 #endif /* DEBUG */
 
 /*
repair/phase6.c +0 -4
index b051a44..8fdf8e5 100644
@@ -3082,8 +3082,6 @@ mark_standalone_inodes(xfs_mount_t *mp)
 	irec = find_inode_rec(mp, XFS_INO_TO_AGNO(mp, mp->m_sb.sb_rbmino),
 			XFS_INO_TO_AGINO(mp, mp->m_sb.sb_rbmino));
 
-	ASSERT(irec != NULL);
-
 	offset = XFS_INO_TO_AGINO(mp, mp->m_sb.sb_rbmino) -
 			irec->ino_startnum;
 
@@ -3095,8 +3093,6 @@ mark_standalone_inodes(xfs_mount_t *mp)
 	offset = XFS_INO_TO_AGINO(mp, mp->m_sb.sb_rsumino) -
 			irec->ino_startnum;
 
-	ASSERT(irec != NULL);
-
 	add_inode_reached(irec, offset);
 
 	if (fs_quotas)  {
repair/rmap.c +1 -1
index 9710565..07d1ba8 100644
@@ -1542,7 +1542,7 @@ rmap_populate_realtime_rmapbt(
 		imap.br_startoff = rm_rec->rm_offset;
 		imap.br_startblock = rm_rec->rm_startblock;
 		imap.br_blockcount = rm_rec->rm_blockcount;
-		imap.br_state = (rm_rec->rm_flags & XFS_RMAP_UNWRITTEN ?
+		imap.br_state = ((rm_rec->rm_flags & XFS_RMAP_UNWRITTEN) ?
 				XFS_EXT_UNWRITTEN : XFS_EXT_NORM);
 		fakei.i_ino = rm_rec->rm_owner;
 		error = -libxfs_rmap_map_extent(mp, &dfops, &fakei,
Reviewed-by on v1 1/2
#1 lore raw
Quoted 4 lines · Darrick J. Wong

Fix more compiler warnings about pointless checks, unchecked return values, brace problems, and missing parentheses.

(one hunk depends on
[PATCH 28/29] xfs_repair: rebuild the realtime rmap btree so dropped that for now)

-Eric

Quoted 90 lines
---
 db/check.c           |    2 --
 libxfs/libxfs_priv.h |    4 ++--
 libxfs/xfs_bmap.c    |    2 +-
 repair/phase6.c      |    4 ----
 repair/rmap.c        |    2 +-
 5 files changed, 4 insertions(+), 10 deletions(-)
db/check.c +0 -2
index 12a0aed..6076540 100644
@@ -3220,9 +3220,7 @@ process_leaf_node_dir_v2_free(
 		return;
 	}
 	if (be32_to_cpu(free->hdr.nvalid) > maxent ||
-				be32_to_cpu(free->hdr.nvalid) < 0 ||
 				be32_to_cpu(free->hdr.nused) > maxent ||
-				be32_to_cpu(free->hdr.nused) < 0 ||
 				be32_to_cpu(free->hdr.nused) >
 					be32_to_cpu(free->hdr.nvalid)) {
 		if (!sflag || v)
libxfs/libxfs_priv.h +2 -2
index 19bdbdb..94804fe 100644
@@ -504,8 +504,8 @@ int libxfs_zero_extent(struct xfs_inode *ip, xfs_fsblock_t start_fsb,
 bool xfs_log_check_lsn(struct xfs_mount *, xfs_lsn_t);
 
 /* xfs_icache.c */
-#define xfs_inode_set_cowblocks_tag(ip)
-#define xfs_inode_set_eofblocks_tag(ip)
+#define xfs_inode_set_cowblocks_tag(ip)	do { } while (0)
+#define xfs_inode_set_eofblocks_tag(ip)	do { } while (0)
 
 /* xfs_stats.h */
 #define XFS_STATS_CALC_INDEX(member)	0
libxfs/xfs_bmap.c +1 -1
index 31a631a..ab5853d 100644
@@ -570,7 +570,7 @@ xfs_bmap_validate_ret(
 
 #else
 #define xfs_bmap_check_leaf_extents(cur, ip, whichfork)		do { } while (0)
-#define	xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap)
+#define	xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap)	do { } while (0)
 #endif /* DEBUG */
 
 /*
repair/phase6.c +0 -4
index b051a44..8fdf8e5 100644
@@ -3082,8 +3082,6 @@ mark_standalone_inodes(xfs_mount_t *mp)
 	irec = find_inode_rec(mp, XFS_INO_TO_AGNO(mp, mp->m_sb.sb_rbmino),
 			XFS_INO_TO_AGINO(mp, mp->m_sb.sb_rbmino));
 
-	ASSERT(irec != NULL);
-
 	offset = XFS_INO_TO_AGINO(mp, mp->m_sb.sb_rbmino) -
 			irec->ino_startnum;
 
@@ -3095,8 +3093,6 @@ mark_standalone_inodes(xfs_mount_t *mp)
 	offset = XFS_INO_TO_AGINO(mp, mp->m_sb.sb_rsumino) -
 			irec->ino_startnum;
 
-	ASSERT(irec != NULL);
-
 	add_inode_reached(irec, offset);
 
 	if (fs_quotas)  {
repair/rmap.c +1 -2
index 9710565..07d1ba8 100644
@@ -1542,7 +1542,7 @@ rmap_populate_realtime_rmapbt(
 		imap.br_startoff = rm_rec->rm_offset;
 		imap.br_startblock = rm_rec->rm_startblock;
 		imap.br_blockcount = rm_rec->rm_blockcount;
-		imap.br_state = (rm_rec->rm_flags & XFS_RMAP_UNWRITTEN ?
+		imap.br_state = ((rm_rec->rm_flags & XFS_RMAP_UNWRITTEN) ?
 				XFS_EXT_UNWRITTEN : XFS_EXT_NORM);
 		fakei.i_ino = rm_rec->rm_owner;
 		error = -libxfs_rmap_map_extent(mp, &dfops, &fakei,
--

To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html