Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 37142
b: refs/heads/master
c: bb3c7d2
h: refs/heads/master
v: v3
  • Loading branch information
Nathan Scott authored and Tim Shimmin committed Sep 28, 2006
1 parent 2823763 commit b16579c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 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: 2627509330323efc88b5818065cba737e000de5c
refs/heads/master: bb3c7d2936b6db6f5ded9abf4d215abe97af8372
22 changes: 16 additions & 6 deletions trunk/fs/xfs/xfs_itable.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ xfs_bulkstat(
xfs_agino_t gino; /* current btree rec's start inode */
int i; /* loop index */
int icount; /* count of inodes good in irbuf */
int irbsize; /* size of irec buffer in bytes */
unsigned int kmflags; /* flags for allocating irec buffer */
xfs_ino_t ino; /* inode number (filesystem) */
xfs_inobt_rec_incore_t *irbp; /* current irec buffer pointer */
xfs_inobt_rec_incore_t *irbuf; /* start of irec buffer */
Expand Down Expand Up @@ -369,12 +371,20 @@ xfs_bulkstat(
nimask = ~(nicluster - 1);
nbcluster = nicluster >> mp->m_sb.sb_inopblog;
/*
* Allocate a page-sized buffer for inode btree records.
* We could try allocating something smaller, but for normal
* calls we'll always (potentially) need the whole page.
* Allocate a local buffer for inode cluster btree records.
* This caps our maximum readahead window (so don't be stingy)
* but we must handle the case where we can't get a contiguous
* multi-page buffer, so we drop back toward pagesize; the end
* case we ensure succeeds, via appropriate allocation flags.
*/
irbuf = kmem_alloc(NBPC, KM_SLEEP);
nirbuf = NBPC / sizeof(*irbuf);
irbsize = NBPP * 4;
kmflags = KM_SLEEP | KM_MAYFAIL;
while (!(irbuf = kmem_alloc(irbsize, kmflags))) {
if ((irbsize >>= 1) <= NBPP)
kmflags = KM_SLEEP;
}
nirbuf = irbsize / sizeof(*irbuf);

/*
* Loop over the allocation groups, starting from the last
* inode returned; 0 means start of the allocation group.
Expand Down Expand Up @@ -672,7 +682,7 @@ xfs_bulkstat(
/*
* Done, we're either out of filesystem or space to put the data.
*/
kmem_free(irbuf, NBPC);
kmem_free(irbuf, irbsize);
*ubcountp = ubelem;
if (agno >= mp->m_sb.sb_agcount) {
/*
Expand Down

0 comments on commit b16579c

Please sign in to comment.