Skip to content

Commit

Permalink
xfs: set a default CoW extent size of 32 blocks
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Darrick J. Wong committed Oct 5, 2016
1 parent 3f165b3 commit e153aa7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 6 additions & 4 deletions fs/xfs/xfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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;
}

/*
Expand Down
3 changes: 3 additions & 0 deletions fs/xfs/xfs_inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -490,4 +490,7 @@ do { \

extern struct kmem_zone *xfs_inode_zone;

/* The default CoW extent size hint. */
#define XFS_DEFAULT_COWEXTSZ_HINT 32

#endif /* __XFS_INODE_H__ */

0 comments on commit e153aa7

Please sign in to comment.