From: "Josef 'Jeff' Sipek" <jeffpc@josefsipek.net>
To: XFS Mailing List <xfs@oss.sgi.com>
Subject: [PATCH] XFS: random cleanups of xfs_swap_extents
Date: Fri, 7 Nov 2008 18:00:54 -0500 [thread overview]
Message-ID: <20081107230054.GH26208@josefsipek.net> (raw)
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;
}
next reply other threads:[~2008-11-07 23:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-07 23:00 Josef 'Jeff' Sipek [this message]
2008-11-12 10:09 ` [PATCH] XFS: random cleanups of xfs_swap_extents 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081107230054.GH26208@josefsipek.net \
--to=jeffpc@josefsipek.net \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox