Linux Compat: inode->i_mutex/i_sem

Create spl_inode_lock/spl_inode_unlock compability macros to simply
access to the inode mutex/sem.  This avoids the need to have to ugly
up the code with the required #define's at every call site.  At the
moment the SPL only uses this in one place but higher layers can
benefit from the macro.
This commit is contained in:
Brian Behlendorf
2011-01-10 12:35:22 -08:00
parent b7dc313837
commit 6bf4d76f47
2 changed files with 14 additions and 11 deletions
+3 -10
View File
@@ -295,11 +295,7 @@ vn_remove(const char *path, uio_seg_t seg, int flags)
if (nd.last_type != LAST_NORM)
SGOTO(exit1, rc);
#ifdef HAVE_INODE_I_MUTEX
mutex_lock_nested(&nd.nd_dentry->d_inode->i_mutex, I_MUTEX_PARENT);
#else
down(&nd.nd_dentry->d_inode->i_sem);
#endif /* HAVE_INODE_I_MUTEX */
spl_inode_lock_nested(nd.nd_dentry->d_inode, I_MUTEX_PARENT);
dentry = vn_lookup_hash(&nd);
rc = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
@@ -318,11 +314,8 @@ vn_remove(const char *path, uio_seg_t seg, int flags)
exit2:
dput(dentry);
}
#ifdef HAVE_INODE_I_MUTEX
mutex_unlock(&nd.nd_dentry->d_inode->i_mutex);
#else
up(&nd.nd_dentry->d_inode->i_sem);
#endif /* HAVE_INODE_I_MUTEX */
spl_inode_unlock(nd.nd_dentry->d_inode);
if (inode)
iput(inode); /* truncate the inode here */
exit1: