diff options
Diffstat (limited to 'fs/xfs/xfs_iomap.c')
| -rw-r--r-- | fs/xfs/xfs_iomap.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 8f8aaee7f379..6a7096422295 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
| @@ -284,6 +284,15 @@ xfs_iomap_eof_want_preallocate( | |||
| 284 | return 0; | 284 | return 0; |
| 285 | 285 | ||
| 286 | /* | 286 | /* |
| 287 | * If the file is smaller than the minimum prealloc and we are using | ||
| 288 | * dynamic preallocation, don't do any preallocation at all as it is | ||
| 289 | * likely this is the only write to the file that is going to be done. | ||
| 290 | */ | ||
| 291 | if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) && | ||
| 292 | XFS_ISIZE(ip) < XFS_FSB_TO_B(mp, mp->m_writeio_blocks)) | ||
| 293 | return 0; | ||
| 294 | |||
| 295 | /* | ||
| 287 | * If there are any real blocks past eof, then don't | 296 | * If there are any real blocks past eof, then don't |
| 288 | * do any speculative allocation. | 297 | * do any speculative allocation. |
| 289 | */ | 298 | */ |
| @@ -345,6 +354,10 @@ xfs_iomap_eof_prealloc_initial_size( | |||
| 345 | if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) | 354 | if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) |
| 346 | return 0; | 355 | return 0; |
| 347 | 356 | ||
| 357 | /* If the file is small, then use the minimum prealloc */ | ||
| 358 | if (XFS_ISIZE(ip) < XFS_FSB_TO_B(mp, mp->m_dalign)) | ||
| 359 | return 0; | ||
| 360 | |||
| 348 | /* | 361 | /* |
| 349 | * As we write multiple pages, the offset will always align to the | 362 | * As we write multiple pages, the offset will always align to the |
| 350 | * start of a page and hence point to a hole at EOF. i.e. if the size is | 363 | * start of a page and hence point to a hole at EOF. i.e. if the size is |
