#include "xfs.h"
#include "xfs_fs.h"
#include "xfs_shared.h"
#include "xfs_format.h"
#include "xfs_log_format.h"
#include "xfs_trans_resv.h"
#include "xfs_bit.h"
#include "xfs_mount.h"
#include "xfs_sb.h"
#include "xfs_defer.h"
#include "xfs_btree.h"
#include "xfs_trans.h"
#include "xfs_alloc.h"
#include "xfs_rmap.h"
#include "xfs_rmap_btree.h"
#include "xfs_trace.h"
#include "xfs_errortag.h"
#include "xfs_error.h"
#include "xfs_inode.h"
#include "xfs_ag.h"
#include "xfs_health.h"
#include "xfs_rmap_item.h"
struct kmem_cache *xfs_rmap_intent_cache;
int
xfs_rmap_lookup_le(
struct xfs_btree_cur *cur,
xfs_agblock_t bno,
uint64_t owner,
uint64_t offset,
unsigned int flags,
struct xfs_rmap_irec *irec,
int *stat)
{ … }
int
xfs_rmap_lookup_eq(
struct xfs_btree_cur *cur,
xfs_agblock_t bno,
xfs_extlen_t len,
uint64_t owner,
uint64_t offset,
unsigned int flags,
int *stat)
{ … }
STATIC int
xfs_rmap_update(
struct xfs_btree_cur *cur,
struct xfs_rmap_irec *irec)
{ … }
int
xfs_rmap_insert(
struct xfs_btree_cur *rcur,
xfs_agblock_t agbno,
xfs_extlen_t len,
uint64_t owner,
uint64_t offset,
unsigned int flags)
{ … }
STATIC int
xfs_rmap_delete(
struct xfs_btree_cur *rcur,
xfs_agblock_t agbno,
xfs_extlen_t len,
uint64_t owner,
uint64_t offset,
unsigned int flags)
{ … }
xfs_failaddr_t
xfs_rmap_btrec_to_irec(
const union xfs_btree_rec *rec,
struct xfs_rmap_irec *irec)
{ … }
xfs_failaddr_t
xfs_rmap_check_irec(
struct xfs_perag *pag,
const struct xfs_rmap_irec *irec)
{ … }
static inline xfs_failaddr_t
xfs_rmap_check_btrec(
struct xfs_btree_cur *cur,
const struct xfs_rmap_irec *irec)
{ … }
static inline int
xfs_rmap_complain_bad_rec(
struct xfs_btree_cur *cur,
xfs_failaddr_t fa,
const struct xfs_rmap_irec *irec)
{ … }
int
xfs_rmap_get_rec(
struct xfs_btree_cur *cur,
struct xfs_rmap_irec *irec,
int *stat)
{ … }
struct xfs_find_left_neighbor_info { … };
STATIC int
xfs_rmap_find_left_neighbor_helper(
struct xfs_btree_cur *cur,
const struct xfs_rmap_irec *rec,
void *priv)
{ … }
STATIC int
xfs_rmap_find_left_neighbor(
struct xfs_btree_cur *cur,
xfs_agblock_t bno,
uint64_t owner,
uint64_t offset,
unsigned int flags,
struct xfs_rmap_irec *irec,
int *stat)
{ … }
STATIC int
xfs_rmap_lookup_le_range_helper(
struct xfs_btree_cur *cur,
const struct xfs_rmap_irec *rec,
void *priv)
{ … }
int
xfs_rmap_lookup_le_range(
struct xfs_btree_cur *cur,
xfs_agblock_t bno,
uint64_t owner,
uint64_t offset,
unsigned int flags,
struct xfs_rmap_irec *irec,
int *stat)
{ … }
static int
xfs_rmap_free_check_owner(
struct xfs_btree_cur *cur,
uint64_t ltoff,
struct xfs_rmap_irec *rec,
xfs_filblks_t len,
uint64_t owner,
uint64_t offset,
unsigned int flags)
{ … }
STATIC int
xfs_rmap_unmap(
struct xfs_btree_cur *cur,
xfs_agblock_t bno,
xfs_extlen_t len,
bool unwritten,
const struct xfs_owner_info *oinfo)
{ … }
#ifdef CONFIG_XFS_LIVE_HOOKS
DEFINE_STATIC_XFS_HOOK_SWITCH(xfs_rmap_hooks_switch);
void
xfs_rmap_hook_disable(void)
{ … }
void
xfs_rmap_hook_enable(void)
{ … }
static inline void
xfs_rmap_update_hook(
struct xfs_trans *tp,
struct xfs_perag *pag,
enum xfs_rmap_intent_type op,
xfs_agblock_t startblock,
xfs_extlen_t blockcount,
bool unwritten,
const struct xfs_owner_info *oinfo)
{ … }
int
xfs_rmap_hook_add(
struct xfs_perag *pag,
struct xfs_rmap_hook *hook)
{ … }
void
xfs_rmap_hook_del(
struct xfs_perag *pag,
struct xfs_rmap_hook *hook)
{ … }
void
xfs_rmap_hook_setup(
struct xfs_rmap_hook *hook,
notifier_fn_t mod_fn)
{ … }
#else
#define xfs_rmap_update_hook …
#endif
int
xfs_rmap_free(
struct xfs_trans *tp,
struct xfs_buf *agbp,
struct xfs_perag *pag,
xfs_agblock_t bno,
xfs_extlen_t len,
const struct xfs_owner_info *oinfo)
{ … }
static bool
xfs_rmap_is_mergeable(
struct xfs_rmap_irec *irec,
uint64_t owner,
unsigned int flags)
{ … }
STATIC int
xfs_rmap_map(
struct xfs_btree_cur *cur,
xfs_agblock_t bno,
xfs_extlen_t len,
bool unwritten,
const struct xfs_owner_info *oinfo)
{ … }
int
xfs_rmap_alloc(
struct xfs_trans *tp,
struct xfs_buf *agbp,
struct xfs_perag *pag,
xfs_agblock_t bno,
xfs_extlen_t len,
const struct xfs_owner_info *oinfo)
{ … }
#define RMAP_LEFT_CONTIG …
#define RMAP_RIGHT_CONTIG …
#define RMAP_LEFT_FILLING …
#define RMAP_RIGHT_FILLING …
#define RMAP_LEFT_VALID …
#define RMAP_RIGHT_VALID …
#define LEFT …
#define RIGHT …
#define PREV …
#define NEW …
STATIC int
xfs_rmap_convert(
struct xfs_btree_cur *cur,
xfs_agblock_t bno,
xfs_extlen_t len,
bool unwritten,
const struct xfs_owner_info *oinfo)
{ … }
STATIC int
xfs_rmap_convert_shared(
struct xfs_btree_cur *cur,
xfs_agblock_t bno,
xfs_extlen_t len,
bool unwritten,
const struct xfs_owner_info *oinfo)
{ … }
#undef NEW
#undef LEFT
#undef RIGHT
#undef PREV
STATIC int
xfs_rmap_unmap_shared(
struct xfs_btree_cur *cur,
xfs_agblock_t bno,
xfs_extlen_t len,
bool unwritten,
const struct xfs_owner_info *oinfo)
{ … }
STATIC int
xfs_rmap_map_shared(
struct xfs_btree_cur *cur,
xfs_agblock_t bno,
xfs_extlen_t len,
bool unwritten,
const struct xfs_owner_info *oinfo)
{ … }
int
xfs_rmap_map_raw(
struct xfs_btree_cur *cur,
struct xfs_rmap_irec *rmap)
{ … }
struct xfs_rmap_query_range_info { … };
STATIC int
xfs_rmap_query_range_helper(
struct xfs_btree_cur *cur,
const union xfs_btree_rec *rec,
void *priv)
{ … }
int
xfs_rmap_query_range(
struct xfs_btree_cur *cur,
const struct xfs_rmap_irec *low_rec,
const struct xfs_rmap_irec *high_rec,
xfs_rmap_query_range_fn fn,
void *priv)
{ … }
int
xfs_rmap_query_all(
struct xfs_btree_cur *cur,
xfs_rmap_query_range_fn fn,
void *priv)
{ … }
int
__xfs_rmap_finish_intent(
struct xfs_btree_cur *rcur,
enum xfs_rmap_intent_type op,
xfs_agblock_t bno,
xfs_extlen_t len,
const struct xfs_owner_info *oinfo,
bool unwritten)
{ … }
int
xfs_rmap_finish_one(
struct xfs_trans *tp,
struct xfs_rmap_intent *ri,
struct xfs_btree_cur **pcur)
{ … }
static bool
xfs_rmap_update_is_needed(
struct xfs_mount *mp,
int whichfork)
{ … }
static void
__xfs_rmap_add(
struct xfs_trans *tp,
enum xfs_rmap_intent_type type,
uint64_t owner,
int whichfork,
struct xfs_bmbt_irec *bmap)
{ … }
void
xfs_rmap_map_extent(
struct xfs_trans *tp,
struct xfs_inode *ip,
int whichfork,
struct xfs_bmbt_irec *PREV)
{ … }
void
xfs_rmap_unmap_extent(
struct xfs_trans *tp,
struct xfs_inode *ip,
int whichfork,
struct xfs_bmbt_irec *PREV)
{ … }
void
xfs_rmap_convert_extent(
struct xfs_mount *mp,
struct xfs_trans *tp,
struct xfs_inode *ip,
int whichfork,
struct xfs_bmbt_irec *PREV)
{ … }
void
xfs_rmap_alloc_extent(
struct xfs_trans *tp,
xfs_agnumber_t agno,
xfs_agblock_t bno,
xfs_extlen_t len,
uint64_t owner)
{ … }
void
xfs_rmap_free_extent(
struct xfs_trans *tp,
xfs_agnumber_t agno,
xfs_agblock_t bno,
xfs_extlen_t len,
uint64_t owner)
{ … }
int
xfs_rmap_compare(
const struct xfs_rmap_irec *a,
const struct xfs_rmap_irec *b)
{ … }
int
xfs_rmap_has_records(
struct xfs_btree_cur *cur,
xfs_agblock_t bno,
xfs_extlen_t len,
enum xbtree_recpacking *outcome)
{ … }
struct xfs_rmap_ownercount { … };
static inline bool
xfs_rmap_shareable(
struct xfs_mount *mp,
const struct xfs_rmap_irec *rmap)
{ … }
static inline void
xfs_rmap_ownercount_init(
struct xfs_rmap_ownercount *roc,
xfs_agblock_t bno,
xfs_extlen_t len,
const struct xfs_owner_info *oinfo,
struct xfs_rmap_matches *results)
{ … }
STATIC int
xfs_rmap_count_owners_helper(
struct xfs_btree_cur *cur,
const struct xfs_rmap_irec *rec,
void *priv)
{ … }
int
xfs_rmap_count_owners(
struct xfs_btree_cur *cur,
xfs_agblock_t bno,
xfs_extlen_t len,
const struct xfs_owner_info *oinfo,
struct xfs_rmap_matches *results)
{ … }
int
xfs_rmap_has_other_keys(
struct xfs_btree_cur *cur,
xfs_agblock_t bno,
xfs_extlen_t len,
const struct xfs_owner_info *oinfo,
bool *has_other)
{ … }
const struct xfs_owner_info XFS_RMAP_OINFO_SKIP_UPDATE = …;
const struct xfs_owner_info XFS_RMAP_OINFO_ANY_OWNER = …;
const struct xfs_owner_info XFS_RMAP_OINFO_FS = …;
const struct xfs_owner_info XFS_RMAP_OINFO_LOG = …;
const struct xfs_owner_info XFS_RMAP_OINFO_AG = …;
const struct xfs_owner_info XFS_RMAP_OINFO_INOBT = …;
const struct xfs_owner_info XFS_RMAP_OINFO_INODES = …;
const struct xfs_owner_info XFS_RMAP_OINFO_REFC = …;
const struct xfs_owner_info XFS_RMAP_OINFO_COW = …;
int __init
xfs_rmap_intent_init_cache(void)
{ … }
void
xfs_rmap_intent_destroy_cache(void)
{ … }