On Tue 20-05-14 02:33:23, Thavatchai Makphaibulchoke wrote: > Please see my one comment below. > > BTW, I've run aim7 on your before I notice what I commented below. There > are workloads that my patch outperform yours and vice versa. I will have > to redo it over again. > > On 05/15/2014 02:17 PM, Jan Kara wrote: > > @@ -2631,13 +2644,18 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) > > if (!sbi->s_journal && !(sbi->s_mount_state & EXT4_ORPHAN_FS)) > > return 0; > > > > - mutex_lock(&sbi->s_orphan_lock); > > + WARN_ON_ONCE(!(inode->i_state & (I_NEW | I_FREEING)) && > > + !mutex_is_locked(&inode->i_mutex)); > > + /* Do this quick check before taking global s_orphan_lock. */ > > if (list_empty(&ei->i_orphan)) > > - goto out; > > + return 0; > > > > - ino_next = NEXT_ORPHAN(inode); > > - prev = ei->i_orphan.prev; > > + if (handle) { > > + /* Grab inode buffer early before taking global s_orphan_lock */ > > + err = ext4_reserve_inode_write(handle, inode, &iloc); > > + } > > > > + mutex_lock(&sbi->s_orphan_lock); > > jbd_debug(4, "remove inode %lu from orphan list\n", inode->i_ino); > > > > Should set prev = ei->i_orphan.prev; here, instead of down below where it > has already been removed from the list. Bah, I'm sorry for causing extra work to you. That's a really stupid mistake. Thanks for finding that! Also I've realized we cannot really reliably do ext4_mark_iloc_dirty(handle, i_prev, &iloc2); outside of s_orphan_lock because that inode may be reclaimed the moment after we drop s_orphan_lock. So I had to remove that optimization as well and move the call back under s_orphan_lock. I'm running xfstests now (updated so they include also the test Ted found failing) to verify correctness again and then I'll get my performance numbers with fixed patches. Honza -- Jan Kara <jack@xxxxxxx> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html