+/*
+ * Convert a pointer to an inode into a reference to an inode.
+ *
+ * This is basically the internal piece of iget (after the
+ * inode pointer is located) but without the test for mounted
+ * filesystems. It is caller's responsibility to check that
+ * the inode pointer is valid.
+ */
+igrab(ip)
+ register struct inode *ip;
+{
+ while ((ip->i_flag&ILOCKED) != 0) {
+ ip->i_flag |= IWANT;
+ sleep((caddr_t)ip, PINOD);
+ }
+ if (ip->i_count == 0) { /* ino on free list */
+ register struct inode *iq;
+
+ if (iq = ip->i_freef)
+ iq->i_freeb = ip->i_freeb;
+ else
+ ifreet = ip->i_freeb;
+ *ip->i_freeb = iq;
+ ip->i_freef = NULL;
+ ip->i_freeb = NULL;
+ }
+ ip->i_count++;
+ ip->i_flag |= ILOCKED;
+}
+