[XFS] move xfs_bmbt_killroot to common code
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / fs / xfs / xfs_ialloc_btree.c
index 8f66e2720566fbb3301dd9d4c953e4755eb12b57..90f1d4ee77204d15b06d1f5f7cd6a5917c2c223f 100644 (file)
@@ -754,6 +754,22 @@ xfs_inobt_alloc_block(
        return 0;
 }
 
+STATIC int
+xfs_inobt_free_block(
+       struct xfs_btree_cur    *cur,
+       struct xfs_buf          *bp)
+{
+       xfs_fsblock_t           fsbno;
+       int                     error;
+
+       fsbno = XFS_DADDR_TO_FSB(cur->bc_mp, XFS_BUF_ADDR(bp));
+       error = xfs_free_extent(cur->bc_tp, fsbno, 1);
+       if (error)
+               return error;
+
+       xfs_trans_binval(cur->bc_tp, bp);
+       return error;
+}
 
 STATIC int
 xfs_inobt_get_maxrecs(
@@ -886,6 +902,7 @@ static const struct xfs_btree_ops xfs_inobt_ops = {
        .dup_cursor             = xfs_inobt_dup_cursor,
        .set_root               = xfs_inobt_set_root,
        .alloc_block            = xfs_inobt_alloc_block,
+       .free_block             = xfs_inobt_free_block,
        .get_maxrecs            = xfs_inobt_get_maxrecs,
        .init_key_from_rec      = xfs_inobt_init_key_from_rec,
        .init_rec_from_key      = xfs_inobt_init_rec_from_key,