On Thu, Jan 16, 2020 at 03:00:04PM +0100, Jan Kara wrote: > I'd like to note that using i_dio_count has also one advantage you didn't > mention. For AIO case, if you need to hold i_rwsem in exclusive mode, > holding the i_rwsem just for submission part is a significant performance > advantage (shorter lock hold times allow for higher IO parallelism). I > guess this could be mitigated by downgrading the lock to shared mode > once the IO is submitted. But there will be still some degradation visible > for the cases of mixed exclusive and shared acquisitions because shared > holders will be blocking exclusive ones for longer time. > > This may be especially painful for filesystems that don't implement DIO > overwrites with i_rwsem in shared mode... True. Fortunately there are patches for ext4 out to move over to that scheme. gfs2 will need a little more attention, but that also for other reasons.