Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174699
b: refs/heads/master
c: b34a650
h: refs/heads/master
i:
  174697: 43ace53
  174695: a3a8851
v: v3
  • Loading branch information
Ryusuke Konishi committed Nov 20, 2009
1 parent 73d9bd6 commit d44b7a8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 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: ef7d4757a5b7b07a3a0d30d3ba6b587e574b28b9
refs/heads/master: b34a65069caa56b691ebab5ae0b8e54d16406d16
28 changes: 15 additions & 13 deletions trunk/fs/nilfs2/mdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff,
}

static int nilfs_mdt_read_block(struct inode *inode, unsigned long block,
struct buffer_head **out_bh)
int readahead, struct buffer_head **out_bh)
{
struct buffer_head *first_bh, *bh;
unsigned long blkoff;
Expand All @@ -200,16 +200,18 @@ static int nilfs_mdt_read_block(struct inode *inode, unsigned long block,
if (unlikely(err))
goto failed;

blkoff = block + 1;
for (i = 0; i < nr_ra_blocks; i++, blkoff++) {
err = nilfs_mdt_submit_block(inode, blkoff, READA, &bh);
if (likely(!err || err == -EEXIST))
brelse(bh);
else if (err != -EBUSY)
break; /* abort readahead if bmap lookup failed */

if (!buffer_locked(first_bh))
goto out_no_wait;
if (readahead) {
blkoff = block + 1;
for (i = 0; i < nr_ra_blocks; i++, blkoff++) {
err = nilfs_mdt_submit_block(inode, blkoff, READA, &bh);
if (likely(!err || err == -EEXIST))
brelse(bh);
else if (err != -EBUSY)
break;
/* abort readahead if bmap lookup failed */
if (!buffer_locked(first_bh))
goto out_no_wait;
}
}

wait_on_buffer(first_bh);
Expand Down Expand Up @@ -263,7 +265,7 @@ int nilfs_mdt_get_block(struct inode *inode, unsigned long blkoff, int create,

/* Should be rewritten with merging nilfs_mdt_read_block() */
retry:
ret = nilfs_mdt_read_block(inode, blkoff, out_bh);
ret = nilfs_mdt_read_block(inode, blkoff, !create, out_bh);
if (!create || ret != -ENOENT)
return ret;

Expand Down Expand Up @@ -371,7 +373,7 @@ int nilfs_mdt_mark_block_dirty(struct inode *inode, unsigned long block)
struct buffer_head *bh;
int err;

err = nilfs_mdt_read_block(inode, block, &bh);
err = nilfs_mdt_read_block(inode, block, 0, &bh);
if (unlikely(err))
return err;
nilfs_mark_buffer_dirty(bh);
Expand Down

0 comments on commit d44b7a8

Please sign in to comment.