aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-03-08 22:44:50 -0500
committerTheodore Ts'o <tytso@mit.edu>2016-03-08 22:44:50 -0500
commite142d05263a4beedefd331d445c394f4397e9f03 (patch)
treec86f41730d37a0f1424ee5c0cdb9c9017121d6d0 /fs/ext4/super.c
parent3bd6ad7b688e200ac7633b16affa164d7cd5ef07 (diff)
ext4: use i_mutex to serialize unaligned AIO DIO
Currently we've used hashed aio_mutex to serialize unaligned AIO DIO. However the code cleanups that happened after 2011 when the lock was introduced made aio_mutex acquired at almost the same places where we already have exclusion using i_mutex. So just use i_mutex for the exclusion of unaligned AIO DIO. The change moves waiting for pending unwritten extent conversion under i_mutex. That makes special handling of O_APPEND writes unnecessary and also avoids possible livelocking of unaligned AIO DIO with aligned one (nothing was preventing contiguous stream of aligned AIO DIOs to let unaligned AIO DIO wait forever). Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 2f550519e0aa..4d5756024e98 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5321,7 +5321,6 @@ MODULE_ALIAS_FS("ext4");
5321 5321
5322/* Shared across all ext4 file systems */ 5322/* Shared across all ext4 file systems */
5323wait_queue_head_t ext4__ioend_wq[EXT4_WQ_HASH_SZ]; 5323wait_queue_head_t ext4__ioend_wq[EXT4_WQ_HASH_SZ];
5324struct mutex ext4__aio_mutex[EXT4_WQ_HASH_SZ];
5325 5324
5326static int __init ext4_init_fs(void) 5325static int __init ext4_init_fs(void)
5327{ 5326{
@@ -5334,10 +5333,8 @@ static int __init ext4_init_fs(void)
5334 /* Build-time check for flags consistency */ 5333 /* Build-time check for flags consistency */
5335 ext4_check_flag_values(); 5334 ext4_check_flag_values();
5336 5335
5337 for (i = 0; i < EXT4_WQ_HASH_SZ; i++) { 5336 for (i = 0; i < EXT4_WQ_HASH_SZ; i++)
5338 mutex_init(&ext4__aio_mutex[i]);
5339 init_waitqueue_head(&ext4__ioend_wq[i]); 5337 init_waitqueue_head(&ext4__ioend_wq[i]);
5340 }
5341 5338
5342 err = ext4_init_es(); 5339 err = ext4_init_es();
5343 if (err) 5340 if (err)