Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 195793
b: refs/heads/master
c: 6881a22
h: refs/heads/master
i:
  195791: 6632f96
v: v3
  • Loading branch information
Alex Elder committed May 19, 2010
1 parent 64245cf commit 34174e0
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: a0e856b0b4d182c4c52b568bd04bd96a172247a7
refs/heads/master: 6881a229f66f74e4e0a73504389695213987955b
21 changes: 17 additions & 4 deletions trunk/fs/xfs/xfs_log_recover.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ STATIC void xlog_recover_check_summary(xlog_t *);
((bbs + (log)->l_sectbb_mask + 1) & ~(log)->l_sectbb_mask) : (bbs) )
#define XLOG_SECTOR_ROUNDDOWN_BLKNO(log, bno) ((bno) & ~(log)->l_sectbb_mask)

/* Number of basic blocks in a log sector */
#define xlog_sectbb(log) (1 << (log)->l_sectbb_log)

STATIC xfs_buf_t *
xlog_get_bp(
xlog_t *log,
Expand Down Expand Up @@ -376,12 +379,16 @@ xlog_find_verify_cycle(
xfs_caddr_t buf = NULL;
int error = 0;

/*
* Greedily allocate a buffer big enough to handle the full
* range of basic blocks we'll be examining. If that fails,
* try a smaller size. We need to be able to read at least
* a log sector, or we're out of luck.
*/
bufblks = 1 << ffs(nbblks);

while (!(bp = xlog_get_bp(log, bufblks))) {
/* can't get enough memory to do everything in one big buffer */
bufblks >>= 1;
if (bufblks <= log->l_sectbb_log)
if (bufblks < xlog_sectbb(log))
return ENOMEM;
}

Expand Down Expand Up @@ -1158,10 +1165,16 @@ xlog_write_log_records(
int error = 0;
int i, j = 0;

/*
* Greedily allocate a buffer big enough to handle the full
* range of basic blocks to be written. If that fails, try
* a smaller size. We need to be able to write at least a
* log sector, or we're out of luck.
*/
bufblks = 1 << ffs(blocks);
while (!(bp = xlog_get_bp(log, bufblks))) {
bufblks >>= 1;
if (bufblks <= log->l_sectbb_log)
if (bufblks < xlog_sectbb(log))
return ENOMEM;
}

Expand Down

0 comments on commit 34174e0

Please sign in to comment.