Skip to contentSkip to conversation

xfs: fix some sparse warnings.

PATCH Applied Dave Chinner 3 participants 9 messages Sep 2, 2013 – Sep 9, 2013 XFS filesystem

lore
Share & tools
lore
#0 lore raw

cover xfs: fix some sparse warnings.

The first patch is a new warning from the log recovery ordering code
- I used the wrong structure to pull the superblock LSN out of the on disk buffer. On most platforms there should be no actual bug here as both the xfs_sb and xfs_dsb have identical layouts.

The second patch is just fixing a few bits of warning noise that sparse produces. There's not actual compiled code change from them.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw

PATCH 1/2 xfs: fix endian warning in xlog_recover_get_buf_lsn()

From: Dave Chinner <[email protected]>

sparse reports:

fs/xfs/xfs_log_recover.c:2017:24: sparse: cast to restricted __be64

Because I used the wrong structure for the on-disk superblock cast in 50d5c8d ("xfs: check LSN ordering for v5 superblocks during recovery"). Fix it.

Reported-by kbuild test robot
---
 fs/xfs/xfs_log_recover.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_log_recover.c +1 -1
index 8984ec4..1c3b0c9 100644
@@ -2014,7 +2014,7 @@ xlog_recover_get_buf_lsn(
 	case XFS_ATTR3_RMT_MAGIC:
 		return be64_to_cpu(((struct xfs_attr3_rmt_hdr *)blk)->rm_lsn);
 	case XFS_SB_MAGIC:
-		return be64_to_cpu(((struct xfs_sb *)blk)->sb_lsn);
+		return be64_to_cpu(((struct xfs_dsb *)blk)->sb_lsn);
 	default:
 		break;
 	}
Signature · 6 lines
1.8.3.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] xfs: fix endian warning in xlog_recover_get_buf_lsn()

Quoted 4 lines · Dave Chinner

From: Dave Chinner <[email protected]>

sparse reports:

Quoted 8 lines

fs/xfs/xfs_log_recover.c:2017:24: sparse: cast to restricted __be64

Because I used the wrong structure for the on-disk superblock cast in 50d5c8d ("xfs: check LSN ordering for v5 superblocks during recovery"). Fix it.

Reported-by kbuild test robot

Looks good,

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Applied
#3 lore raw

Re: [PATCH 1/2] xfs: fix endian warning in xlog_recover_get_buf_lsn()

In reply to Dave Chinner
Quoted 4 lines · Dave Chinner

From: Dave Chinner <[email protected]>

sparse reports:

Quoted 8 lines

fs/xfs/xfs_log_recover.c:2017:24: sparse: cast to restricted __be64

Because I used the wrong structure for the on-disk superblock cast in 50d5c8d ("xfs: check LSN ordering for v5 superblocks during recovery"). Fix it.

Reported-by kbuild test robot

Applied.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#4 lore raw

PATCH 2/2 xfs: fix some minor sparse warnings

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

A couple of simple locking annotations and 0 vs NULL warnings. Nothing that changes any code behaviour, just removes build noise.

---
 fs/xfs/xfs_bmap.c        | 2 +-
 fs/xfs/xfs_dquot_item.c  | 2 ++
 fs/xfs/xfs_extent_busy.c | 2 ++
 fs/xfs/xfs_ioctl.c       | 2 +-
 fs/xfs/xfs_itable.c      | 5 +++--
 fs/xfs/xfs_log.c         | 2 ++
 6 files changed, 11 insertions(+), 4 deletions(-)
fs/xfs/xfs_bmap.c +1 -1
index 92b8309..f47e65c 100644
@@ -4450,7 +4450,7 @@ xfs_bmapi_write(
 {
 	struct xfs_mount	*mp = ip->i_mount;
 	struct xfs_ifork	*ifp;
-	struct xfs_bmalloca	bma = { 0 };	/* args for xfs_bmap_alloc */
+	struct xfs_bmalloca	bma = { NULL };	/* args for xfs_bmap_alloc */
 	xfs_fileoff_t		end;		/* end of mapped file region */
 	int			eof;		/* after the end of extents */
 	int			error;		/* error return */
fs/xfs/xfs_dquot_item.c +2 -0
index 60c6e1f..77eb762 100644
@@ -143,6 +143,8 @@ STATIC uint
 xfs_qm_dquot_logitem_push(
 	struct xfs_log_item	*lip,
 	struct list_head	*buffer_list)
+	__releases(&lip->li_ailp->xa_lock)
+	__acquires(&lip->li_ailp->xa_lock)
 {
 	struct xfs_dquot	*dqp = DQUOT_ITEM(lip)->qli_dquot;
 	struct xfs_buf		*bp = NULL;
fs/xfs/xfs_extent_busy.c +2 -0
index 86f559f..504e51ee 100644
@@ -161,6 +161,8 @@ xfs_extent_busy_update_extent(
 	xfs_agblock_t		fbno,
 	xfs_extlen_t		flen,
 	bool			userdata)
+	__releases(&pag->pagb_lock)
+	__acquires(&pag->pagb_lock)
 {
 	xfs_agblock_t		fend = fbno + flen;
 	xfs_agblock_t		bbno = busyp->bno;
fs/xfs/xfs_ioctl.c +1 -1
index bdebc21..21d9c9df 100644
@@ -71,7 +71,7 @@ xfs_find_handle(
 	int			hsize;
 	xfs_handle_t		handle;
 	struct inode		*inode;
-	struct fd		f = {0};
+	struct fd		f = {NULL};
 	struct path		path;
 	int			error;
 	struct xfs_inode	*ip;
fs/xfs/xfs_itable.c +3 -2
index b93e14b..8a67d53 100644
@@ -541,8 +541,9 @@ xfs_bulkstat_single(
 	 * at the expense of the error case.
 	 */
 
-	ino = (xfs_ino_t)*lastinop;
-	error = xfs_bulkstat_one(mp, ino, buffer, sizeof(xfs_bstat_t), 0, &res);
+	ino = *lastinop;
+	error = xfs_bulkstat_one(mp, ino, buffer, sizeof(xfs_bstat_t),
+				 NULL, &res);
 	if (error) {
 		/*
 		 * Special case way failed, do it the "long" way
fs/xfs/xfs_log.c +2 -0
index 5372d58..8215b63 100644
@@ -258,6 +258,8 @@ xlog_grant_head_wait(
 	struct xlog_grant_head	*head,
 	struct xlog_ticket	*tic,
 	int			need_bytes)
+	__releases(&head->lock)
+	__acquires(&head->lock)
 {
 	list_add_tail(&tic->t_queue, &head->waiters);
 
Signature · 6 lines
1.8.3.2

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] xfs: fix some minor sparse warnings

fs/xfs/xfs_dquot_item.c STATIC uint · line 148

Quoted 9 lines
fs/xfs/xfs_dquot_item.c +2 -0
@@ -143,6 +143,8 @@ STATIC uint
 xfs_qm_dquot_logitem_push(
 	struct xfs_log_item	*lip,
 	struct list_head	*buffer_list)
+	__releases(&lip->li_ailp->xa_lock)
+	__acquires(&lip->li_ailp->xa_lock)
 {

Having these markers indented the same amount as the parameters isn't very readable. Maybe give them another tab level?

Otherwise looks good:

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#6 lore raw

Re: [PATCH 2/2] xfs: fix some minor sparse warnings

Quoted 4 lines · Christoph Hellwig
Quoted 4 lines
fs/xfs/xfs_dquot_item.c +0 -0
@@ -143,6 +143,8 @@ STATIC uint
 xfs_qm_dquot_logitem_push(
Quoted 8 lines

fs/xfs/xfs_dquot_item.c STATIC uint · line 148

Quoted 5 lines
fs/xfs/xfs_dquot_item.c +2 -0
 	struct xfs_log_item	*lip,
 	struct list_head	*buffer_list)
+	__releases(&lip->li_ailp->xa_lock)
+	__acquires(&lip->li_ailp->xa_lock)
 {

Having these markers indented the same amount as the parameters isn't very readable. Maybe give them another tab level?

Sure. Can do.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#7 lore raw

PATCH v2 2/2 xfs: fix some minor sparse warnings

xfs: fix some minor sparse warnings

From: Dave Chinner <[email protected]>

A couple of simple locking annotations and 0 vs NULL warnings. Nothing that changes any code behaviour, just removes build noise.

---
v2: move __release annotations to match the other notations in the
XFS code at the end of the function declaration.

 fs/xfs/xfs_bmap.c        | 2 +-
 fs/xfs/xfs_dquot_item.c  | 3 ++-
 fs/xfs/xfs_extent_busy.c | 3 ++-
 fs/xfs/xfs_ioctl.c       | 2 +-
 fs/xfs/xfs_itable.c      | 5 +++--
 fs/xfs/xfs_log.c         | 3 ++-
 6 files changed, 11 insertions(+), 7 deletions(-)
fs/xfs/xfs_bmap.c +1 -1
index 92b8309..f47e65c 100644
@@ -4450,7 +4450,7 @@ xfs_bmapi_write(
 {
 	struct xfs_mount	*mp = ip->i_mount;
 	struct xfs_ifork	*ifp;
-	struct xfs_bmalloca	bma = { 0 };	/* args for xfs_bmap_alloc */
+	struct xfs_bmalloca	bma = { NULL };	/* args for xfs_bmap_alloc */
 	xfs_fileoff_t		end;		/* end of mapped file region */
 	int			eof;		/* after the end of extents */
 	int			error;		/* error return */
fs/xfs/xfs_dquot_item.c +2 -1
index 60c6e1f..e838d84 100644
@@ -142,7 +142,8 @@ xfs_qm_dqunpin_wait(
 STATIC uint
 xfs_qm_dquot_logitem_push(
 	struct xfs_log_item	*lip,
-	struct list_head	*buffer_list)
+	struct list_head	*buffer_list) __releases(&lip->li_ailp->xa_lock)
+					      __acquires(&lip->li_ailp->xa_lock)
 {
 	struct xfs_dquot	*dqp = DQUOT_ITEM(lip)->qli_dquot;
 	struct xfs_buf		*bp = NULL;
fs/xfs/xfs_extent_busy.c +2 -1
index 86f559f..e43708e 100644
@@ -160,7 +160,8 @@ xfs_extent_busy_update_extent(
 	struct xfs_extent_busy	*busyp,
 	xfs_agblock_t		fbno,
 	xfs_extlen_t		flen,
-	bool			userdata)
+	bool			userdata) __releases(&pag->pagb_lock)
+					  __acquires(&pag->pagb_lock)
 {
 	xfs_agblock_t		fend = fbno + flen;
 	xfs_agblock_t		bbno = busyp->bno;
fs/xfs/xfs_ioctl.c +1 -1
index bdebc21..21d9c9df 100644
@@ -71,7 +71,7 @@ xfs_find_handle(
 	int			hsize;
 	xfs_handle_t		handle;
 	struct inode		*inode;
-	struct fd		f = {0};
+	struct fd		f = {NULL};
 	struct path		path;
 	int			error;
 	struct xfs_inode	*ip;
fs/xfs/xfs_itable.c +3 -2
index b93e14b..8a67d53 100644
@@ -541,8 +541,9 @@ xfs_bulkstat_single(
 	 * at the expense of the error case.
 	 */
 
-	ino = (xfs_ino_t)*lastinop;
-	error = xfs_bulkstat_one(mp, ino, buffer, sizeof(xfs_bstat_t), 0, &res);
+	ino = *lastinop;
+	error = xfs_bulkstat_one(mp, ino, buffer, sizeof(xfs_bstat_t),
+				 NULL, &res);
 	if (error) {
 		/*
 		 * Special case way failed, do it the "long" way
fs/xfs/xfs_log.c +2 -1
index 5372d58..a2dea108 100644
@@ -257,7 +257,8 @@ xlog_grant_head_wait(
 	struct xlog		*log,
 	struct xlog_grant_head	*head,
 	struct xlog_ticket	*tic,
-	int			need_bytes)
+	int			need_bytes) __releases(&head->lock)
+					    __acquires(&head->lock)
 {
 	list_add_tail(&tic->t_queue, &head->waiters);
 

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Applied
#8 lore raw

Re: [PATCH 2/2 v2] xfs: fix some minor sparse warnings

Quoted 9 lines · Dave Chinner

xfs: fix some minor sparse warnings

From: Dave Chinner <[email protected]>

A couple of simple locking annotations and 0 vs NULL warnings. Nothing that changes any code behaviour, just removes build noise.

Applied.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs