Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 311848
b: refs/heads/master
c: 91f68c8
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Moyer authored and Linus Torvalds committed Jul 13, 2012
1 parent f74cf85 commit e4dad83
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 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: 918227bb1b59444a2c467711fd50cc22bb4a897b
refs/heads/master: 91f68c89d8f35fe98ea04159b9a3b42d0149478f
22 changes: 13 additions & 9 deletions trunk/fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,9 @@ grow_buffers(struct block_device *bdev, sector_t block, int size)
static struct buffer_head *
__getblk_slow(struct block_device *bdev, sector_t block, int size)
{
int ret;
struct buffer_head *bh;

/* Size must be multiple of hard sectorsize */
if (unlikely(size & (bdev_logical_block_size(bdev)-1) ||
(size < 512 || size > PAGE_SIZE))) {
Expand All @@ -1048,20 +1051,21 @@ __getblk_slow(struct block_device *bdev, sector_t block, int size)
return NULL;
}

for (;;) {
struct buffer_head * bh;
int ret;
retry:
bh = __find_get_block(bdev, block, size);
if (bh)
return bh;

ret = grow_buffers(bdev, block, size);
if (ret == 0) {
free_more_memory();
goto retry;
} else if (ret > 0) {
bh = __find_get_block(bdev, block, size);
if (bh)
return bh;

ret = grow_buffers(bdev, block, size);
if (ret < 0)
return NULL;
if (ret == 0)
free_more_memory();
}
return NULL;
}

/*
Expand Down

0 comments on commit e4dad83

Please sign in to comment.