Commit 562c72aa57c36b178eacc3500a0215651eca9429
Committed by
Al Viro
1 parent
11b80f459a
Exists in
master
and in
4 other branches
fs: move inode_dio_wait calls into ->setattr
Let filesystems handle waiting for direct I/O requests themselves instead of doing it beforehand. This means filesystem-specific locks to prevent new dio referenes from appearing can be held. This is important to allow generalizing i_dio_count to non-DIO_LOCKING filesystems. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 12 changed files with 24 additions and 3 deletions Side-by-side Diff
fs/attr.c
fs/ext2/inode.c
... | ... | @@ -1184,6 +1184,8 @@ |
1184 | 1184 | if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) |
1185 | 1185 | return -EPERM; |
1186 | 1186 | |
1187 | + inode_dio_wait(inode); | |
1188 | + | |
1187 | 1189 | if (mapping_is_xip(inode->i_mapping)) |
1188 | 1190 | error = xip_truncate_page(inode->i_mapping, newsize); |
1189 | 1191 | else if (test_opt(inode->i_sb, NOBH)) |
fs/ext3/inode.c
... | ... | @@ -3216,6 +3216,9 @@ |
3216 | 3216 | ext3_journal_stop(handle); |
3217 | 3217 | } |
3218 | 3218 | |
3219 | + if (attr->ia_valid & ATTR_SIZE) | |
3220 | + inode_dio_wait(inode); | |
3221 | + | |
3219 | 3222 | if (S_ISREG(inode->i_mode) && |
3220 | 3223 | attr->ia_valid & ATTR_SIZE && attr->ia_size < inode->i_size) { |
3221 | 3224 | handle_t *handle; |
fs/ext4/inode.c
fs/fat/file.c
fs/gfs2/bmap.c
fs/hfs/inode.c
fs/hfsplus/inode.c
fs/jfs/file.c
fs/nilfs2/inode.c
fs/ocfs2/file.c
fs/reiserfs/inode.c
... | ... | @@ -3114,6 +3114,9 @@ |
3114 | 3114 | error = -EFBIG; |
3115 | 3115 | goto out; |
3116 | 3116 | } |
3117 | + | |
3118 | + inode_dio_wait(inode); | |
3119 | + | |
3117 | 3120 | /* fill in hole pointers in the expanding truncate case. */ |
3118 | 3121 | if (attr->ia_size > inode->i_size) { |
3119 | 3122 | error = generic_cont_expand_simple(inode, attr->ia_size); |