Loading fs/xfs/libxfs/xfs_rtgroup.c +2 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ #include "xfs_rtbitmap.h" #include "xfs_metafile.h" #include "xfs_metadir.h" #include "xfs_rtrmap_btree.h" /* Find the first usable fsblock in this rtgroup. */ static inline uint32_t Loading Loading @@ -363,6 +364,7 @@ static const struct xfs_rtginode_ops xfs_rtginode_ops[XFS_RTGI_MAX] = { * rtrmapbt predicate here. */ .enabled = xfs_has_rmapbt, .create = xfs_rtrmapbt_create, }, }; Loading fs/xfs/libxfs/xfs_rtrmap_btree.c +54 −0 Original line number Diff line number Diff line Loading @@ -832,3 +832,57 @@ xfs_iflush_rtrmap( xfs_rtrmapbt_to_disk(ip->i_mount, ifp->if_broot, ifp->if_broot_bytes, dfp, XFS_DFORK_SIZE(dip, ip->i_mount, XFS_DATA_FORK)); } /* * Create a realtime rmap btree inode. */ int xfs_rtrmapbt_create( struct xfs_rtgroup *rtg, struct xfs_inode *ip, struct xfs_trans *tp, bool init) { struct xfs_ifork *ifp = xfs_ifork_ptr(ip, XFS_DATA_FORK); struct xfs_mount *mp = ip->i_mount; struct xfs_btree_block *broot; ifp->if_format = XFS_DINODE_FMT_META_BTREE; ASSERT(ifp->if_broot_bytes == 0); ASSERT(ifp->if_bytes == 0); /* Initialize the empty incore btree root. */ broot = xfs_broot_realloc(ifp, xfs_rtrmap_broot_space_calc(mp, 0, 0)); if (broot) xfs_btree_init_block(mp, broot, &xfs_rtrmapbt_ops, 0, 0, ip->i_ino); xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE | XFS_ILOG_DBROOT); return 0; } /* * Initialize an rmap for a realtime superblock using the potentially updated * rt geometry in the provided @mp. */ int xfs_rtrmapbt_init_rtsb( struct xfs_mount *mp, struct xfs_rtgroup *rtg, struct xfs_trans *tp) { struct xfs_rmap_irec rmap = { .rm_blockcount = mp->m_sb.sb_rextsize, .rm_owner = XFS_RMAP_OWN_FS, }; struct xfs_btree_cur *cur; int error; ASSERT(xfs_has_rtsb(mp)); ASSERT(rtg_rgno(rtg) == 0); cur = xfs_rtrmapbt_init_cursor(tp, rtg); error = xfs_rmap_map_raw(cur, &rmap); xfs_btree_del_cursor(cur, error); return error; } fs/xfs/libxfs/xfs_rtrmap_btree.h +5 −0 Original line number Diff line number Diff line Loading @@ -193,4 +193,9 @@ void xfs_rtrmapbt_to_disk(struct xfs_mount *mp, struct xfs_btree_block *rblock, unsigned int dblocklen); void xfs_iflush_rtrmap(struct xfs_inode *ip, struct xfs_dinode *dip); int xfs_rtrmapbt_create(struct xfs_rtgroup *rtg, struct xfs_inode *ip, struct xfs_trans *tp, bool init); int xfs_rtrmapbt_init_rtsb(struct xfs_mount *mp, struct xfs_rtgroup *rtg, struct xfs_trans *tp); #endif /* __XFS_RTRMAP_BTREE_H__ */ fs/xfs/xfs_rtalloc.c +10 −2 Original line number Diff line number Diff line Loading @@ -846,6 +846,13 @@ xfs_growfs_rt_init_rtsb( mp->m_rtsb_bp = rtsb_bp; error = xfs_bwrite(rtsb_bp); xfs_buf_unlock(rtsb_bp); if (error) return error; /* Initialize the rtrmap to reflect the rtsb. */ if (rtg_rmap(args->rtg) != NULL) error = xfs_rtrmapbt_init_rtsb(nargs->mp, args->rtg, args->tp); return error; } Loading Loading @@ -894,8 +901,9 @@ xfs_growfs_rt_bmblock( goto out_free; nargs.tp = args.tp; xfs_rtgroup_lock(args.rtg, XFS_RTGLOCK_BITMAP); xfs_rtgroup_trans_join(args.tp, args.rtg, XFS_RTGLOCK_BITMAP); xfs_rtgroup_lock(args.rtg, XFS_RTGLOCK_BITMAP | XFS_RTGLOCK_RMAP); xfs_rtgroup_trans_join(args.tp, args.rtg, XFS_RTGLOCK_BITMAP | XFS_RTGLOCK_RMAP); /* * Update the bitmap inode's size ondisk and incore. We need to update Loading Loading
fs/xfs/libxfs/xfs_rtgroup.c +2 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ #include "xfs_rtbitmap.h" #include "xfs_metafile.h" #include "xfs_metadir.h" #include "xfs_rtrmap_btree.h" /* Find the first usable fsblock in this rtgroup. */ static inline uint32_t Loading Loading @@ -363,6 +364,7 @@ static const struct xfs_rtginode_ops xfs_rtginode_ops[XFS_RTGI_MAX] = { * rtrmapbt predicate here. */ .enabled = xfs_has_rmapbt, .create = xfs_rtrmapbt_create, }, }; Loading
fs/xfs/libxfs/xfs_rtrmap_btree.c +54 −0 Original line number Diff line number Diff line Loading @@ -832,3 +832,57 @@ xfs_iflush_rtrmap( xfs_rtrmapbt_to_disk(ip->i_mount, ifp->if_broot, ifp->if_broot_bytes, dfp, XFS_DFORK_SIZE(dip, ip->i_mount, XFS_DATA_FORK)); } /* * Create a realtime rmap btree inode. */ int xfs_rtrmapbt_create( struct xfs_rtgroup *rtg, struct xfs_inode *ip, struct xfs_trans *tp, bool init) { struct xfs_ifork *ifp = xfs_ifork_ptr(ip, XFS_DATA_FORK); struct xfs_mount *mp = ip->i_mount; struct xfs_btree_block *broot; ifp->if_format = XFS_DINODE_FMT_META_BTREE; ASSERT(ifp->if_broot_bytes == 0); ASSERT(ifp->if_bytes == 0); /* Initialize the empty incore btree root. */ broot = xfs_broot_realloc(ifp, xfs_rtrmap_broot_space_calc(mp, 0, 0)); if (broot) xfs_btree_init_block(mp, broot, &xfs_rtrmapbt_ops, 0, 0, ip->i_ino); xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE | XFS_ILOG_DBROOT); return 0; } /* * Initialize an rmap for a realtime superblock using the potentially updated * rt geometry in the provided @mp. */ int xfs_rtrmapbt_init_rtsb( struct xfs_mount *mp, struct xfs_rtgroup *rtg, struct xfs_trans *tp) { struct xfs_rmap_irec rmap = { .rm_blockcount = mp->m_sb.sb_rextsize, .rm_owner = XFS_RMAP_OWN_FS, }; struct xfs_btree_cur *cur; int error; ASSERT(xfs_has_rtsb(mp)); ASSERT(rtg_rgno(rtg) == 0); cur = xfs_rtrmapbt_init_cursor(tp, rtg); error = xfs_rmap_map_raw(cur, &rmap); xfs_btree_del_cursor(cur, error); return error; }
fs/xfs/libxfs/xfs_rtrmap_btree.h +5 −0 Original line number Diff line number Diff line Loading @@ -193,4 +193,9 @@ void xfs_rtrmapbt_to_disk(struct xfs_mount *mp, struct xfs_btree_block *rblock, unsigned int dblocklen); void xfs_iflush_rtrmap(struct xfs_inode *ip, struct xfs_dinode *dip); int xfs_rtrmapbt_create(struct xfs_rtgroup *rtg, struct xfs_inode *ip, struct xfs_trans *tp, bool init); int xfs_rtrmapbt_init_rtsb(struct xfs_mount *mp, struct xfs_rtgroup *rtg, struct xfs_trans *tp); #endif /* __XFS_RTRMAP_BTREE_H__ */
fs/xfs/xfs_rtalloc.c +10 −2 Original line number Diff line number Diff line Loading @@ -846,6 +846,13 @@ xfs_growfs_rt_init_rtsb( mp->m_rtsb_bp = rtsb_bp; error = xfs_bwrite(rtsb_bp); xfs_buf_unlock(rtsb_bp); if (error) return error; /* Initialize the rtrmap to reflect the rtsb. */ if (rtg_rmap(args->rtg) != NULL) error = xfs_rtrmapbt_init_rtsb(nargs->mp, args->rtg, args->tp); return error; } Loading Loading @@ -894,8 +901,9 @@ xfs_growfs_rt_bmblock( goto out_free; nargs.tp = args.tp; xfs_rtgroup_lock(args.rtg, XFS_RTGLOCK_BITMAP); xfs_rtgroup_trans_join(args.tp, args.rtg, XFS_RTGLOCK_BITMAP); xfs_rtgroup_lock(args.rtg, XFS_RTGLOCK_BITMAP | XFS_RTGLOCK_RMAP); xfs_rtgroup_trans_join(args.tp, args.rtg, XFS_RTGLOCK_BITMAP | XFS_RTGLOCK_RMAP); /* * Update the bitmap inode's size ondisk and incore. We need to update Loading