On Thu, Mar 26, 2020 at 04:02:49PM -0500, Goldwyn Rodrigues wrote: > BTRFS direct I/O is now done under i_rwsem, shared in case of > reads and exclusive in case of writes. This guards against simultaneous > truncates. Btw, you really want to add the optimization of only taking it shared for all the easy write cases similar to what XFS has done for ages and what ext4 picked up now. Without that performance on someworkloads is going to be horrible. That could be a patch on top of this one, though. > +/* > + * btrfs_direct_IO - perform direct I/O > + * inode->i_rwsem must be locked before calling this function, shared or exclusive. > + * @iocb - kernel iocb > + * @iter - iter to/from data is copied This adds a way too long line. Also kerneldoc comments go below the arguments. Last but not least a lockdep_assert_held is much more useful than comments trying to document locking patterns..
