@@ -1087,48 +1087,6 @@ void discard_new_inode(struct inode *inode)
1087
1087
}
1088
1088
EXPORT_SYMBOL (discard_new_inode );
1089
1089
1090
- /**
1091
- * lock_two_inodes - lock two inodes (may be regular files but also dirs)
1092
- *
1093
- * Lock any non-NULL argument. The caller must make sure that if he is passing
1094
- * in two directories, one is not ancestor of the other. Zero, one or two
1095
- * objects may be locked by this function.
1096
- *
1097
- * @inode1: first inode to lock
1098
- * @inode2: second inode to lock
1099
- * @subclass1: inode lock subclass for the first lock obtained
1100
- * @subclass2: inode lock subclass for the second lock obtained
1101
- */
1102
- void lock_two_inodes (struct inode * inode1 , struct inode * inode2 ,
1103
- unsigned subclass1 , unsigned subclass2 )
1104
- {
1105
- if (!inode1 || !inode2 ) {
1106
- /*
1107
- * Make sure @subclass1 will be used for the acquired lock.
1108
- * This is not strictly necessary (no current caller cares) but
1109
- * let's keep things consistent.
1110
- */
1111
- if (!inode1 )
1112
- swap (inode1 , inode2 );
1113
- goto lock ;
1114
- }
1115
-
1116
- /*
1117
- * If one object is directory and the other is not, we must make sure
1118
- * to lock directory first as the other object may be its child.
1119
- */
1120
- if (S_ISDIR (inode2 -> i_mode ) == S_ISDIR (inode1 -> i_mode )) {
1121
- if (inode1 > inode2 )
1122
- swap (inode1 , inode2 );
1123
- } else if (!S_ISDIR (inode1 -> i_mode ))
1124
- swap (inode1 , inode2 );
1125
- lock :
1126
- if (inode1 )
1127
- inode_lock_nested (inode1 , subclass1 );
1128
- if (inode2 && inode2 != inode1 )
1129
- inode_lock_nested (inode2 , subclass2 );
1130
- }
1131
-
1132
1090
/**
1133
1091
* lock_two_nondirectories - take two i_mutexes on non-directory objects
1134
1092
*
@@ -1144,7 +1102,12 @@ void lock_two_nondirectories(struct inode *inode1, struct inode *inode2)
1144
1102
WARN_ON_ONCE (S_ISDIR (inode1 -> i_mode ));
1145
1103
if (inode2 )
1146
1104
WARN_ON_ONCE (S_ISDIR (inode2 -> i_mode ));
1147
- lock_two_inodes (inode1 , inode2 , I_MUTEX_NORMAL , I_MUTEX_NONDIR2 );
1105
+ if (inode1 > inode2 )
1106
+ swap (inode1 , inode2 );
1107
+ if (inode1 )
1108
+ inode_lock (inode1 );
1109
+ if (inode2 && inode2 != inode1 )
1110
+ inode_lock_nested (inode2 , I_MUTEX_NONDIR2 );
1148
1111
}
1149
1112
EXPORT_SYMBOL (lock_two_nondirectories );
1150
1113
0 commit comments