xfs: const-ify xfs_owner_info arguments
Only certain functions actually change the contents of an xfs_owner_info; the rest can accept a const struct pointer. This will enable us to save stack space by hoisting static owner info types to be const global variables. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com>
This commit is contained in:
Родитель
02b100fb83
Коммит
66e3237e72
|
@ -1694,28 +1694,28 @@ error0:
|
||||||
*/
|
*/
|
||||||
STATIC int
|
STATIC int
|
||||||
xfs_free_ag_extent(
|
xfs_free_ag_extent(
|
||||||
xfs_trans_t *tp,
|
struct xfs_trans *tp,
|
||||||
xfs_buf_t *agbp,
|
struct xfs_buf *agbp,
|
||||||
xfs_agnumber_t agno,
|
xfs_agnumber_t agno,
|
||||||
xfs_agblock_t bno,
|
xfs_agblock_t bno,
|
||||||
xfs_extlen_t len,
|
xfs_extlen_t len,
|
||||||
struct xfs_owner_info *oinfo,
|
const struct xfs_owner_info *oinfo,
|
||||||
enum xfs_ag_resv_type type)
|
enum xfs_ag_resv_type type)
|
||||||
{
|
{
|
||||||
xfs_btree_cur_t *bno_cur; /* cursor for by-block btree */
|
struct xfs_mount *mp;
|
||||||
xfs_btree_cur_t *cnt_cur; /* cursor for by-size btree */
|
struct xfs_perag *pag;
|
||||||
int error; /* error return value */
|
struct xfs_btree_cur *bno_cur;
|
||||||
xfs_agblock_t gtbno; /* start of right neighbor block */
|
struct xfs_btree_cur *cnt_cur;
|
||||||
xfs_extlen_t gtlen; /* length of right neighbor block */
|
xfs_agblock_t gtbno; /* start of right neighbor */
|
||||||
int haveleft; /* have a left neighbor block */
|
xfs_extlen_t gtlen; /* length of right neighbor */
|
||||||
int haveright; /* have a right neighbor block */
|
xfs_agblock_t ltbno; /* start of left neighbor */
|
||||||
int i; /* temp, result code */
|
xfs_extlen_t ltlen; /* length of left neighbor */
|
||||||
xfs_agblock_t ltbno; /* start of left neighbor block */
|
xfs_agblock_t nbno; /* new starting block of freesp */
|
||||||
xfs_extlen_t ltlen; /* length of left neighbor block */
|
|
||||||
xfs_mount_t *mp; /* mount point struct for filesystem */
|
|
||||||
xfs_agblock_t nbno; /* new starting block of freespace */
|
|
||||||
xfs_extlen_t nlen; /* new length of freespace */
|
xfs_extlen_t nlen; /* new length of freespace */
|
||||||
xfs_perag_t *pag; /* per allocation group data */
|
int haveleft; /* have a left neighbor */
|
||||||
|
int haveright; /* have a right neighbor */
|
||||||
|
int i;
|
||||||
|
int error;
|
||||||
|
|
||||||
bno_cur = cnt_cur = NULL;
|
bno_cur = cnt_cur = NULL;
|
||||||
mp = tp->t_mountp;
|
mp = tp->t_mountp;
|
||||||
|
@ -3008,13 +3008,13 @@ out:
|
||||||
* Just break up the extent address and hand off to xfs_free_ag_extent
|
* Just break up the extent address and hand off to xfs_free_ag_extent
|
||||||
* after fixing up the freelist.
|
* after fixing up the freelist.
|
||||||
*/
|
*/
|
||||||
int /* error */
|
int
|
||||||
__xfs_free_extent(
|
__xfs_free_extent(
|
||||||
struct xfs_trans *tp, /* transaction pointer */
|
struct xfs_trans *tp,
|
||||||
xfs_fsblock_t bno, /* starting block number of extent */
|
xfs_fsblock_t bno,
|
||||||
xfs_extlen_t len, /* length of extent */
|
xfs_extlen_t len,
|
||||||
struct xfs_owner_info *oinfo, /* extent owner */
|
const struct xfs_owner_info *oinfo,
|
||||||
enum xfs_ag_resv_type type, /* block reservation type */
|
enum xfs_ag_resv_type type,
|
||||||
bool skip_discard)
|
bool skip_discard)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = tp->t_mountp;
|
struct xfs_mount *mp = tp->t_mountp;
|
||||||
|
|
|
@ -182,7 +182,7 @@ __xfs_free_extent(
|
||||||
struct xfs_trans *tp, /* transaction pointer */
|
struct xfs_trans *tp, /* transaction pointer */
|
||||||
xfs_fsblock_t bno, /* starting block number of extent */
|
xfs_fsblock_t bno, /* starting block number of extent */
|
||||||
xfs_extlen_t len, /* length of extent */
|
xfs_extlen_t len, /* length of extent */
|
||||||
struct xfs_owner_info *oinfo, /* extent owner */
|
const struct xfs_owner_info *oinfo, /* extent owner */
|
||||||
enum xfs_ag_resv_type type, /* block reservation type */
|
enum xfs_ag_resv_type type, /* block reservation type */
|
||||||
bool skip_discard);
|
bool skip_discard);
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ xfs_free_extent(
|
||||||
struct xfs_trans *tp,
|
struct xfs_trans *tp,
|
||||||
xfs_fsblock_t bno,
|
xfs_fsblock_t bno,
|
||||||
xfs_extlen_t len,
|
xfs_extlen_t len,
|
||||||
struct xfs_owner_info *oinfo,
|
const struct xfs_owner_info *oinfo,
|
||||||
enum xfs_ag_resv_type type)
|
enum xfs_ag_resv_type type)
|
||||||
{
|
{
|
||||||
return __xfs_free_extent(tp, bno, len, oinfo, type, false);
|
return __xfs_free_extent(tp, bno, len, oinfo, type, false);
|
||||||
|
|
|
@ -536,7 +536,7 @@ __xfs_bmap_add_free(
|
||||||
struct xfs_trans *tp,
|
struct xfs_trans *tp,
|
||||||
xfs_fsblock_t bno,
|
xfs_fsblock_t bno,
|
||||||
xfs_filblks_t len,
|
xfs_filblks_t len,
|
||||||
struct xfs_owner_info *oinfo,
|
const struct xfs_owner_info *oinfo,
|
||||||
bool skip_discard)
|
bool skip_discard)
|
||||||
{
|
{
|
||||||
struct xfs_extent_free_item *new; /* new element */
|
struct xfs_extent_free_item *new; /* new element */
|
||||||
|
|
|
@ -186,7 +186,7 @@ int xfs_bmap_add_attrfork(struct xfs_inode *ip, int size, int rsvd);
|
||||||
int xfs_bmap_set_attrforkoff(struct xfs_inode *ip, int size, int *version);
|
int xfs_bmap_set_attrforkoff(struct xfs_inode *ip, int size, int *version);
|
||||||
void xfs_bmap_local_to_extents_empty(struct xfs_inode *ip, int whichfork);
|
void xfs_bmap_local_to_extents_empty(struct xfs_inode *ip, int whichfork);
|
||||||
void __xfs_bmap_add_free(struct xfs_trans *tp, xfs_fsblock_t bno,
|
void __xfs_bmap_add_free(struct xfs_trans *tp, xfs_fsblock_t bno,
|
||||||
xfs_filblks_t len, struct xfs_owner_info *oinfo,
|
xfs_filblks_t len, const struct xfs_owner_info *oinfo,
|
||||||
bool skip_discard);
|
bool skip_discard);
|
||||||
void xfs_bmap_compute_maxlevels(struct xfs_mount *mp, int whichfork);
|
void xfs_bmap_compute_maxlevels(struct xfs_mount *mp, int whichfork);
|
||||||
int xfs_bmap_first_unused(struct xfs_trans *tp, struct xfs_inode *ip,
|
int xfs_bmap_first_unused(struct xfs_trans *tp, struct xfs_inode *ip,
|
||||||
|
@ -234,7 +234,7 @@ xfs_bmap_add_free(
|
||||||
struct xfs_trans *tp,
|
struct xfs_trans *tp,
|
||||||
xfs_fsblock_t bno,
|
xfs_fsblock_t bno,
|
||||||
xfs_filblks_t len,
|
xfs_filblks_t len,
|
||||||
struct xfs_owner_info *oinfo)
|
const struct xfs_owner_info *oinfo)
|
||||||
{
|
{
|
||||||
__xfs_bmap_add_free(tp, bno, len, oinfo, false);
|
__xfs_bmap_add_free(tp, bno, len, oinfo, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -462,7 +462,7 @@ xfs_rmap_unmap(
|
||||||
xfs_agblock_t bno,
|
xfs_agblock_t bno,
|
||||||
xfs_extlen_t len,
|
xfs_extlen_t len,
|
||||||
bool unwritten,
|
bool unwritten,
|
||||||
struct xfs_owner_info *oinfo)
|
const struct xfs_owner_info *oinfo)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = cur->bc_mp;
|
struct xfs_mount *mp = cur->bc_mp;
|
||||||
struct xfs_rmap_irec ltrec;
|
struct xfs_rmap_irec ltrec;
|
||||||
|
@ -658,7 +658,7 @@ xfs_rmap_free(
|
||||||
xfs_agnumber_t agno,
|
xfs_agnumber_t agno,
|
||||||
xfs_agblock_t bno,
|
xfs_agblock_t bno,
|
||||||
xfs_extlen_t len,
|
xfs_extlen_t len,
|
||||||
struct xfs_owner_info *oinfo)
|
const struct xfs_owner_info *oinfo)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = tp->t_mountp;
|
struct xfs_mount *mp = tp->t_mountp;
|
||||||
struct xfs_btree_cur *cur;
|
struct xfs_btree_cur *cur;
|
||||||
|
@ -714,7 +714,7 @@ xfs_rmap_map(
|
||||||
xfs_agblock_t bno,
|
xfs_agblock_t bno,
|
||||||
xfs_extlen_t len,
|
xfs_extlen_t len,
|
||||||
bool unwritten,
|
bool unwritten,
|
||||||
struct xfs_owner_info *oinfo)
|
const struct xfs_owner_info *oinfo)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = cur->bc_mp;
|
struct xfs_mount *mp = cur->bc_mp;
|
||||||
struct xfs_rmap_irec ltrec;
|
struct xfs_rmap_irec ltrec;
|
||||||
|
@ -895,7 +895,7 @@ xfs_rmap_alloc(
|
||||||
xfs_agnumber_t agno,
|
xfs_agnumber_t agno,
|
||||||
xfs_agblock_t bno,
|
xfs_agblock_t bno,
|
||||||
xfs_extlen_t len,
|
xfs_extlen_t len,
|
||||||
struct xfs_owner_info *oinfo)
|
const struct xfs_owner_info *oinfo)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = tp->t_mountp;
|
struct xfs_mount *mp = tp->t_mountp;
|
||||||
struct xfs_btree_cur *cur;
|
struct xfs_btree_cur *cur;
|
||||||
|
@ -933,12 +933,12 @@ xfs_rmap_convert(
|
||||||
xfs_agblock_t bno,
|
xfs_agblock_t bno,
|
||||||
xfs_extlen_t len,
|
xfs_extlen_t len,
|
||||||
bool unwritten,
|
bool unwritten,
|
||||||
struct xfs_owner_info *oinfo)
|
const struct xfs_owner_info *oinfo)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = cur->bc_mp;
|
struct xfs_mount *mp = cur->bc_mp;
|
||||||
struct xfs_rmap_irec r[4]; /* neighbor extent entries */
|
struct xfs_rmap_irec r[4]; /* neighbor extent entries */
|
||||||
/* left is 0, right is 1, prev is 2 */
|
/* left is 0, right is 1, */
|
||||||
/* new is 3 */
|
/* prev is 2, new is 3 */
|
||||||
uint64_t owner;
|
uint64_t owner;
|
||||||
uint64_t offset;
|
uint64_t offset;
|
||||||
uint64_t new_endoff;
|
uint64_t new_endoff;
|
||||||
|
@ -1358,12 +1358,12 @@ xfs_rmap_convert_shared(
|
||||||
xfs_agblock_t bno,
|
xfs_agblock_t bno,
|
||||||
xfs_extlen_t len,
|
xfs_extlen_t len,
|
||||||
bool unwritten,
|
bool unwritten,
|
||||||
struct xfs_owner_info *oinfo)
|
const struct xfs_owner_info *oinfo)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = cur->bc_mp;
|
struct xfs_mount *mp = cur->bc_mp;
|
||||||
struct xfs_rmap_irec r[4]; /* neighbor extent entries */
|
struct xfs_rmap_irec r[4]; /* neighbor extent entries */
|
||||||
/* left is 0, right is 1, prev is 2 */
|
/* left is 0, right is 1, */
|
||||||
/* new is 3 */
|
/* prev is 2, new is 3 */
|
||||||
uint64_t owner;
|
uint64_t owner;
|
||||||
uint64_t offset;
|
uint64_t offset;
|
||||||
uint64_t new_endoff;
|
uint64_t new_endoff;
|
||||||
|
@ -1747,7 +1747,7 @@ xfs_rmap_unmap_shared(
|
||||||
xfs_agblock_t bno,
|
xfs_agblock_t bno,
|
||||||
xfs_extlen_t len,
|
xfs_extlen_t len,
|
||||||
bool unwritten,
|
bool unwritten,
|
||||||
struct xfs_owner_info *oinfo)
|
const struct xfs_owner_info *oinfo)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = cur->bc_mp;
|
struct xfs_mount *mp = cur->bc_mp;
|
||||||
struct xfs_rmap_irec ltrec;
|
struct xfs_rmap_irec ltrec;
|
||||||
|
@ -1909,7 +1909,7 @@ xfs_rmap_map_shared(
|
||||||
xfs_agblock_t bno,
|
xfs_agblock_t bno,
|
||||||
xfs_extlen_t len,
|
xfs_extlen_t len,
|
||||||
bool unwritten,
|
bool unwritten,
|
||||||
struct xfs_owner_info *oinfo)
|
const struct xfs_owner_info *oinfo)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = cur->bc_mp;
|
struct xfs_mount *mp = cur->bc_mp;
|
||||||
struct xfs_rmap_irec ltrec;
|
struct xfs_rmap_irec ltrec;
|
||||||
|
@ -2462,7 +2462,7 @@ xfs_rmap_record_exists(
|
||||||
struct xfs_btree_cur *cur,
|
struct xfs_btree_cur *cur,
|
||||||
xfs_agblock_t bno,
|
xfs_agblock_t bno,
|
||||||
xfs_extlen_t len,
|
xfs_extlen_t len,
|
||||||
struct xfs_owner_info *oinfo,
|
const struct xfs_owner_info *oinfo,
|
||||||
bool *has_rmap)
|
bool *has_rmap)
|
||||||
{
|
{
|
||||||
uint64_t owner;
|
uint64_t owner;
|
||||||
|
@ -2530,7 +2530,7 @@ xfs_rmap_has_other_keys(
|
||||||
struct xfs_btree_cur *cur,
|
struct xfs_btree_cur *cur,
|
||||||
xfs_agblock_t bno,
|
xfs_agblock_t bno,
|
||||||
xfs_extlen_t len,
|
xfs_extlen_t len,
|
||||||
struct xfs_owner_info *oinfo,
|
const struct xfs_owner_info *oinfo,
|
||||||
bool *has_rmap)
|
bool *has_rmap)
|
||||||
{
|
{
|
||||||
struct xfs_rmap_irec low = {0};
|
struct xfs_rmap_irec low = {0};
|
||||||
|
|
|
@ -52,7 +52,7 @@ xfs_rmap_skip_owner_update(
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
xfs_rmap_should_skip_owner_update(
|
xfs_rmap_should_skip_owner_update(
|
||||||
struct xfs_owner_info *oi)
|
const struct xfs_owner_info *oi)
|
||||||
{
|
{
|
||||||
return oi->oi_owner == XFS_RMAP_OWN_NULL;
|
return oi->oi_owner == XFS_RMAP_OWN_NULL;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ xfs_rmap_irec_offset_unpack(
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
xfs_owner_info_unpack(
|
xfs_owner_info_unpack(
|
||||||
struct xfs_owner_info *oinfo,
|
const struct xfs_owner_info *oinfo,
|
||||||
uint64_t *owner,
|
uint64_t *owner,
|
||||||
uint64_t *offset,
|
uint64_t *offset,
|
||||||
unsigned int *flags)
|
unsigned int *flags)
|
||||||
|
@ -137,10 +137,10 @@ xfs_owner_info_pack(
|
||||||
|
|
||||||
int xfs_rmap_alloc(struct xfs_trans *tp, struct xfs_buf *agbp,
|
int xfs_rmap_alloc(struct xfs_trans *tp, struct xfs_buf *agbp,
|
||||||
xfs_agnumber_t agno, xfs_agblock_t bno, xfs_extlen_t len,
|
xfs_agnumber_t agno, xfs_agblock_t bno, xfs_extlen_t len,
|
||||||
struct xfs_owner_info *oinfo);
|
const struct xfs_owner_info *oinfo);
|
||||||
int xfs_rmap_free(struct xfs_trans *tp, struct xfs_buf *agbp,
|
int xfs_rmap_free(struct xfs_trans *tp, struct xfs_buf *agbp,
|
||||||
xfs_agnumber_t agno, xfs_agblock_t bno, xfs_extlen_t len,
|
xfs_agnumber_t agno, xfs_agblock_t bno, xfs_extlen_t len,
|
||||||
struct xfs_owner_info *oinfo);
|
const struct xfs_owner_info *oinfo);
|
||||||
|
|
||||||
int xfs_rmap_lookup_le(struct xfs_btree_cur *cur, xfs_agblock_t bno,
|
int xfs_rmap_lookup_le(struct xfs_btree_cur *cur, xfs_agblock_t bno,
|
||||||
xfs_extlen_t len, uint64_t owner, uint64_t offset,
|
xfs_extlen_t len, uint64_t owner, uint64_t offset,
|
||||||
|
@ -218,10 +218,10 @@ int xfs_rmap_btrec_to_irec(union xfs_btree_rec *rec,
|
||||||
int xfs_rmap_has_record(struct xfs_btree_cur *cur, xfs_agblock_t bno,
|
int xfs_rmap_has_record(struct xfs_btree_cur *cur, xfs_agblock_t bno,
|
||||||
xfs_extlen_t len, bool *exists);
|
xfs_extlen_t len, bool *exists);
|
||||||
int xfs_rmap_record_exists(struct xfs_btree_cur *cur, xfs_agblock_t bno,
|
int xfs_rmap_record_exists(struct xfs_btree_cur *cur, xfs_agblock_t bno,
|
||||||
xfs_extlen_t len, struct xfs_owner_info *oinfo,
|
xfs_extlen_t len, const struct xfs_owner_info *oinfo,
|
||||||
bool *has_rmap);
|
bool *has_rmap);
|
||||||
int xfs_rmap_has_other_keys(struct xfs_btree_cur *cur, xfs_agblock_t bno,
|
int xfs_rmap_has_other_keys(struct xfs_btree_cur *cur, xfs_agblock_t bno,
|
||||||
xfs_extlen_t len, struct xfs_owner_info *oinfo,
|
xfs_extlen_t len, const struct xfs_owner_info *oinfo,
|
||||||
bool *has_rmap);
|
bool *has_rmap);
|
||||||
int xfs_rmap_map_raw(struct xfs_btree_cur *cur, struct xfs_rmap_irec *rmap);
|
int xfs_rmap_map_raw(struct xfs_btree_cur *cur, struct xfs_rmap_irec *rmap);
|
||||||
|
|
||||||
|
|
|
@ -586,10 +586,17 @@ xchk_btree(
|
||||||
struct xfs_scrub *sc,
|
struct xfs_scrub *sc,
|
||||||
struct xfs_btree_cur *cur,
|
struct xfs_btree_cur *cur,
|
||||||
xchk_btree_rec_fn scrub_fn,
|
xchk_btree_rec_fn scrub_fn,
|
||||||
struct xfs_owner_info *oinfo,
|
const struct xfs_owner_info *oinfo,
|
||||||
void *private)
|
void *private)
|
||||||
{
|
{
|
||||||
struct xchk_btree bs = { NULL };
|
struct xchk_btree bs = {
|
||||||
|
.cur = cur,
|
||||||
|
.scrub_rec = scrub_fn,
|
||||||
|
.oinfo = oinfo,
|
||||||
|
.firstrec = true,
|
||||||
|
.private = private,
|
||||||
|
.sc = sc,
|
||||||
|
};
|
||||||
union xfs_btree_ptr ptr;
|
union xfs_btree_ptr ptr;
|
||||||
union xfs_btree_ptr *pp;
|
union xfs_btree_ptr *pp;
|
||||||
union xfs_btree_rec *recp;
|
union xfs_btree_rec *recp;
|
||||||
|
@ -602,12 +609,6 @@ xchk_btree(
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
/* Initialize scrub state */
|
/* Initialize scrub state */
|
||||||
bs.cur = cur;
|
|
||||||
bs.scrub_rec = scrub_fn;
|
|
||||||
bs.oinfo = oinfo;
|
|
||||||
bs.firstrec = true;
|
|
||||||
bs.private = private;
|
|
||||||
bs.sc = sc;
|
|
||||||
for (i = 0; i < XFS_BTREE_MAXLEVELS; i++)
|
for (i = 0; i < XFS_BTREE_MAXLEVELS; i++)
|
||||||
bs.firstkey[i] = true;
|
bs.firstkey[i] = true;
|
||||||
INIT_LIST_HEAD(&bs.to_check);
|
INIT_LIST_HEAD(&bs.to_check);
|
||||||
|
|
|
@ -34,7 +34,7 @@ struct xchk_btree {
|
||||||
struct xfs_scrub *sc;
|
struct xfs_scrub *sc;
|
||||||
struct xfs_btree_cur *cur;
|
struct xfs_btree_cur *cur;
|
||||||
xchk_btree_rec_fn scrub_rec;
|
xchk_btree_rec_fn scrub_rec;
|
||||||
struct xfs_owner_info *oinfo;
|
const struct xfs_owner_info *oinfo;
|
||||||
void *private;
|
void *private;
|
||||||
|
|
||||||
/* internal scrub state */
|
/* internal scrub state */
|
||||||
|
@ -45,7 +45,7 @@ struct xchk_btree {
|
||||||
struct list_head to_check;
|
struct list_head to_check;
|
||||||
};
|
};
|
||||||
int xchk_btree(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
|
int xchk_btree(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
|
||||||
xchk_btree_rec_fn scrub_fn, struct xfs_owner_info *oinfo,
|
xchk_btree_rec_fn scrub_fn, const struct xfs_owner_info *oinfo,
|
||||||
void *private);
|
void *private);
|
||||||
|
|
||||||
#endif /* __XFS_SCRUB_BTREE_H__ */
|
#endif /* __XFS_SCRUB_BTREE_H__ */
|
||||||
|
|
|
@ -313,7 +313,7 @@ xchk_set_incomplete(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct xchk_rmap_ownedby_info {
|
struct xchk_rmap_ownedby_info {
|
||||||
struct xfs_owner_info *oinfo;
|
const struct xfs_owner_info *oinfo;
|
||||||
xfs_filblks_t *blocks;
|
xfs_filblks_t *blocks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -347,15 +347,15 @@ int
|
||||||
xchk_count_rmap_ownedby_ag(
|
xchk_count_rmap_ownedby_ag(
|
||||||
struct xfs_scrub *sc,
|
struct xfs_scrub *sc,
|
||||||
struct xfs_btree_cur *cur,
|
struct xfs_btree_cur *cur,
|
||||||
struct xfs_owner_info *oinfo,
|
const struct xfs_owner_info *oinfo,
|
||||||
xfs_filblks_t *blocks)
|
xfs_filblks_t *blocks)
|
||||||
{
|
{
|
||||||
struct xchk_rmap_ownedby_info sroi;
|
struct xchk_rmap_ownedby_info sroi = {
|
||||||
|
.oinfo = oinfo,
|
||||||
|
.blocks = blocks,
|
||||||
|
};
|
||||||
|
|
||||||
sroi.oinfo = oinfo;
|
|
||||||
*blocks = 0;
|
*blocks = 0;
|
||||||
sroi.blocks = blocks;
|
|
||||||
|
|
||||||
return xfs_rmap_query_all(cur, xchk_count_rmap_ownedby_irec,
|
return xfs_rmap_query_all(cur, xchk_count_rmap_ownedby_irec,
|
||||||
&sroi);
|
&sroi);
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ int xchk_ag_read_headers(struct xfs_scrub *sc, xfs_agnumber_t agno,
|
||||||
void xchk_ag_btcur_free(struct xchk_ag *sa);
|
void xchk_ag_btcur_free(struct xchk_ag *sa);
|
||||||
int xchk_ag_btcur_init(struct xfs_scrub *sc, struct xchk_ag *sa);
|
int xchk_ag_btcur_init(struct xfs_scrub *sc, struct xchk_ag *sa);
|
||||||
int xchk_count_rmap_ownedby_ag(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
|
int xchk_count_rmap_ownedby_ag(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
|
||||||
struct xfs_owner_info *oinfo, xfs_filblks_t *blocks);
|
const struct xfs_owner_info *oinfo, xfs_filblks_t *blocks);
|
||||||
|
|
||||||
int xchk_setup_ag_btree(struct xfs_scrub *sc, struct xfs_inode *ip,
|
int xchk_setup_ag_btree(struct xfs_scrub *sc, struct xfs_inode *ip,
|
||||||
bool force_log);
|
bool force_log);
|
||||||
|
|
|
@ -383,9 +383,9 @@ xchk_refcountbt_rec(
|
||||||
STATIC void
|
STATIC void
|
||||||
xchk_refcount_xref_rmap(
|
xchk_refcount_xref_rmap(
|
||||||
struct xfs_scrub *sc,
|
struct xfs_scrub *sc,
|
||||||
struct xfs_owner_info *oinfo,
|
|
||||||
xfs_filblks_t cow_blocks)
|
xfs_filblks_t cow_blocks)
|
||||||
{
|
{
|
||||||
|
struct xfs_owner_info oinfo;
|
||||||
xfs_extlen_t refcbt_blocks = 0;
|
xfs_extlen_t refcbt_blocks = 0;
|
||||||
xfs_filblks_t blocks;
|
xfs_filblks_t blocks;
|
||||||
int error;
|
int error;
|
||||||
|
@ -394,10 +394,11 @@ xchk_refcount_xref_rmap(
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Check that we saw as many refcbt blocks as the rmap knows about. */
|
/* Check that we saw as many refcbt blocks as the rmap knows about. */
|
||||||
|
xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_REFC);
|
||||||
error = xfs_btree_count_blocks(sc->sa.refc_cur, &refcbt_blocks);
|
error = xfs_btree_count_blocks(sc->sa.refc_cur, &refcbt_blocks);
|
||||||
if (!xchk_btree_process_error(sc, sc->sa.refc_cur, 0, &error))
|
if (!xchk_btree_process_error(sc, sc->sa.refc_cur, 0, &error))
|
||||||
return;
|
return;
|
||||||
error = xchk_count_rmap_ownedby_ag(sc, sc->sa.rmap_cur, oinfo,
|
error = xchk_count_rmap_ownedby_ag(sc, sc->sa.rmap_cur, &oinfo,
|
||||||
&blocks);
|
&blocks);
|
||||||
if (!xchk_should_check_xref(sc, &error, &sc->sa.rmap_cur))
|
if (!xchk_should_check_xref(sc, &error, &sc->sa.rmap_cur))
|
||||||
return;
|
return;
|
||||||
|
@ -405,8 +406,8 @@ xchk_refcount_xref_rmap(
|
||||||
xchk_btree_xref_set_corrupt(sc, sc->sa.rmap_cur, 0);
|
xchk_btree_xref_set_corrupt(sc, sc->sa.rmap_cur, 0);
|
||||||
|
|
||||||
/* Check that we saw as many cow blocks as the rmap knows about. */
|
/* Check that we saw as many cow blocks as the rmap knows about. */
|
||||||
xfs_rmap_ag_owner(oinfo, XFS_RMAP_OWN_COW);
|
xfs_rmap_ag_owner(&oinfo, XFS_RMAP_OWN_COW);
|
||||||
error = xchk_count_rmap_ownedby_ag(sc, sc->sa.rmap_cur, oinfo,
|
error = xchk_count_rmap_ownedby_ag(sc, sc->sa.rmap_cur, &oinfo,
|
||||||
&blocks);
|
&blocks);
|
||||||
if (!xchk_should_check_xref(sc, &error, &sc->sa.rmap_cur))
|
if (!xchk_should_check_xref(sc, &error, &sc->sa.rmap_cur))
|
||||||
return;
|
return;
|
||||||
|
@ -429,7 +430,7 @@ xchk_refcountbt(
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
xchk_refcount_xref_rmap(sc, &oinfo, cow_blocks);
|
xchk_refcount_xref_rmap(sc, cow_blocks);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,7 +300,7 @@ xrep_calc_ag_resblks(
|
||||||
int
|
int
|
||||||
xrep_alloc_ag_block(
|
xrep_alloc_ag_block(
|
||||||
struct xfs_scrub *sc,
|
struct xfs_scrub *sc,
|
||||||
struct xfs_owner_info *oinfo,
|
const struct xfs_owner_info *oinfo,
|
||||||
xfs_fsblock_t *fsbno,
|
xfs_fsblock_t *fsbno,
|
||||||
enum xfs_ag_resv_type resv)
|
enum xfs_ag_resv_type resv)
|
||||||
{
|
{
|
||||||
|
@ -540,7 +540,7 @@ STATIC int
|
||||||
xrep_reap_block(
|
xrep_reap_block(
|
||||||
struct xfs_scrub *sc,
|
struct xfs_scrub *sc,
|
||||||
xfs_fsblock_t fsbno,
|
xfs_fsblock_t fsbno,
|
||||||
struct xfs_owner_info *oinfo,
|
const struct xfs_owner_info *oinfo,
|
||||||
enum xfs_ag_resv_type resv)
|
enum xfs_ag_resv_type resv)
|
||||||
{
|
{
|
||||||
struct xfs_btree_cur *cur;
|
struct xfs_btree_cur *cur;
|
||||||
|
@ -614,7 +614,7 @@ int
|
||||||
xrep_reap_extents(
|
xrep_reap_extents(
|
||||||
struct xfs_scrub *sc,
|
struct xfs_scrub *sc,
|
||||||
struct xfs_bitmap *bitmap,
|
struct xfs_bitmap *bitmap,
|
||||||
struct xfs_owner_info *oinfo,
|
const struct xfs_owner_info *oinfo,
|
||||||
enum xfs_ag_resv_type type)
|
enum xfs_ag_resv_type type)
|
||||||
{
|
{
|
||||||
struct xfs_bitmap_range *bmr;
|
struct xfs_bitmap_range *bmr;
|
||||||
|
|
|
@ -21,8 +21,9 @@ int xrep_roll_ag_trans(struct xfs_scrub *sc);
|
||||||
bool xrep_ag_has_space(struct xfs_perag *pag, xfs_extlen_t nr_blocks,
|
bool xrep_ag_has_space(struct xfs_perag *pag, xfs_extlen_t nr_blocks,
|
||||||
enum xfs_ag_resv_type type);
|
enum xfs_ag_resv_type type);
|
||||||
xfs_extlen_t xrep_calc_ag_resblks(struct xfs_scrub *sc);
|
xfs_extlen_t xrep_calc_ag_resblks(struct xfs_scrub *sc);
|
||||||
int xrep_alloc_ag_block(struct xfs_scrub *sc, struct xfs_owner_info *oinfo,
|
int xrep_alloc_ag_block(struct xfs_scrub *sc,
|
||||||
xfs_fsblock_t *fsbno, enum xfs_ag_resv_type resv);
|
const struct xfs_owner_info *oinfo, xfs_fsblock_t *fsbno,
|
||||||
|
enum xfs_ag_resv_type resv);
|
||||||
int xrep_init_btblock(struct xfs_scrub *sc, xfs_fsblock_t fsb,
|
int xrep_init_btblock(struct xfs_scrub *sc, xfs_fsblock_t fsb,
|
||||||
struct xfs_buf **bpp, xfs_btnum_t btnum,
|
struct xfs_buf **bpp, xfs_btnum_t btnum,
|
||||||
const struct xfs_buf_ops *ops);
|
const struct xfs_buf_ops *ops);
|
||||||
|
@ -32,7 +33,7 @@ struct xfs_bitmap;
|
||||||
int xrep_fix_freelist(struct xfs_scrub *sc, bool can_shrink);
|
int xrep_fix_freelist(struct xfs_scrub *sc, bool can_shrink);
|
||||||
int xrep_invalidate_blocks(struct xfs_scrub *sc, struct xfs_bitmap *btlist);
|
int xrep_invalidate_blocks(struct xfs_scrub *sc, struct xfs_bitmap *btlist);
|
||||||
int xrep_reap_extents(struct xfs_scrub *sc, struct xfs_bitmap *exlist,
|
int xrep_reap_extents(struct xfs_scrub *sc, struct xfs_bitmap *exlist,
|
||||||
struct xfs_owner_info *oinfo, enum xfs_ag_resv_type type);
|
const struct xfs_owner_info *oinfo, enum xfs_ag_resv_type type);
|
||||||
|
|
||||||
struct xrep_find_ag_btree {
|
struct xrep_find_ag_btree {
|
||||||
/* in: rmap owner of the btree we're looking for */
|
/* in: rmap owner of the btree we're looking for */
|
||||||
|
|
|
@ -187,7 +187,7 @@ xchk_xref_check_owner(
|
||||||
struct xfs_scrub *sc,
|
struct xfs_scrub *sc,
|
||||||
xfs_agblock_t bno,
|
xfs_agblock_t bno,
|
||||||
xfs_extlen_t len,
|
xfs_extlen_t len,
|
||||||
struct xfs_owner_info *oinfo,
|
const struct xfs_owner_info *oinfo,
|
||||||
bool should_have_rmap)
|
bool should_have_rmap)
|
||||||
{
|
{
|
||||||
bool has_rmap;
|
bool has_rmap;
|
||||||
|
@ -210,7 +210,7 @@ xchk_xref_is_owned_by(
|
||||||
struct xfs_scrub *sc,
|
struct xfs_scrub *sc,
|
||||||
xfs_agblock_t bno,
|
xfs_agblock_t bno,
|
||||||
xfs_extlen_t len,
|
xfs_extlen_t len,
|
||||||
struct xfs_owner_info *oinfo)
|
const struct xfs_owner_info *oinfo)
|
||||||
{
|
{
|
||||||
xchk_xref_check_owner(sc, bno, len, oinfo, true);
|
xchk_xref_check_owner(sc, bno, len, oinfo, true);
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ xchk_xref_is_not_owned_by(
|
||||||
struct xfs_scrub *sc,
|
struct xfs_scrub *sc,
|
||||||
xfs_agblock_t bno,
|
xfs_agblock_t bno,
|
||||||
xfs_extlen_t len,
|
xfs_extlen_t len,
|
||||||
struct xfs_owner_info *oinfo)
|
const struct xfs_owner_info *oinfo)
|
||||||
{
|
{
|
||||||
xchk_xref_check_owner(sc, bno, len, oinfo, false);
|
xchk_xref_check_owner(sc, bno, len, oinfo, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,9 +122,9 @@ void xchk_xref_is_not_inode_chunk(struct xfs_scrub *sc, xfs_agblock_t agbno,
|
||||||
void xchk_xref_is_inode_chunk(struct xfs_scrub *sc, xfs_agblock_t agbno,
|
void xchk_xref_is_inode_chunk(struct xfs_scrub *sc, xfs_agblock_t agbno,
|
||||||
xfs_extlen_t len);
|
xfs_extlen_t len);
|
||||||
void xchk_xref_is_owned_by(struct xfs_scrub *sc, xfs_agblock_t agbno,
|
void xchk_xref_is_owned_by(struct xfs_scrub *sc, xfs_agblock_t agbno,
|
||||||
xfs_extlen_t len, struct xfs_owner_info *oinfo);
|
xfs_extlen_t len, const struct xfs_owner_info *oinfo);
|
||||||
void xchk_xref_is_not_owned_by(struct xfs_scrub *sc, xfs_agblock_t agbno,
|
void xchk_xref_is_not_owned_by(struct xfs_scrub *sc, xfs_agblock_t agbno,
|
||||||
xfs_extlen_t len, struct xfs_owner_info *oinfo);
|
xfs_extlen_t len, const struct xfs_owner_info *oinfo);
|
||||||
void xchk_xref_has_no_owner(struct xfs_scrub *sc, xfs_agblock_t agbno,
|
void xchk_xref_has_no_owner(struct xfs_scrub *sc, xfs_agblock_t agbno,
|
||||||
xfs_extlen_t len);
|
xfs_extlen_t len);
|
||||||
void xchk_xref_is_cow_staging(struct xfs_scrub *sc, xfs_agblock_t bno,
|
void xchk_xref_is_cow_staging(struct xfs_scrub *sc, xfs_agblock_t bno,
|
||||||
|
|
|
@ -2405,7 +2405,7 @@ DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_deferred);
|
||||||
DECLARE_EVENT_CLASS(xfs_rmap_class,
|
DECLARE_EVENT_CLASS(xfs_rmap_class,
|
||||||
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
|
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
|
||||||
xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
|
xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
|
||||||
struct xfs_owner_info *oinfo),
|
const struct xfs_owner_info *oinfo),
|
||||||
TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
|
TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
|
||||||
TP_STRUCT__entry(
|
TP_STRUCT__entry(
|
||||||
__field(dev_t, dev)
|
__field(dev_t, dev)
|
||||||
|
@ -2440,7 +2440,7 @@ DECLARE_EVENT_CLASS(xfs_rmap_class,
|
||||||
DEFINE_EVENT(xfs_rmap_class, name, \
|
DEFINE_EVENT(xfs_rmap_class, name, \
|
||||||
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
|
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
|
||||||
xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
|
xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
|
||||||
struct xfs_owner_info *oinfo), \
|
const struct xfs_owner_info *oinfo), \
|
||||||
TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
|
TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
|
||||||
|
|
||||||
/* simple AG-based error/%ip tracepoint class */
|
/* simple AG-based error/%ip tracepoint class */
|
||||||
|
|
|
@ -228,7 +228,8 @@ struct xfs_efd_log_item *xfs_trans_get_efd(struct xfs_trans *,
|
||||||
uint);
|
uint);
|
||||||
int xfs_trans_free_extent(struct xfs_trans *,
|
int xfs_trans_free_extent(struct xfs_trans *,
|
||||||
struct xfs_efd_log_item *, xfs_fsblock_t,
|
struct xfs_efd_log_item *, xfs_fsblock_t,
|
||||||
xfs_extlen_t, struct xfs_owner_info *,
|
xfs_extlen_t,
|
||||||
|
const struct xfs_owner_info *,
|
||||||
bool);
|
bool);
|
||||||
int xfs_trans_commit(struct xfs_trans *);
|
int xfs_trans_commit(struct xfs_trans *);
|
||||||
int xfs_trans_roll(struct xfs_trans **);
|
int xfs_trans_roll(struct xfs_trans **);
|
||||||
|
|
|
@ -57,14 +57,15 @@ xfs_trans_free_extent(
|
||||||
struct xfs_efd_log_item *efdp,
|
struct xfs_efd_log_item *efdp,
|
||||||
xfs_fsblock_t start_block,
|
xfs_fsblock_t start_block,
|
||||||
xfs_extlen_t ext_len,
|
xfs_extlen_t ext_len,
|
||||||
struct xfs_owner_info *oinfo,
|
const struct xfs_owner_info *oinfo,
|
||||||
bool skip_discard)
|
bool skip_discard)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = tp->t_mountp;
|
struct xfs_mount *mp = tp->t_mountp;
|
||||||
|
struct xfs_extent *extp;
|
||||||
uint next_extent;
|
uint next_extent;
|
||||||
xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp, start_block);
|
xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp, start_block);
|
||||||
xfs_agblock_t agbno = XFS_FSB_TO_AGBNO(mp, start_block);
|
xfs_agblock_t agbno = XFS_FSB_TO_AGBNO(mp,
|
||||||
struct xfs_extent *extp;
|
start_block);
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
trace_xfs_bmap_free_deferred(tp->t_mountp, agno, 0, agbno, ext_len);
|
trace_xfs_bmap_free_deferred(tp->t_mountp, agno, 0, agbno, ext_len);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче