diff options
Diffstat (limited to 'fs/ext4/ext4_jbd2.h')
| -rw-r--r-- | fs/ext4/ext4_jbd2.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h index 05eca817d704..b79ad5126468 100644 --- a/fs/ext4/ext4_jbd2.h +++ b/fs/ext4/ext4_jbd2.h | |||
| @@ -304,4 +304,28 @@ static inline int ext4_should_writeback_data(struct inode *inode) | |||
| 304 | return 0; | 304 | return 0; |
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | /* | ||
| 308 | * This function controls whether or not we should try to go down the | ||
| 309 | * dioread_nolock code paths, which makes it safe to avoid taking | ||
| 310 | * i_mutex for direct I/O reads. This only works for extent-based | ||
| 311 | * files, and it doesn't work for nobh or if data journaling is | ||
| 312 | * enabled, since the dioread_nolock code uses b_private to pass | ||
| 313 | * information back to the I/O completion handler, and this conflicts | ||
| 314 | * with the jbd's use of b_private. | ||
| 315 | */ | ||
| 316 | static inline int ext4_should_dioread_nolock(struct inode *inode) | ||
| 317 | { | ||
| 318 | if (!test_opt(inode->i_sb, DIOREAD_NOLOCK)) | ||
| 319 | return 0; | ||
| 320 | if (test_opt(inode->i_sb, NOBH)) | ||
| 321 | return 0; | ||
| 322 | if (!S_ISREG(inode->i_mode)) | ||
| 323 | return 0; | ||
| 324 | if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)) | ||
| 325 | return 0; | ||
| 326 | if (ext4_should_journal_data(inode)) | ||
| 327 | return 0; | ||
| 328 | return 1; | ||
| 329 | } | ||
| 330 | |||
| 307 | #endif /* _EXT4_JBD2_H */ | 331 | #endif /* _EXT4_JBD2_H */ |
