On Sat, Feb 01, 2020 at 01:49:31PM +0800, qiwuchen55@xxxxxxxxx wrote: > Apparently our current rwsem code doesn't like doing the trylock, then > lock for real scheme. So change our direct write method to just do the > trylock for the RWF_NOWAIT case. > This seems to fix AIM7 regression in some scalable filesystems upto ~25% > in some cases. Claimed in commit 942491c9e6d6 ("xfs: fix AIM7 regression") This commit message doesn't match the patch. > /* Don't allow parallel writes to the same file */ > - inode_lock(inode); > + if (iocb->ki_flags & IOCB_NOWAIT) { > + if (!inode_trylock(inode)) > + return -EAGAIN; > + } else { > + inode_lock(inode); > + } > + > res = generic_write_checks(iocb, from); > if (res > 0) { > if (!is_sync_kiocb(iocb) && iocb->ki_flags & IOCB_DIRECT) { > -- > 1.9.1 >