public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] do not test return value of xfs_bmap_*_count_leaves
@ 2008-03-28 15:43 Ruben Porras
  2008-03-28 15:46 ` Josef 'Jeff' Sipek
  0 siblings, 1 reply; 3+ messages in thread
From: Ruben Porras @ 2008-03-28 15:43 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: Type: text/plain, Size: 153 bytes --]

These functions, xfs_bmap_count_leaves and xfs_bmap_disk_count_leaves,
return always 0. Therefore it is not necessary to test the return value.

Regards

[-- Attachment #2: xfs_bmap.patch --]
[-- Type: text/x-patch, Size: 1246 bytes --]

Index: fs/xfs/xfs_bmap.c
===================================================================
RCS file: /cvs/linux-2.6-xfs/fs/xfs/xfs_bmap.c,v
retrieving revision 1.383
diff -u -r1.383 xfs_bmap.c
--- fs/xfs/xfs_bmap.c	6 Feb 2008 05:18:18 -0000	1.383
+++ fs/xfs/xfs_bmap.c	28 Mar 2008 15:39:59 -0000
@@ -6361,13 +6361,9 @@
 	mp = ip->i_mount;
 	ifp = XFS_IFORK_PTR(ip, whichfork);
 	if ( XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_EXTENTS ) {
-		if (unlikely(xfs_bmap_count_leaves(ifp, 0,
+		xfs_bmap_count_leaves(ifp, 0,
 			ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t),
-			count) < 0)) {
-			XFS_ERROR_REPORT("xfs_bmap_count_blocks(1)",
-					 XFS_ERRLEVEL_LOW, mp);
-			return XFS_ERROR(EFSCORRUPTED);
-		}
+			count);
 		return 0;
 	}
 
@@ -6448,13 +6444,7 @@
 		for (;;) {
 			nextbno = be64_to_cpu(block->bb_rightsib);
 			numrecs = be16_to_cpu(block->bb_numrecs);
-			if (unlikely(xfs_bmap_disk_count_leaves(0,
-					block, numrecs, count) < 0)) {
-				xfs_trans_brelse(tp, bp);
-				XFS_ERROR_REPORT("xfs_bmap_count_tree(2)",
-						 XFS_ERRLEVEL_LOW, mp);
-				return XFS_ERROR(EFSCORRUPTED);
-			}
+			xfs_bmap_disk_count_leaves(0, block, numrecs, count);
 			xfs_trans_brelse(tp, bp);
 			if (nextbno == NULLFSBLOCK)
 				break;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] do not test return value of xfs_bmap_*_count_leaves
  2008-03-28 15:43 [PATCH] do not test return value of xfs_bmap_*_count_leaves Ruben Porras
@ 2008-03-28 15:46 ` Josef 'Jeff' Sipek
  2008-04-04 15:08   ` Ruben Porras
  0 siblings, 1 reply; 3+ messages in thread
From: Josef 'Jeff' Sipek @ 2008-03-28 15:46 UTC (permalink / raw)
  To: Ruben Porras; +Cc: xfs

On Fri, Mar 28, 2008 at 04:43:31PM +0100, Ruben Porras wrote:
> These functions, xfs_bmap_count_leaves and xfs_bmap_disk_count_leaves,
> return always 0. Therefore it is not necessary to test the return value.
 
If it always returns 0, why not make it void?

Josef 'Jeff' Sipek.

-- 
Hegh QaQ law'
quvHa'ghach QaQ puS

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] do not test return value of xfs_bmap_*_count_leaves
  2008-03-28 15:46 ` Josef 'Jeff' Sipek
@ 2008-04-04 15:08   ` Ruben Porras
  0 siblings, 0 replies; 3+ messages in thread
From: Ruben Porras @ 2008-04-04 15:08 UTC (permalink / raw)
  To: Josef 'Jeff' Sipek; +Cc: xfs

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]


Am Freitag, den 28.03.2008, 11:46 -0400 schrieb Josef 'Jeff' Sipek:
> On Fri, Mar 28, 2008 at 04:43:31PM +0100, Ruben Porras wrote:
> > These functions, xfs_bmap_count_leaves and xfs_bmap_disk_count_leaves,
> > return always 0. Therefore it is not necessary to test the return value.
>  
> If it always returns 0, why not make it void?

better, patch attached.

-- 
Rubén Porras Campo
Telekommunikation Engineer

LinWorks GmbH
Robert-Koch-Straße 9; 64331 Weiterstadt
http://www.linworks.de

[-- Attachment #2: xfs_bmap.patch --]
[-- Type: text/x-patch, Size: 1914 bytes --]

Index: fs/xfs/xfs_bmap.c
===================================================================
RCS file: /cvs/linux-2.6-xfs/fs/xfs/xfs_bmap.c,v
retrieving revision 1.387
diff -u -r1.387 xfs_bmap.c
--- fs/xfs/xfs_bmap.c	26 Mar 2008 15:25:15 -0000	1.387
+++ fs/xfs/xfs_bmap.c	4 Apr 2008 15:05:14 -0000
@@ -6356,13 +6356,9 @@
 	mp = ip->i_mount;
 	ifp = XFS_IFORK_PTR(ip, whichfork);
 	if ( XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_EXTENTS ) {
-		if (unlikely(xfs_bmap_count_leaves(ifp, 0,
+		xfs_bmap_count_leaves(ifp, 0,
 			ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t),
-			count) < 0)) {
-			XFS_ERROR_REPORT("xfs_bmap_count_blocks(1)",
-					 XFS_ERRLEVEL_LOW, mp);
-			return XFS_ERROR(EFSCORRUPTED);
-		}
+			count);
 		return 0;
 	}
 
@@ -6443,13 +6439,7 @@
 		for (;;) {
 			nextbno = be64_to_cpu(block->bb_rightsib);
 			numrecs = be16_to_cpu(block->bb_numrecs);
-			if (unlikely(xfs_bmap_disk_count_leaves(0,
-					block, numrecs, count) < 0)) {
-				xfs_trans_brelse(tp, bp);
-				XFS_ERROR_REPORT("xfs_bmap_count_tree(2)",
-						 XFS_ERRLEVEL_LOW, mp);
-				return XFS_ERROR(EFSCORRUPTED);
-			}
+			xfs_bmap_disk_count_leaves(0, block, numrecs, count);
 			xfs_trans_brelse(tp, bp);
 			if (nextbno == NULLFSBLOCK)
 				break;
@@ -6467,7 +6457,7 @@
 /*
  * Count leaf blocks given a range of extent records.
  */
-STATIC int
+STATIC void
 xfs_bmap_count_leaves(
 	xfs_ifork_t		*ifp,
 	xfs_extnum_t		idx,
@@ -6480,14 +6470,13 @@
 		xfs_bmbt_rec_host_t *frp = xfs_iext_get_ext(ifp, idx + b);
 		*count += xfs_bmbt_get_blockcount(frp);
 	}
-	return 0;
 }
 
 /*
  * Count leaf blocks given a range of extent records originally
  * in btree format.
  */
-STATIC int
+STATIC void
 xfs_bmap_disk_count_leaves(
 	xfs_extnum_t		idx,
 	xfs_bmbt_block_t	*block,
@@ -6501,5 +6490,4 @@
 		frp = XFS_BTREE_REC_ADDR(xfs_bmbt, block, idx + b);
 		*count += xfs_bmbt_disk_get_blockcount(frp);
 	}
-	return 0;
 }

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-04-04 15:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-28 15:43 [PATCH] do not test return value of xfs_bmap_*_count_leaves Ruben Porras
2008-03-28 15:46 ` Josef 'Jeff' Sipek
2008-04-04 15:08   ` Ruben Porras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox