Skip to contentSkip to conversation

xfs: fix compilation warnings in xfs_sync_sb_buf when CONFIG_XFS_RT=n

PATCH In review Yun Zhou 3 participants 5 messages Jul 22 XFS filesystem

lore
Share & tools
lore

Yun Zhou

author
#0 lore raw

PATCH 1/1 xfs: fix compilation warnings in xfs_sync_sb_buf when CONFIG_XFS_RT=n

When CONFIG_XFS_RT is disabled, xfs_log_rtsb() is a macro expanding to (NULL), causing 'statement with no effect' and 'variable set but not used' warnings.

Fix by removing the bp variable and passing xfs_trans_getsb(tp) directly to xfs_log_rtsb(). This is safe because xfs_log_sb() already joins the sb buffer to the transaction internally.

Fixes b9ad0b9891dd ("xfs: don't hold buffer locks across sync transaction commit in xfs_sync_sb_buf")
---
 fs/xfs/libxfs/xfs_sb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/xfs/libxfs/xfs_sb.c +1 -3
index fbb4505b1e9e..c4fa7fb0e39a 100644
@@ -1470,17 +1470,15 @@ xfs_sync_sb_buf(
 	bool			update_rtsb)
 {
 	struct xfs_trans	*tp;
-	struct xfs_buf		*bp;
 	int			error;
 
 	error = xfs_trans_alloc(mp, &M_RES(mp)->tr_sb, 0, 0, 0, &tp);
 	if (error)
 		return error;
 
-	bp = xfs_trans_getsb(tp);
 	xfs_log_sb(tp);
 	if (update_rtsb)
-		xfs_log_rtsb(tp, bp);
+		(void)xfs_log_rtsb(tp, xfs_trans_getsb(tp));
 	xfs_trans_set_sync(tp);
 	error = xfs_trans_commit(tp);
 	if (error)
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 4 lines · Yun Zhou

When CONFIG_XFS_RT is disabled, xfs_log_rtsb() is a macro expanding to (NULL), causing 'statement with no effect' and 'variable set but not used' warnings.

Quoted 8 lines

Fix by removing the bp variable and passing xfs_trans_getsb(tp) directly to xfs_log_rtsb(). This is safe because xfs_log_sb() already joins the sb buffer to the transaction internally.

Fixes b9ad0b9891dd ("xfs: don't hold buffer locks across sync transaction commit in xfs_sync_sb_buf")

We don't need a fix for a patch that is still in linux-next... Merge it against your original patch and re-send it. I'll just replace the old patch

Quoted 31 lines
---
 fs/xfs/libxfs/xfs_sb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/xfs/libxfs/xfs_sb.c +1 -3
index fbb4505b1e9e..c4fa7fb0e39a 100644
@@ -1470,17 +1470,15 @@ xfs_sync_sb_buf(
 	bool			update_rtsb)
 {
 	struct xfs_trans	*tp;
-	struct xfs_buf		*bp;
 	int			error;
 
 	error = xfs_trans_alloc(mp, &M_RES(mp)->tr_sb, 0, 0, 0, &tp);
 	if (error)
 		return error;
 
-	bp = xfs_trans_getsb(tp);
 	xfs_log_sb(tp);
 	if (update_rtsb)
-		xfs_log_rtsb(tp, bp);
+		(void)xfs_log_rtsb(tp, xfs_trans_getsb(tp));
 	xfs_trans_set_sync(tp);
 	error = xfs_trans_commit(tp);
 	if (error)
Signature · 1 line
2.43.0
#2 lore raw
Quoted 3 lines · Carlos Maiolino

We don't need a fix for a patch that is still in linux-next... Merge it against your original patch and re-send it. I'll just replace the old patch

And please turn the stub into an inline function to avoid the ugly void casting.

author
#3 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 3 lines · Carlos Maiolino

We don't need a fix for a patch that is still in linux-next... Merge it against your original patch and re-send it. I'll just replace the old patch

And please turn the stub into an inline function to avoid the ugly void casting.

Okay, I fold the inline function conversion into v2.

Thanks,
Yun

author
#4 lore raw
In reply to Carlos Maiolino
Quoted 9 lines · Carlos Maiolino
Quoted 8 lines · Yun Zhou

When CONFIG_XFS_RT is disabled, xfs_log_rtsb() is a macro expanding to (NULL), causing 'statement with no effect' and 'variable set but not used' warnings.

Fix by removing the bp variable and passing xfs_trans_getsb(tp) directly to xfs_log_rtsb(). This is safe because xfs_log_sb() already joins the sb buffer to the transaction internally.

Quoted 9 lines
Quoted 4 lines
Fixes b9ad0b9891dd ("xfs: don't hold buffer locks across sync transaction commit in xfs_sync_sb_buf")

We don't need a fix for a patch that is still in linux-next... Merge it against your original patch and re-send it. I'll just replace the old patch

Okay, I will resend v2 as requested. Sorry for the inconvenience.

BR,
Yun