Skip to contentSkip to conversation

linux-next: build warning after merge of the xfs tree

DISCUSSION Stephen Rothwell 4 participants 6 messages Aug 31, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the xfs tree, today's linux-next build (powerpc ppc64_defconfig) produced this warning:

fs/xfs/xfs_buf_item.c: In function 'xfs_buf_item_unlock':
fs/xfs/xfs_buf_item.c:573:9: warning: unused variable 'ordered' [-Wunused-variable]

  bool   ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);
         ^

Introduced by commit

a097077ef708 ("xfs: remove unnecessary dirty bli format check for ordered bufs")

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 5 lines · Stephen Rothwell

Hi all,

After merging the xfs tree, today's linux-next build (powerpc ppc64_defconfig) produced this warning:

Quoted 9 lines

fs/xfs/xfs_buf_item.c: In function 'xfs_buf_item_unlock':
fs/xfs/xfs_buf_item.c:573:9: warning: unused variable 'ordered' [-Wunused-variable]

  bool   ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);
         ^

Introduced by commit

a097077ef708 ("xfs: remove unnecessary dirty bli format check for ordered bufs")

Ugh, this is due to the refactoring of this patch between v1 and v2. I specifically recall testing for this in v1 because I added the ordered bool purely to clean up the ASSERT(), then I apparently lost of track of it for v2.

Anyways.. Christoph, Darrick, preferences to clean this up..? I have no preference between the v1 or v2 factoring. Or if it's easier, we could always just drop something like the hunk below on top. Thoughts?

Brian

--- 8< ---

fs/xfs/xfs_buf_item.c +9 -4
index ef2c137..f5d25f5 100644
@@ -567,10 +567,15 @@ xfs_buf_item_unlock(
 {
 	struct xfs_buf_log_item	*bip = BUF_ITEM(lip);
 	struct xfs_buf		*bp = bip->bli_buf;
-	bool			aborted = !!(lip->li_flags & XFS_LI_ABORTED);
-	bool			hold = !!(bip->bli_flags & XFS_BLI_HOLD);
-	bool			dirty = !!(bip->bli_flags & XFS_BLI_DIRTY);
-	bool			ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);
+	bool			aborted;
+	bool			hold;
+	bool			dirty;
+	bool			ordered;
+
+	aborted = !!(lip->li_flags & XFS_LI_ABORTED);
+	hold = !!(bip->bli_flags & XFS_BLI_HOLD);
+	dirty = !!(bip->bli_flags & XFS_BLI_DIRTY);
+	ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);
 
 	/* Clear the buffer's association with this transaction. */
 	bp->b_transp = NULL;
#2 lore raw
Quoted 40 lines · Brian Foster
Quoted 5 lines · Stephen Rothwell

Hi all,

After merging the xfs tree, today's linux-next build (powerpc ppc64_defconfig) produced this warning:

Quoted 9 lines

fs/xfs/xfs_buf_item.c: In function 'xfs_buf_item_unlock':
fs/xfs/xfs_buf_item.c:573:9: warning: unused variable 'ordered' [-Wunused-variable]

  bool   ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);
         ^

Introduced by commit

a097077ef708 ("xfs: remove unnecessary dirty bli format check for ordered bufs")

Ugh, this is due to the refactoring of this patch between v1 and v2. I specifically recall testing for this in v1 because I added the ordered bool purely to clean up the ASSERT(), then I apparently lost of track of it for v2.

Anyways.. Christoph, Darrick, preferences to clean this up..? I have no preference between the v1 or v2 factoring. Or if it's easier, we could always just drop something like the hunk below on top. Thoughts?

Brian

--- 8< ---

fs/xfs/xfs_buf_item.c +0 -3
index ef2c137..f5d25f5 100644
@@ -567,10 +567,15 @@ xfs_buf_item_unlock(
 {
 	struct xfs_buf_log_item	*bip = BUF_ITEM(lip);
 	struct xfs_buf		*bp = bip->bli_buf;
-	bool			aborted = !!(lip->li_flags & XFS_LI_ABORTED);
-	bool			hold = !!(bip->bli_flags & XFS_BLI_HOLD);
-	bool			dirty = !!(bip->bli_flags & XFS_BLI_DIRTY);

fs/xfs/xfs_buf_item.c xfs_buf_item_unlock( · line 578

Quoted 10 lines
fs/xfs/xfs_buf_item.c +9 -1
-	bool			ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);
+	bool			aborted;
+	bool			hold;
+	bool			dirty;
+	bool			ordered;
+
+	aborted = !!(lip->li_flags & XFS_LI_ABORTED);
+	hold = !!(bip->bli_flags & XFS_BLI_HOLD);
+	dirty = !!(bip->bli_flags & XFS_BLI_DIRTY);
+	ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);

The trouble is, 'ordered' is still an unused variable on !DEBUG builds, since the only user of ordered is that ASSERT. So either we #ifdef DEBUG the variable out of existence or employ one of those silly 'ordered = ordered' constructions to shut up gcc, if that even still works.

--D

Quoted 7 lines
fs/xfs/xfs_buf_item.c +0 -1
 	/* Clear the buffer's association with this transaction. */
 	bp->b_transp = NULL;
--

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

#3 lore raw
Quoted 49 lines · Darrick J. Wong
Quoted 48 lines · Brian Foster
Quoted 5 lines · Stephen Rothwell

Hi all,

After merging the xfs tree, today's linux-next build (powerpc ppc64_defconfig) produced this warning:

Quoted 9 lines

fs/xfs/xfs_buf_item.c: In function 'xfs_buf_item_unlock':
fs/xfs/xfs_buf_item.c:573:9: warning: unused variable 'ordered' [-Wunused-variable]

  bool   ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);
         ^

Introduced by commit

a097077ef708 ("xfs: remove unnecessary dirty bli format check for ordered bufs")

Ugh, this is due to the refactoring of this patch between v1 and v2. I specifically recall testing for this in v1 because I added the ordered bool purely to clean up the ASSERT(), then I apparently lost of track of it for v2.

Anyways.. Christoph, Darrick, preferences to clean this up..? I have no preference between the v1 or v2 factoring. Or if it's easier, we could always just drop something like the hunk below on top. Thoughts?

Brian

--- 8< ---

fs/xfs/xfs_buf_item.c +7 -4
index ef2c137..f5d25f5 100644
@@ -567,10 +567,15 @@ xfs_buf_item_unlock(
 {
 	struct xfs_buf_log_item	*bip = BUF_ITEM(lip);
 	struct xfs_buf		*bp = bip->bli_buf;
-	bool			aborted = !!(lip->li_flags & XFS_LI_ABORTED);
-	bool			hold = !!(bip->bli_flags & XFS_BLI_HOLD);
-	bool			dirty = !!(bip->bli_flags & XFS_BLI_DIRTY);
-	bool			ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);
+	bool			aborted;
+	bool			hold;
+	bool			dirty;
+	bool			ordered;
+
+	aborted = !!(lip->li_flags & XFS_LI_ABORTED);
+	hold = !!(bip->bli_flags & XFS_BLI_HOLD);
Quoted 9 lines

fs/xfs/xfs_buf_item.c xfs_buf_item_unlock( · line 578

Quoted 2 lines
fs/xfs/xfs_buf_item.c +2 -0
+	dirty = !!(bip->bli_flags & XFS_BLI_DIRTY);
+	ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);

The trouble is, 'ordered' is still an unused variable on !DEBUG builds, since the only user of ordered is that ASSERT. So either we #ifdef DEBUG the variable out of existence or employ one of those silly 'ordered = ordered' constructions to shut up gcc, if that even still works.

The warning goes away for me if we separate the initialization of ordered from the declaration. Do you observe otherwise?

Brian

Quoted 13 lines

--D

Quoted 7 lines
fs/xfs/xfs_buf_item.c +0 -1
 	/* Clear the buffer's association with this transaction. */
 	bp->b_transp = NULL;
--

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

--
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

#4 lore raw
Quoted 60 lines · Brian Foster
Quoted 49 lines · Darrick J. Wong
Quoted 48 lines · Brian Foster
Quoted 5 lines · Stephen Rothwell

Hi all,

After merging the xfs tree, today's linux-next build (powerpc ppc64_defconfig) produced this warning:

Quoted 9 lines

fs/xfs/xfs_buf_item.c: In function 'xfs_buf_item_unlock':
fs/xfs/xfs_buf_item.c:573:9: warning: unused variable 'ordered' [-Wunused-variable]

  bool   ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);
         ^

Introduced by commit

a097077ef708 ("xfs: remove unnecessary dirty bli format check for ordered bufs")

Ugh, this is due to the refactoring of this patch between v1 and v2. I specifically recall testing for this in v1 because I added the ordered bool purely to clean up the ASSERT(), then I apparently lost of track of it for v2.

Anyways.. Christoph, Darrick, preferences to clean this up..? I have no preference between the v1 or v2 factoring. Or if it's easier, we could always just drop something like the hunk below on top. Thoughts?

Brian

--- 8< ---

fs/xfs/xfs_buf_item.c +7 -4
index ef2c137..f5d25f5 100644
@@ -567,10 +567,15 @@ xfs_buf_item_unlock(
 {
 	struct xfs_buf_log_item	*bip = BUF_ITEM(lip);
 	struct xfs_buf		*bp = bip->bli_buf;
-	bool			aborted = !!(lip->li_flags & XFS_LI_ABORTED);
-	bool			hold = !!(bip->bli_flags & XFS_BLI_HOLD);
-	bool			dirty = !!(bip->bli_flags & XFS_BLI_DIRTY);
-	bool			ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);
+	bool			aborted;
+	bool			hold;
+	bool			dirty;
+	bool			ordered;
+
+	aborted = !!(lip->li_flags & XFS_LI_ABORTED);
+	hold = !!(bip->bli_flags & XFS_BLI_HOLD);
Quoted 9 lines

fs/xfs/xfs_buf_item.c xfs_buf_item_unlock( · line 578

Quoted 2 lines
fs/xfs/xfs_buf_item.c +2 -0
+	dirty = !!(bip->bli_flags & XFS_BLI_DIRTY);
+	ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);

The trouble is, 'ordered' is still an unused variable on !DEBUG builds, since the only user of ordered is that ASSERT. So either we #ifdef DEBUG the variable out of existence or employ one of those silly 'ordered = ordered' constructions to shut up gcc, if that even still works.

Quoted 2 lines

The warning goes away for me if we separate the initialization of ordered from the declaration. Do you observe otherwise?

Hm. Seems to shut up gcc, so I guess it's fine. In the past it would whine, but I guess they fixed it or something.

Want to send it as a real [PATCH]?

--D

Quoted 20 lines

Brian

Quoted 9 lines

--D

Quoted 7 lines
fs/xfs/xfs_buf_item.c +0 -1
 	/* Clear the buffer's association with this transaction. */
 	bp->b_transp = NULL;
--

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

Quoted 4 lines

--
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

--
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

#5 lore raw
In reply to Brian Foster
Quoted 60 lines · Brian Foster
Quoted 49 lines · Darrick J. Wong
Quoted 48 lines · Brian Foster
Quoted 5 lines · Stephen Rothwell

Hi all,

After merging the xfs tree, today's linux-next build (powerpc ppc64_defconfig) produced this warning:

Quoted 9 lines

fs/xfs/xfs_buf_item.c: In function 'xfs_buf_item_unlock':
fs/xfs/xfs_buf_item.c:573:9: warning: unused variable 'ordered' [-Wunused-variable]

  bool   ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);
         ^

Introduced by commit

a097077ef708 ("xfs: remove unnecessary dirty bli format check for ordered bufs")

Ugh, this is due to the refactoring of this patch between v1 and v2. I specifically recall testing for this in v1 because I added the ordered bool purely to clean up the ASSERT(), then I apparently lost of track of it for v2.

Anyways.. Christoph, Darrick, preferences to clean this up..? I have no preference between the v1 or v2 factoring. Or if it's easier, we could always just drop something like the hunk below on top. Thoughts?

Brian

--- 8< ---

fs/xfs/xfs_buf_item.c +7 -4
index ef2c137..f5d25f5 100644
@@ -567,10 +567,15 @@ xfs_buf_item_unlock(
 {
 	struct xfs_buf_log_item	*bip = BUF_ITEM(lip);
 	struct xfs_buf		*bp = bip->bli_buf;
-	bool			aborted = !!(lip->li_flags & XFS_LI_ABORTED);
-	bool			hold = !!(bip->bli_flags & XFS_BLI_HOLD);
-	bool			dirty = !!(bip->bli_flags & XFS_BLI_DIRTY);
-	bool			ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);
+	bool			aborted;
+	bool			hold;
+	bool			dirty;
+	bool			ordered;
+
+	aborted = !!(lip->li_flags & XFS_LI_ABORTED);
+	hold = !!(bip->bli_flags & XFS_BLI_HOLD);
Quoted 9 lines

fs/xfs/xfs_buf_item.c xfs_buf_item_unlock( · line 578

Quoted 2 lines
fs/xfs/xfs_buf_item.c +2 -0
+	dirty = !!(bip->bli_flags & XFS_BLI_DIRTY);
+	ordered = !!(bip->bli_flags & XFS_BLI_ORDERED);

The trouble is, 'ordered' is still an unused variable on !DEBUG builds, since the only user of ordered is that ASSERT. So either we #ifdef DEBUG the variable out of existence or employ one of those silly 'ordered = ordered' constructions to shut up gcc, if that even still works.

Quoted 2 lines

The warning goes away for me if we separate the initialization of ordered from the declaration. Do you observe otherwise?

Various versions of gcc will throw set-but-unused warnings on this. Just #define it away or factor the debug code into another function.

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]