mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
xfs: online repair of the realtime refcount btree
Port the data device's refcount btree repair code to the realtime refcount btree. Signed-off-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
@@ -236,6 +236,7 @@ xfs-y += $(addprefix scrub/, \
|
||||
|
||||
xfs-$(CONFIG_XFS_RT) += $(addprefix scrub/, \
|
||||
rtbitmap_repair.o \
|
||||
rtrefcount_repair.o \
|
||||
rtrmap_repair.o \
|
||||
rtsummary_repair.o \
|
||||
)
|
||||
|
||||
@@ -189,7 +189,7 @@ xrep_refc_stash(
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
trace_xrep_refc_found(sc->sa.pag, &irec);
|
||||
trace_xrep_refc_found(pag_group(sc->sa.pag), &irec);
|
||||
|
||||
return xfarray_append(rr->refcount_records, &irec);
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ int xrep_setup_nlinks(struct xfs_scrub *sc);
|
||||
int xrep_setup_symlink(struct xfs_scrub *sc, unsigned int *resblks);
|
||||
int xrep_setup_dirtree(struct xfs_scrub *sc);
|
||||
int xrep_setup_rtrmapbt(struct xfs_scrub *sc);
|
||||
int xrep_setup_rtrefcountbt(struct xfs_scrub *sc);
|
||||
|
||||
/* Repair setup functions */
|
||||
int xrep_setup_ag_allocbt(struct xfs_scrub *sc);
|
||||
@@ -158,11 +159,13 @@ int xrep_rtbitmap(struct xfs_scrub *sc);
|
||||
int xrep_rtsummary(struct xfs_scrub *sc);
|
||||
int xrep_rgsuperblock(struct xfs_scrub *sc);
|
||||
int xrep_rtrmapbt(struct xfs_scrub *sc);
|
||||
int xrep_rtrefcountbt(struct xfs_scrub *sc);
|
||||
#else
|
||||
# define xrep_rtbitmap xrep_notsupported
|
||||
# define xrep_rtsummary xrep_notsupported
|
||||
# define xrep_rgsuperblock xrep_notsupported
|
||||
# define xrep_rtrmapbt xrep_notsupported
|
||||
# define xrep_rtrefcountbt xrep_notsupported
|
||||
#endif /* CONFIG_XFS_RT */
|
||||
|
||||
#ifdef CONFIG_XFS_QUOTA
|
||||
@@ -236,6 +239,7 @@ xrep_setup_nothing(
|
||||
#define xrep_setup_dirtree xrep_setup_nothing
|
||||
#define xrep_setup_metapath xrep_setup_nothing
|
||||
#define xrep_setup_rtrmapbt xrep_setup_nothing
|
||||
#define xrep_setup_rtrefcountbt xrep_setup_nothing
|
||||
|
||||
#define xrep_setup_inode(sc, imap) ((void)0)
|
||||
|
||||
@@ -274,6 +278,7 @@ static inline int xrep_setup_symlink(struct xfs_scrub *sc, unsigned int *x)
|
||||
#define xrep_metapath xrep_notsupported
|
||||
#define xrep_rgsuperblock xrep_notsupported
|
||||
#define xrep_rtrmapbt xrep_notsupported
|
||||
#define xrep_rtrefcountbt xrep_notsupported
|
||||
|
||||
#endif /* CONFIG_XFS_ONLINE_REPAIR */
|
||||
|
||||
|
||||
@@ -7,8 +7,10 @@
|
||||
#include "xfs_fs.h"
|
||||
#include "xfs_shared.h"
|
||||
#include "xfs_format.h"
|
||||
#include "xfs_log_format.h"
|
||||
#include "xfs_trans_resv.h"
|
||||
#include "xfs_mount.h"
|
||||
#include "xfs_trans.h"
|
||||
#include "xfs_btree.h"
|
||||
#include "xfs_rmap.h"
|
||||
#include "xfs_refcount.h"
|
||||
@@ -21,6 +23,7 @@
|
||||
#include "scrub/scrub.h"
|
||||
#include "scrub/common.h"
|
||||
#include "scrub/btree.h"
|
||||
#include "scrub/repair.h"
|
||||
|
||||
/* Set us up with the realtime refcount metadata locked. */
|
||||
int
|
||||
@@ -32,6 +35,12 @@ xchk_setup_rtrefcountbt(
|
||||
if (xchk_need_intent_drain(sc))
|
||||
xchk_fsgates_enable(sc, XCHK_FSGATES_DRAIN);
|
||||
|
||||
if (xchk_could_repair(sc)) {
|
||||
error = xrep_setup_rtrefcountbt(sc);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
|
||||
error = xchk_rtgroup_init(sc, sc->sm->sm_agno, &sc->sr);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -472,7 +472,7 @@ static const struct xchk_meta_ops meta_scrub_ops[] = {
|
||||
.setup = xchk_setup_rtrefcountbt,
|
||||
.scrub = xchk_rtrefcountbt,
|
||||
.has = xfs_has_rtreflink,
|
||||
.repair = xrep_notsupported,
|
||||
.repair = xrep_rtrefcountbt,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -2116,29 +2116,33 @@ TRACE_EVENT(xrep_ibt_found,
|
||||
)
|
||||
|
||||
TRACE_EVENT(xrep_refc_found,
|
||||
TP_PROTO(const struct xfs_perag *pag,
|
||||
TP_PROTO(const struct xfs_group *xg,
|
||||
const struct xfs_refcount_irec *rec),
|
||||
TP_ARGS(pag, rec),
|
||||
TP_ARGS(xg, rec),
|
||||
TP_STRUCT__entry(
|
||||
__field(dev_t, dev)
|
||||
__field(xfs_agnumber_t, agno)
|
||||
__field(enum xfs_refc_domain, domain)
|
||||
__field(enum xfs_group_type, type)
|
||||
__field(xfs_agblock_t, startblock)
|
||||
__field(xfs_extlen_t, blockcount)
|
||||
__field(xfs_nlink_t, refcount)
|
||||
),
|
||||
TP_fast_assign(
|
||||
__entry->dev = pag_mount(pag)->m_super->s_dev;
|
||||
__entry->agno = pag_agno(pag);
|
||||
__entry->dev = xg->xg_mount->m_super->s_dev;
|
||||
__entry->agno = xg->xg_gno;
|
||||
__entry->type = xg->xg_type;
|
||||
__entry->domain = rec->rc_domain;
|
||||
__entry->startblock = rec->rc_startblock;
|
||||
__entry->blockcount = rec->rc_blockcount;
|
||||
__entry->refcount = rec->rc_refcount;
|
||||
),
|
||||
TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u",
|
||||
TP_printk("dev %d:%d %sno 0x%x dom %s %sbno 0x%x fsbcount 0x%x refcount %u",
|
||||
MAJOR(__entry->dev), MINOR(__entry->dev),
|
||||
__print_symbolic(__entry->type, XG_TYPE_STRINGS),
|
||||
__entry->agno,
|
||||
__print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS),
|
||||
__print_symbolic(__entry->type, XG_TYPE_STRINGS),
|
||||
__entry->startblock,
|
||||
__entry->blockcount,
|
||||
__entry->refcount)
|
||||
|
||||
Reference in New Issue
Block a user