|
@@ -283,6 +283,15 @@ xfs_iomap_eof_want_preallocate(
|
|
if (offset + count <= XFS_ISIZE(ip))
|
|
if (offset + count <= XFS_ISIZE(ip))
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * If the file is smaller than the minimum prealloc and we are using
|
|
|
|
+ * dynamic preallocation, don't do any preallocation at all as it is
|
|
|
|
+ * likely this is the only write to the file that is going to be done.
|
|
|
|
+ */
|
|
|
|
+ if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) &&
|
|
|
|
+ XFS_ISIZE(ip) < XFS_FSB_TO_B(mp, mp->m_writeio_blocks))
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* If there are any real blocks past eof, then don't
|
|
* If there are any real blocks past eof, then don't
|
|
* do any speculative allocation.
|
|
* do any speculative allocation.
|
|
@@ -345,6 +354,10 @@ xfs_iomap_eof_prealloc_initial_size(
|
|
if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
|
|
if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
|
|
+ /* If the file is small, then use the minimum prealloc */
|
|
|
|
+ if (XFS_ISIZE(ip) < XFS_FSB_TO_B(mp, mp->m_dalign))
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* As we write multiple pages, the offset will always align to the
|
|
* As we write multiple pages, the offset will always align to the
|
|
* start of a page and hence point to a hole at EOF. i.e. if the size is
|
|
* start of a page and hence point to a hole at EOF. i.e. if the size is
|