public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] XFS: random cleanups of xfs_swap_extents
@ 2008-11-07 23:00 Josef 'Jeff' Sipek
  2008-11-12 10:09 ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Josef 'Jeff' Sipek @ 2008-11-07 23:00 UTC (permalink / raw)
  To: XFS Mailing List

XFS: random cleanups of xfs_swap_extents

From: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>

1) remove lock_flags var since it's never modified and only obfuscates the
code

2) calling kfree/vfree on a NULL is valid

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>

--

I did only compile testing. If people really want, I can go ahead and set up
my xfsqa test box again and run the patch through it.

diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index 75b0cd4..d65e81e 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -132,7 +132,6 @@ xfs_swap_extents(
 	xfs_bstat_t	*sbp = &sxp->sx_stat;
 	xfs_ifork_t	*tempifp, *ifp, *tifp;
 	int		ilf_fields, tilf_fields;
-	static uint	lock_flags = XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL;
 	int		error = 0;
 	int		aforkblks = 0;
 	int		taforkblks = 0;
@@ -346,10 +345,10 @@ xfs_swap_extents(
 
 
 	IHOLD(ip);
-	xfs_trans_ijoin(tp, ip, lock_flags);
+	xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
 
 	IHOLD(tip);
-	xfs_trans_ijoin(tp, tip, lock_flags);
+	xfs_trans_ijoin(tp, tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
 
 	xfs_trans_log_inode(tp, ip,  ilf_fields);
 	xfs_trans_log_inode(tp, tip, tilf_fields);
@@ -367,10 +366,10 @@ xfs_swap_extents(
 
  error0:
 	if (locked) {
-		xfs_iunlock(ip,  lock_flags);
-		xfs_iunlock(tip, lock_flags);
+		xfs_iunlock(ip,  XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
+		xfs_iunlock(tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
 	}
-	if (tempifp != NULL)
-		kmem_free(tempifp);
+
+	kmem_free(tempifp);
 	return error;
 }

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

end of thread, other threads:[~2008-12-22 14:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-07 23:00 [PATCH] XFS: random cleanups of xfs_swap_extents Josef 'Jeff' Sipek
2008-11-12 10:09 ` Christoph Hellwig
2008-11-12 15:39   ` Josef 'Jeff' Sipek
2008-12-22 13:02     ` Christoph Hellwig
2008-12-22 14:58       ` Josef 'Jeff' Sipek
2008-12-22 14:59         ` Christoph Hellwig

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