Commit 68d0f389 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: remove XFS_FIND_RCEXT_SHARED and _COW

Now that we have an explicit enum for shared and CoW staging extents, we
can get rid of the old FIND_RCEXT flags.  Omit a couple of conversions
that disappear in the next patches.
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent f492135d
...@@ -617,8 +617,6 @@ xfs_refcount_merge_right_extent( ...@@ -617,8 +617,6 @@ xfs_refcount_merge_right_extent(
return error; return error;
} }
#define XFS_FIND_RCEXT_SHARED 1
#define XFS_FIND_RCEXT_COW 2
/* /*
* Find the left extent and the one after it (cleft). This function assumes * Find the left extent and the one after it (cleft). This function assumes
* that we've already split any extent crossing agbno. * that we've already split any extent crossing agbno.
...@@ -628,20 +626,14 @@ xfs_refcount_find_left_extents( ...@@ -628,20 +626,14 @@ xfs_refcount_find_left_extents(
struct xfs_btree_cur *cur, struct xfs_btree_cur *cur,
struct xfs_refcount_irec *left, struct xfs_refcount_irec *left,
struct xfs_refcount_irec *cleft, struct xfs_refcount_irec *cleft,
enum xfs_refc_domain domain,
xfs_agblock_t agbno, xfs_agblock_t agbno,
xfs_extlen_t aglen, xfs_extlen_t aglen)
int flags)
{ {
struct xfs_refcount_irec tmp; struct xfs_refcount_irec tmp;
enum xfs_refc_domain domain;
int error; int error;
int found_rec; int found_rec;
if (flags & XFS_FIND_RCEXT_SHARED)
domain = XFS_REFC_DOMAIN_SHARED;
else
domain = XFS_REFC_DOMAIN_COW;
left->rc_startblock = cleft->rc_startblock = NULLAGBLOCK; left->rc_startblock = cleft->rc_startblock = NULLAGBLOCK;
error = xfs_refcount_lookup_le(cur, domain, agbno - 1, &found_rec); error = xfs_refcount_lookup_le(cur, domain, agbno - 1, &found_rec);
if (error) if (error)
...@@ -659,9 +651,9 @@ xfs_refcount_find_left_extents( ...@@ -659,9 +651,9 @@ xfs_refcount_find_left_extents(
if (xfs_refc_next(&tmp) != agbno) if (xfs_refc_next(&tmp) != agbno)
return 0; return 0;
if ((flags & XFS_FIND_RCEXT_SHARED) && tmp.rc_refcount < 2) if (domain == XFS_REFC_DOMAIN_SHARED && tmp.rc_refcount < 2)
return 0; return 0;
if ((flags & XFS_FIND_RCEXT_COW) && tmp.rc_refcount > 1) if (domain == XFS_REFC_DOMAIN_COW && tmp.rc_refcount > 1)
return 0; return 0;
/* We have a left extent; retrieve (or invent) the next right one */ /* We have a left extent; retrieve (or invent) the next right one */
*left = tmp; *left = tmp;
...@@ -725,20 +717,14 @@ xfs_refcount_find_right_extents( ...@@ -725,20 +717,14 @@ xfs_refcount_find_right_extents(
struct xfs_btree_cur *cur, struct xfs_btree_cur *cur,
struct xfs_refcount_irec *right, struct xfs_refcount_irec *right,
struct xfs_refcount_irec *cright, struct xfs_refcount_irec *cright,
enum xfs_refc_domain domain,
xfs_agblock_t agbno, xfs_agblock_t agbno,
xfs_extlen_t aglen, xfs_extlen_t aglen)
int flags)
{ {
struct xfs_refcount_irec tmp; struct xfs_refcount_irec tmp;
enum xfs_refc_domain domain;
int error; int error;
int found_rec; int found_rec;
if (flags & XFS_FIND_RCEXT_SHARED)
domain = XFS_REFC_DOMAIN_SHARED;
else
domain = XFS_REFC_DOMAIN_COW;
right->rc_startblock = cright->rc_startblock = NULLAGBLOCK; right->rc_startblock = cright->rc_startblock = NULLAGBLOCK;
error = xfs_refcount_lookup_ge(cur, domain, agbno + aglen, &found_rec); error = xfs_refcount_lookup_ge(cur, domain, agbno + aglen, &found_rec);
if (error) if (error)
...@@ -756,9 +742,9 @@ xfs_refcount_find_right_extents( ...@@ -756,9 +742,9 @@ xfs_refcount_find_right_extents(
if (tmp.rc_startblock != agbno + aglen) if (tmp.rc_startblock != agbno + aglen)
return 0; return 0;
if ((flags & XFS_FIND_RCEXT_SHARED) && tmp.rc_refcount < 2) if (domain == XFS_REFC_DOMAIN_SHARED && tmp.rc_refcount < 2)
return 0; return 0;
if ((flags & XFS_FIND_RCEXT_COW) && tmp.rc_refcount > 1) if (domain == XFS_REFC_DOMAIN_COW && tmp.rc_refcount > 1)
return 0; return 0;
/* We have a right extent; retrieve (or invent) the next left one */ /* We have a right extent; retrieve (or invent) the next left one */
*right = tmp; *right = tmp;
...@@ -827,10 +813,10 @@ xfs_refc_valid( ...@@ -827,10 +813,10 @@ xfs_refc_valid(
STATIC int STATIC int
xfs_refcount_merge_extents( xfs_refcount_merge_extents(
struct xfs_btree_cur *cur, struct xfs_btree_cur *cur,
enum xfs_refc_domain domain,
xfs_agblock_t *agbno, xfs_agblock_t *agbno,
xfs_extlen_t *aglen, xfs_extlen_t *aglen,
enum xfs_refc_adjust_op adjust, enum xfs_refc_adjust_op adjust,
int flags,
bool *shape_changed) bool *shape_changed)
{ {
struct xfs_refcount_irec left = {0}, cleft = {0}; struct xfs_refcount_irec left = {0}, cleft = {0};
...@@ -845,12 +831,12 @@ xfs_refcount_merge_extents( ...@@ -845,12 +831,12 @@ xfs_refcount_merge_extents(
* just below (agbno + aglen) [cright], and just above (agbno + aglen) * just below (agbno + aglen) [cright], and just above (agbno + aglen)
* [right]. * [right].
*/ */
error = xfs_refcount_find_left_extents(cur, &left, &cleft, *agbno, error = xfs_refcount_find_left_extents(cur, &left, &cleft, domain,
*aglen, flags); *agbno, *aglen);
if (error) if (error)
return error; return error;
error = xfs_refcount_find_right_extents(cur, &right, &cright, *agbno, error = xfs_refcount_find_right_extents(cur, &right, &cright, domain,
*aglen, flags); *agbno, *aglen);
if (error) if (error)
return error; return error;
...@@ -1139,8 +1125,8 @@ xfs_refcount_adjust( ...@@ -1139,8 +1125,8 @@ xfs_refcount_adjust(
/* /*
* Try to merge with the left or right extents of the range. * Try to merge with the left or right extents of the range.
*/ */
error = xfs_refcount_merge_extents(cur, new_agbno, new_aglen, adj, error = xfs_refcount_merge_extents(cur, XFS_REFC_DOMAIN_SHARED,
XFS_FIND_RCEXT_SHARED, &shape_changed); new_agbno, new_aglen, adj, &shape_changed);
if (error) if (error)
goto out_error; goto out_error;
if (shape_changed) if (shape_changed)
...@@ -1650,8 +1636,8 @@ xfs_refcount_adjust_cow( ...@@ -1650,8 +1636,8 @@ xfs_refcount_adjust_cow(
/* /*
* Try to merge with the left or right extents of the range. * Try to merge with the left or right extents of the range.
*/ */
error = xfs_refcount_merge_extents(cur, &agbno, &aglen, adj, error = xfs_refcount_merge_extents(cur, XFS_REFC_DOMAIN_COW, &agbno,
XFS_FIND_RCEXT_COW, &shape_changed); &aglen, adj, &shape_changed);
if (error) if (error)
goto out_error; goto out_error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment