Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 181789
b: refs/heads/master
c: 8b26c58
h: refs/heads/master
i:
  181787: ecd505e
v: v3
  • Loading branch information
Dave Chinner authored and Alex Elder committed Jan 15, 2010
1 parent 0efb77a commit 973600a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b657fc82a3ca6d7ad16a59e81765f0fb0e86cdbb
refs/heads/master: 8b26c5825e023b1bccac7afd174ebe55b8905cb1
21 changes: 17 additions & 4 deletions trunk/fs/xfs/xfs_mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,13 @@ xfs_initialize_perag(
xfs_agnumber_t *maxagi)
{
xfs_agnumber_t index, max_metadata;
xfs_agnumber_t first_initialised = 0;
xfs_perag_t *pag;
xfs_agino_t agino;
xfs_ino_t ino;
xfs_sb_t *sbp = &mp->m_sb;
xfs_ino_t max_inum = XFS_MAXINUMBER_32;
int error = -ENOMEM;

/* Check to see if the filesystem can overflow 32 bit inodes */
agino = XFS_OFFBNO_TO_AGINO(mp, sbp->sb_agblocks - 1, 0);
Expand All @@ -453,17 +455,20 @@ xfs_initialize_perag(
xfs_perag_put(pag);
continue;
}
if (!first_initialised)
first_initialised = index;
pag = kmem_zalloc(sizeof(*pag), KM_MAYFAIL);
if (!pag)
return -ENOMEM;
goto out_unwind;
if (radix_tree_preload(GFP_NOFS))
return -ENOMEM;
goto out_unwind;
spin_lock(&mp->m_perag_lock);
if (radix_tree_insert(&mp->m_perag_tree, index, pag)) {
BUG();
spin_unlock(&mp->m_perag_lock);
kmem_free(pag);
return -EEXIST;
radix_tree_preload_end();
error = -EEXIST;
goto out_unwind;
}
pag->pag_agno = index;
pag->pag_mount = mp;
Expand Down Expand Up @@ -523,6 +528,14 @@ xfs_initialize_perag(
if (maxagi)
*maxagi = index;
return 0;

out_unwind:
kmem_free(pag);
for (; index > first_initialised; index--) {
pag = radix_tree_delete(&mp->m_perag_tree, index);
kmem_free(pag);
}
return error;
}

void
Expand Down

0 comments on commit 973600a

Please sign in to comment.