+
+#ifdef ilock
+#undef ilock
+#endif
+#ifdef irele
+#undef irele
+#endif
+/*
+ * Lock an inode. If its already locked, set the WANT bit and sleep.
+ */
+ilock(ip)
+ register struct inode *ip;
+{
+
+ while (ip->i_flag&ILOCK) {
+ ip->i_flag |= IWANT;
+ sleep((caddr_t)ip, PINOD);
+ }
+ ip->i_flag |= ILOCK;
+}
+
+/*
+ * Unlock an inode. If WANT bit is on, wakeup.
+ */
+irele(ip)
+ register struct inode *ip;
+{
+
+ ip->i_flag &= ~ILOCK;
+ if (ip->i_flag&IWANT) {
+ ip->i_flag &= ~IWANT;
+ wakeup((caddr_t)ip);
+ }
+}