aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/buffer.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 75cac9ada026..35fa34977e81 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1478,8 +1478,10 @@ EXPORT_SYMBOL(__getblk);
1478void __breadahead(struct block_device *bdev, sector_t block, int size) 1478void __breadahead(struct block_device *bdev, sector_t block, int size)
1479{ 1479{
1480 struct buffer_head *bh = __getblk(bdev, block, size); 1480 struct buffer_head *bh = __getblk(bdev, block, size);
1481 ll_rw_block(READA, 1, &bh); 1481 if (likely(bh)) {
1482 brelse(bh); 1482 ll_rw_block(READA, 1, &bh);
1483 brelse(bh);
1484 }
1483} 1485}
1484EXPORT_SYMBOL(__breadahead); 1486EXPORT_SYMBOL(__breadahead);
1485 1487
@@ -1497,7 +1499,7 @@ __bread(struct block_device *bdev, sector_t block, int size)
1497{ 1499{
1498 struct buffer_head *bh = __getblk(bdev, block, size); 1500 struct buffer_head *bh = __getblk(bdev, block, size);
1499 1501
1500 if (!buffer_uptodate(bh)) 1502 if (likely(bh) && !buffer_uptodate(bh))
1501 bh = __bread_slow(bh); 1503 bh = __bread_slow(bh);
1502 return bh; 1504 return bh;
1503} 1505}