On Oct 15, 2006 13:14 -0700, Mark Fasheh wrote: > +void inode_double_lock(struct inode *inode1, struct inode *inode2) > +{ > + if (!inode1 || !inode2) { > + if (inode1) > + mutex_lock(&inode1->i_mutex); > + else if (inode2) > + mutex_lock(&inode2->i_mutex); > + return; > + } > + > + if (inode1 == inode2) { > + mutex_lock(&inode1->i_mutex); Could be a tiny bit cleaner if you put the "inode1 == inode2" case above: void inode_double_lock(struct inode *inode1, struct inode *inode2) { if (inode1 == NULL || inode2 == NULL || inode1 == inode2) { if (inode1) mutex_lock(&inode1->i_mutex); else if (inode2) mutex_lock(&inode2->i_mutex); return; } if (inode1 < inode2) { mutex_lock_nested(&inode1->i_mutex, I_MUTEX_PARENT); mutex_lock_nested(&inode2->i_mutex, I_MUTEX_CHILD); } else { mutex_lock_nested(&inode2->i_mutex, I_MUTEX_PARENT); mutex_lock_nested(&inode1->i_mutex, I_MUTEX_CHILD); } } Cheers, Andreas -- Andreas Dilger Principal Software Engineer Cluster File Systems, Inc. - To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html