On 1:50 12/12, Christoph Hellwig wrote: > On Wed, Dec 11, 2019 at 06:30:39PM -0600, Goldwyn Rodrigues wrote: > > From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> > > > > Filesystems such as btrfs can perform direct I/O without holding the > > inode->i_rwsem in some of the cases like writing within i_size. > > How is that safe? This (inode_lock release) is only done for writes within i_size. We only have to safeguard write against truncates, which is done by inode_dio_wait() call in the truncate sequence (I had mistakenly removed it in patch 8/8, I shall reinstate that). The commit that introduced this optimization is 38851cc19adb ("Btrfs: implement unlocked dio write") > > > + lockdep_assert_held(&file_inode(file)->i_rwsem); > > Having the asserts in the callers is pointless. The assert is inside > the iomap helper to ensure the expected calling conventions, as the > code is written under the assumption that we have i_rwsem. Hmm, conflicting opinions from you and Dave. Anyways, I have removed it in individual filesystems. -- Goldwyn