summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2016-10-03 19:11:49 +0300
committerDarrick J. Wong <darrick.wong@oracle.com>2016-10-06 02:26:31 +0300
commite153aa7990a09a8a12860fc1f79304b02a6bc03f (patch)
tree0ca05546c457d768ae50412583cddd70fb0e3c89 /fs/xfs/xfs_inode.c
parent3f165b334e51477d2b33ac1c81b39927514daab7 (diff)
downloadlinux-e153aa7990a09a8a12860fc1f79304b02a6bc03f.tar.xz
xfs: set a default CoW extent size of 32 blocks
If the admin doesn't set a CoW extent size or a regular extent size hint, default to creating CoW reservations 32 blocks long to reduce fragmentation. Signed-off-by: DarricK J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 89e6441f963f..3332fb695cfd 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -80,7 +80,8 @@ xfs_get_extsz_hint(
/*
* Helper function to extract CoW extent size hint from inode.
* Between the extent size hint and the CoW extent size hint, we
- * return the greater of the two.
+ * return the greater of the two. If the value is zero (automatic),
+ * use the default size.
*/
xfs_extlen_t
xfs_get_cowextsz_hint(
@@ -93,9 +94,10 @@ xfs_get_cowextsz_hint(
a = ip->i_d.di_cowextsize;
b = xfs_get_extsz_hint(ip);
- if (a > b)
- return a;
- return b;
+ a = max(a, b);
+ if (a == 0)
+ return XFS_DEFAULT_COWEXTSZ_HINT;
+ return a;
}
/*