When dioread_nolock mode is enabled, we grab i_data_sem in ext4_ext_direct_IO() and therefore we need to instruct _ext4_get_block() not to grab i_data_sem again using EXT4_GET_BLOCKS_NO_LOCK. However holding i_data_sem over overwrite direct IO isn't needed these days. We have exclusion against truncate / hole punching because we increase i_dio_count under i_mutex in ext4_ext_direct_IO() so once ext4_file_write_iter() verifies blocks are allocated & written, they are guaranteed to stay so during the whole direct IO even after we drop i_mutex. So we can just remove this locking abuse and the no longer necessary EXT4_GET_BLOCKS_NO_LOCK flag.
Showing the changes to include/trace (1 of 3 files). Show all
Unified · Split
| @@ -42,8 +42,7 @@ struct extent_status; · 41 unmodified lines | |||
| 42 | { EXT4_GET_BLOCKS_CONVERT, "CONVERT" }, \ | 42 | { EXT4_GET_BLOCKS_CONVERT, "CONVERT" }, \ |
| 43 | { EXT4_GET_BLOCKS_METADATA_NOFAIL, "METADATA_NOFAIL" }, \ | 43 | { EXT4_GET_BLOCKS_METADATA_NOFAIL, "METADATA_NOFAIL" }, \ |
| 44 | { EXT4_GET_BLOCKS_NO_NORMALIZE, "NO_NORMALIZE" }, \ | 44 | { EXT4_GET_BLOCKS_NO_NORMALIZE, "NO_NORMALIZE" }, \ |
| 45 | { EXT4_GET_BLOCKS_KEEP_SIZE, "KEEP_SIZE" }, \ | 45 | { EXT4_GET_BLOCKS_KEEP_SIZE, "KEEP_SIZE" }) |
| 46 | { EXT4_GET_BLOCKS_NO_LOCK, "NO_LOCK" }) | ||
| 47 | 46 | ||
| 48 | #define show_mflags(flags) __print_flags(flags, "", \ | 47 | #define show_mflags(flags) __print_flags(flags, "", \ |
| 49 | { EXT4_MAP_NEW, "N" }, \ | 48 | { EXT4_MAP_NEW, "N" }, \ |