diff options
Diffstat (limited to 'fs/xfs/xfs_ialloc.c')
-rw-r--r-- | fs/xfs/xfs_ialloc.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index b5feb3e7711..f943368c9b9 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
@@ -123,6 +123,7 @@ xfs_ialloc_ag_alloc( | |||
123 | int blks_per_cluster; /* fs blocks per inode cluster */ | 123 | int blks_per_cluster; /* fs blocks per inode cluster */ |
124 | xfs_btree_cur_t *cur; /* inode btree cursor */ | 124 | xfs_btree_cur_t *cur; /* inode btree cursor */ |
125 | xfs_daddr_t d; /* disk addr of buffer */ | 125 | xfs_daddr_t d; /* disk addr of buffer */ |
126 | xfs_agnumber_t agno; | ||
126 | int error; | 127 | int error; |
127 | xfs_buf_t *fbuf; /* new free inodes' buffer */ | 128 | xfs_buf_t *fbuf; /* new free inodes' buffer */ |
128 | xfs_dinode_t *free; /* new free inode structure */ | 129 | xfs_dinode_t *free; /* new free inode structure */ |
@@ -302,15 +303,15 @@ xfs_ialloc_ag_alloc( | |||
302 | } | 303 | } |
303 | be32_add(&agi->agi_count, newlen); | 304 | be32_add(&agi->agi_count, newlen); |
304 | be32_add(&agi->agi_freecount, newlen); | 305 | be32_add(&agi->agi_freecount, newlen); |
306 | agno = be32_to_cpu(agi->agi_seqno); | ||
305 | down_read(&args.mp->m_peraglock); | 307 | down_read(&args.mp->m_peraglock); |
306 | args.mp->m_perag[be32_to_cpu(agi->agi_seqno)].pagi_freecount += newlen; | 308 | args.mp->m_perag[agno].pagi_freecount += newlen; |
307 | up_read(&args.mp->m_peraglock); | 309 | up_read(&args.mp->m_peraglock); |
308 | agi->agi_newino = cpu_to_be32(newino); | 310 | agi->agi_newino = cpu_to_be32(newino); |
309 | /* | 311 | /* |
310 | * Insert records describing the new inode chunk into the btree. | 312 | * Insert records describing the new inode chunk into the btree. |
311 | */ | 313 | */ |
312 | cur = xfs_btree_init_cursor(args.mp, tp, agbp, | 314 | cur = xfs_btree_init_cursor(args.mp, tp, agbp, agno, |
313 | be32_to_cpu(agi->agi_seqno), | ||
314 | XFS_BTNUM_INO, (xfs_inode_t *)0, 0); | 315 | XFS_BTNUM_INO, (xfs_inode_t *)0, 0); |
315 | for (thisino = newino; | 316 | for (thisino = newino; |
316 | thisino < newino + newlen; | 317 | thisino < newino + newlen; |
@@ -1387,6 +1388,7 @@ xfs_ialloc_read_agi( | |||
1387 | pag = &mp->m_perag[agno]; | 1388 | pag = &mp->m_perag[agno]; |
1388 | if (!pag->pagi_init) { | 1389 | if (!pag->pagi_init) { |
1389 | pag->pagi_freecount = be32_to_cpu(agi->agi_freecount); | 1390 | pag->pagi_freecount = be32_to_cpu(agi->agi_freecount); |
1391 | pag->pagi_count = be32_to_cpu(agi->agi_count); | ||
1390 | pag->pagi_init = 1; | 1392 | pag->pagi_init = 1; |
1391 | } else { | 1393 | } else { |
1392 | /* | 1394 | /* |
@@ -1410,3 +1412,23 @@ xfs_ialloc_read_agi( | |||
1410 | *bpp = bp; | 1412 | *bpp = bp; |
1411 | return 0; | 1413 | return 0; |
1412 | } | 1414 | } |
1415 | |||
1416 | /* | ||
1417 | * Read in the agi to initialise the per-ag data in the mount structure | ||
1418 | */ | ||
1419 | int | ||
1420 | xfs_ialloc_pagi_init( | ||
1421 | xfs_mount_t *mp, /* file system mount structure */ | ||
1422 | xfs_trans_t *tp, /* transaction pointer */ | ||
1423 | xfs_agnumber_t agno) /* allocation group number */ | ||
1424 | { | ||
1425 | xfs_buf_t *bp = NULL; | ||
1426 | int error; | ||
1427 | |||
1428 | error = xfs_ialloc_read_agi(mp, tp, agno, &bp); | ||
1429 | if (error) | ||
1430 | return error; | ||
1431 | if (bp) | ||
1432 | xfs_trans_brelse(tp, bp); | ||
1433 | return 0; | ||
1434 | } | ||