diff options
author | Brian Foster <bfoster@redhat.com> | 2014-04-24 02:00:50 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-04-24 02:00:50 -0400 |
commit | 57bd3dbe4059c6fff7e39927e5aa789dfb2585b9 (patch) | |
tree | 6f122a620ec1c9a26aa733c67269097f8b48b893 | |
parent | c9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff) |
xfs: refactor xfs_ialloc_btree.c to support multiple inobt numbers
The introduction of the free inode btree (finobt) requires that
xfs_ialloc_btree.c handle multiple trees. Refactor xfs_ialloc_btree.c
so the caller specifies the btree type on cursor initialization to
prepare for addition of the finobt.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r-- | fs/xfs/xfs_ialloc.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_ialloc_btree.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_ialloc_btree.h | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_itable.c | 6 |
4 files changed, 15 insertions, 10 deletions
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index 8f711db61a0c..e67657288b9a 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
@@ -461,7 +461,7 @@ xfs_ialloc_ag_alloc( | |||
461 | /* | 461 | /* |
462 | * Insert records describing the new inode chunk into the btree. | 462 | * Insert records describing the new inode chunk into the btree. |
463 | */ | 463 | */ |
464 | cur = xfs_inobt_init_cursor(args.mp, tp, agbp, agno); | 464 | cur = xfs_inobt_init_cursor(args.mp, tp, agbp, agno, XFS_BTNUM_INO); |
465 | for (thisino = newino; | 465 | for (thisino = newino; |
466 | thisino < newino + newlen; | 466 | thisino < newino + newlen; |
467 | thisino += XFS_INODES_PER_CHUNK) { | 467 | thisino += XFS_INODES_PER_CHUNK) { |
@@ -707,7 +707,7 @@ xfs_dialloc_ag( | |||
707 | ASSERT(pag->pagi_freecount > 0); | 707 | ASSERT(pag->pagi_freecount > 0); |
708 | 708 | ||
709 | restart_pagno: | 709 | restart_pagno: |
710 | cur = xfs_inobt_init_cursor(mp, tp, agbp, agno); | 710 | cur = xfs_inobt_init_cursor(mp, tp, agbp, agno, XFS_BTNUM_INO); |
711 | /* | 711 | /* |
712 | * If pagino is 0 (this is the root inode allocation) use newino. | 712 | * If pagino is 0 (this is the root inode allocation) use newino. |
713 | * This must work because we've just allocated some. | 713 | * This must work because we've just allocated some. |
@@ -1169,7 +1169,7 @@ xfs_difree( | |||
1169 | /* | 1169 | /* |
1170 | * Initialize the cursor. | 1170 | * Initialize the cursor. |
1171 | */ | 1171 | */ |
1172 | cur = xfs_inobt_init_cursor(mp, tp, agbp, agno); | 1172 | cur = xfs_inobt_init_cursor(mp, tp, agbp, agno, XFS_BTNUM_INO); |
1173 | 1173 | ||
1174 | error = xfs_check_agi_freecount(cur, agi); | 1174 | error = xfs_check_agi_freecount(cur, agi); |
1175 | if (error) | 1175 | if (error) |
@@ -1300,7 +1300,7 @@ xfs_imap_lookup( | |||
1300 | * we have a record, we need to ensure it contains the inode number | 1300 | * we have a record, we need to ensure it contains the inode number |
1301 | * we are looking up. | 1301 | * we are looking up. |
1302 | */ | 1302 | */ |
1303 | cur = xfs_inobt_init_cursor(mp, tp, agbp, agno); | 1303 | cur = xfs_inobt_init_cursor(mp, tp, agbp, agno, XFS_BTNUM_INO); |
1304 | error = xfs_inobt_lookup(cur, agino, XFS_LOOKUP_LE, &i); | 1304 | error = xfs_inobt_lookup(cur, agino, XFS_LOOKUP_LE, &i); |
1305 | if (!error) { | 1305 | if (!error) { |
1306 | if (i) | 1306 | if (i) |
diff --git a/fs/xfs/xfs_ialloc_btree.c b/fs/xfs/xfs_ialloc_btree.c index 7e309b11e87d..41e4883c5af2 100644 --- a/fs/xfs/xfs_ialloc_btree.c +++ b/fs/xfs/xfs_ialloc_btree.c | |||
@@ -49,7 +49,8 @@ xfs_inobt_dup_cursor( | |||
49 | struct xfs_btree_cur *cur) | 49 | struct xfs_btree_cur *cur) |
50 | { | 50 | { |
51 | return xfs_inobt_init_cursor(cur->bc_mp, cur->bc_tp, | 51 | return xfs_inobt_init_cursor(cur->bc_mp, cur->bc_tp, |
52 | cur->bc_private.a.agbp, cur->bc_private.a.agno); | 52 | cur->bc_private.a.agbp, cur->bc_private.a.agno, |
53 | cur->bc_btnum); | ||
53 | } | 54 | } |
54 | 55 | ||
55 | STATIC void | 56 | STATIC void |
@@ -325,7 +326,8 @@ xfs_inobt_init_cursor( | |||
325 | struct xfs_mount *mp, /* file system mount point */ | 326 | struct xfs_mount *mp, /* file system mount point */ |
326 | struct xfs_trans *tp, /* transaction pointer */ | 327 | struct xfs_trans *tp, /* transaction pointer */ |
327 | struct xfs_buf *agbp, /* buffer for agi structure */ | 328 | struct xfs_buf *agbp, /* buffer for agi structure */ |
328 | xfs_agnumber_t agno) /* allocation group number */ | 329 | xfs_agnumber_t agno, /* allocation group number */ |
330 | xfs_btnum_t btnum) /* ialloc or free ino btree */ | ||
329 | { | 331 | { |
330 | struct xfs_agi *agi = XFS_BUF_TO_AGI(agbp); | 332 | struct xfs_agi *agi = XFS_BUF_TO_AGI(agbp); |
331 | struct xfs_btree_cur *cur; | 333 | struct xfs_btree_cur *cur; |
@@ -335,7 +337,7 @@ xfs_inobt_init_cursor( | |||
335 | cur->bc_tp = tp; | 337 | cur->bc_tp = tp; |
336 | cur->bc_mp = mp; | 338 | cur->bc_mp = mp; |
337 | cur->bc_nlevels = be32_to_cpu(agi->agi_level); | 339 | cur->bc_nlevels = be32_to_cpu(agi->agi_level); |
338 | cur->bc_btnum = XFS_BTNUM_INO; | 340 | cur->bc_btnum = btnum; |
339 | cur->bc_blocklog = mp->m_sb.sb_blocklog; | 341 | cur->bc_blocklog = mp->m_sb.sb_blocklog; |
340 | 342 | ||
341 | cur->bc_ops = &xfs_inobt_ops; | 343 | cur->bc_ops = &xfs_inobt_ops; |
diff --git a/fs/xfs/xfs_ialloc_btree.h b/fs/xfs/xfs_ialloc_btree.h index f38b22011c4e..d7ebea72c2d0 100644 --- a/fs/xfs/xfs_ialloc_btree.h +++ b/fs/xfs/xfs_ialloc_btree.h | |||
@@ -58,7 +58,8 @@ struct xfs_mount; | |||
58 | ((index) - 1) * sizeof(xfs_inobt_ptr_t))) | 58 | ((index) - 1) * sizeof(xfs_inobt_ptr_t))) |
59 | 59 | ||
60 | extern struct xfs_btree_cur *xfs_inobt_init_cursor(struct xfs_mount *, | 60 | extern struct xfs_btree_cur *xfs_inobt_init_cursor(struct xfs_mount *, |
61 | struct xfs_trans *, struct xfs_buf *, xfs_agnumber_t); | 61 | struct xfs_trans *, struct xfs_buf *, xfs_agnumber_t, |
62 | xfs_btnum_t); | ||
62 | extern int xfs_inobt_maxrecs(struct xfs_mount *, int, int); | 63 | extern int xfs_inobt_maxrecs(struct xfs_mount *, int, int); |
63 | 64 | ||
64 | #endif /* __XFS_IALLOC_BTREE_H__ */ | 65 | #endif /* __XFS_IALLOC_BTREE_H__ */ |
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c index f46338285152..cb64f222d607 100644 --- a/fs/xfs/xfs_itable.c +++ b/fs/xfs/xfs_itable.c | |||
@@ -270,7 +270,8 @@ xfs_bulkstat( | |||
270 | /* | 270 | /* |
271 | * Allocate and initialize a btree cursor for ialloc btree. | 271 | * Allocate and initialize a btree cursor for ialloc btree. |
272 | */ | 272 | */ |
273 | cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno); | 273 | cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno, |
274 | XFS_BTNUM_INO); | ||
274 | irbp = irbuf; | 275 | irbp = irbuf; |
275 | irbufend = irbuf + nirbuf; | 276 | irbufend = irbuf + nirbuf; |
276 | end_of_ag = 0; | 277 | end_of_ag = 0; |
@@ -621,7 +622,8 @@ xfs_inumbers( | |||
621 | agino = 0; | 622 | agino = 0; |
622 | continue; | 623 | continue; |
623 | } | 624 | } |
624 | cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno); | 625 | cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno, |
626 | XFS_BTNUM_INO); | ||
625 | error = xfs_inobt_lookup(cur, agino, XFS_LOOKUP_GE, | 627 | error = xfs_inobt_lookup(cur, agino, XFS_LOOKUP_GE, |
626 | &tmp); | 628 | &tmp); |
627 | if (error) { | 629 | if (error) { |