aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2016-10-03 12:11:49 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2016-10-05 19:26:31 -0400
commite153aa7990a09a8a12860fc1f79304b02a6bc03f (patch)
tree0ca05546c457d768ae50412583cddd70fb0e3c89
parent3f165b334e51477d2b33ac1c81b39927514daab7 (diff)
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>
-rw-r--r--fs/xfs/xfs_inode.c10
-rw-r--r--fs/xfs/xfs_inode.h3
2 files changed, 9 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(
80/* 80/*
81 * Helper function to extract CoW extent size hint from inode. 81 * Helper function to extract CoW extent size hint from inode.
82 * Between the extent size hint and the CoW extent size hint, we 82 * Between the extent size hint and the CoW extent size hint, we
83 * return the greater of the two. 83 * return the greater of the two. If the value is zero (automatic),
84 * use the default size.
84 */ 85 */
85xfs_extlen_t 86xfs_extlen_t
86xfs_get_cowextsz_hint( 87xfs_get_cowextsz_hint(
@@ -93,9 +94,10 @@ xfs_get_cowextsz_hint(
93 a = ip->i_d.di_cowextsize; 94 a = ip->i_d.di_cowextsize;
94 b = xfs_get_extsz_hint(ip); 95 b = xfs_get_extsz_hint(ip);
95 96
96 if (a > b) 97 a = max(a, b);
97 return a; 98 if (a == 0)
98 return b; 99 return XFS_DEFAULT_COWEXTSZ_HINT;
100 return a;
99} 101}
100 102
101/* 103/*
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 6d63dc031127..f14c1de2549d 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -490,4 +490,7 @@ do { \
490 490
491extern struct kmem_zone *xfs_inode_zone; 491extern struct kmem_zone *xfs_inode_zone;
492 492
493/* The default CoW extent size hint. */
494#define XFS_DEFAULT_COWEXTSZ_HINT 32
495
493#endif /* __XFS_INODE_H__ */ 496#endif /* __XFS_INODE_H__ */