aboutsummaryrefslogtreecommitdiffstats
path: root/fs/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/buffer.c')
-rw-r--r--fs/buffer.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 1ad674fd348c..f99c509697cd 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -78,6 +78,7 @@ EXPORT_SYMBOL(__lock_buffer);
78 78
79void fastcall unlock_buffer(struct buffer_head *bh) 79void fastcall unlock_buffer(struct buffer_head *bh)
80{ 80{
81 smp_mb__before_clear_bit();
81 clear_buffer_locked(bh); 82 clear_buffer_locked(bh);
82 smp_mb__after_clear_bit(); 83 smp_mb__after_clear_bit();
83 wake_up_bit(&bh->b_state, BH_Lock); 84 wake_up_bit(&bh->b_state, BH_Lock);
@@ -345,7 +346,7 @@ void invalidate_bdev(struct block_device *bdev, int destroy_dirty_buffers)
345 * We really want to use invalidate_inode_pages2() for 346 * We really want to use invalidate_inode_pages2() for
346 * that, but not until that's cleaned up. 347 * that, but not until that's cleaned up.
347 */ 348 */
348 invalidate_inode_pages(mapping); 349 invalidate_mapping_pages(mapping, 0, -1);
349} 350}
350 351
351/* 352/*
@@ -1282,11 +1283,11 @@ static void bh_lru_install(struct buffer_head *bh)
1282 * Look up the bh in this cpu's LRU. If it's there, move it to the head. 1283 * Look up the bh in this cpu's LRU. If it's there, move it to the head.
1283 */ 1284 */
1284static struct buffer_head * 1285static struct buffer_head *
1285lookup_bh_lru(struct block_device *bdev, sector_t block, int size) 1286lookup_bh_lru(struct block_device *bdev, sector_t block, unsigned size)
1286{ 1287{
1287 struct buffer_head *ret = NULL; 1288 struct buffer_head *ret = NULL;
1288 struct bh_lru *lru; 1289 struct bh_lru *lru;
1289 int i; 1290 unsigned int i;
1290 1291
1291 check_irqs_on(); 1292 check_irqs_on();
1292 bh_lru_lock(); 1293 bh_lru_lock();
@@ -1318,7 +1319,7 @@ lookup_bh_lru(struct block_device *bdev, sector_t block, int size)
1318 * NULL 1319 * NULL
1319 */ 1320 */
1320struct buffer_head * 1321struct buffer_head *
1321__find_get_block(struct block_device *bdev, sector_t block, int size) 1322__find_get_block(struct block_device *bdev, sector_t block, unsigned size)
1322{ 1323{
1323 struct buffer_head *bh = lookup_bh_lru(bdev, block, size); 1324 struct buffer_head *bh = lookup_bh_lru(bdev, block, size);
1324 1325
@@ -1346,7 +1347,7 @@ EXPORT_SYMBOL(__find_get_block);
1346 * attempt is failing. FIXME, perhaps? 1347 * attempt is failing. FIXME, perhaps?
1347 */ 1348 */
1348struct buffer_head * 1349struct buffer_head *
1349__getblk(struct block_device *bdev, sector_t block, int size) 1350__getblk(struct block_device *bdev, sector_t block, unsigned size)
1350{ 1351{
1351 struct buffer_head *bh = __find_get_block(bdev, block, size); 1352 struct buffer_head *bh = __find_get_block(bdev, block, size);
1352 1353
@@ -1360,7 +1361,7 @@ EXPORT_SYMBOL(__getblk);
1360/* 1361/*
1361 * Do async read-ahead on a buffer.. 1362 * Do async read-ahead on a buffer..
1362 */ 1363 */
1363void __breadahead(struct block_device *bdev, sector_t block, int size) 1364void __breadahead(struct block_device *bdev, sector_t block, unsigned size)
1364{ 1365{
1365 struct buffer_head *bh = __getblk(bdev, block, size); 1366 struct buffer_head *bh = __getblk(bdev, block, size);
1366 if (likely(bh)) { 1367 if (likely(bh)) {
@@ -1380,7 +1381,7 @@ EXPORT_SYMBOL(__breadahead);
1380 * It returns NULL if the block was unreadable. 1381 * It returns NULL if the block was unreadable.
1381 */ 1382 */
1382struct buffer_head * 1383struct buffer_head *
1383__bread(struct block_device *bdev, sector_t block, int size) 1384__bread(struct block_device *bdev, sector_t block, unsigned size)
1384{ 1385{
1385 struct buffer_head *bh = __getblk(bdev, block, size); 1386 struct buffer_head *bh = __getblk(bdev, block, size);
1386 1387
@@ -1439,6 +1440,7 @@ static void discard_buffer(struct buffer_head * bh)
1439 clear_buffer_req(bh); 1440 clear_buffer_req(bh);
1440 clear_buffer_new(bh); 1441 clear_buffer_new(bh);
1441 clear_buffer_delay(bh); 1442 clear_buffer_delay(bh);
1443 clear_buffer_unwritten(bh);
1442 unlock_buffer(bh); 1444 unlock_buffer(bh);
1443} 1445}
1444 1446
@@ -1822,6 +1824,7 @@ static int __block_prepare_write(struct inode *inode, struct page *page,
1822 continue; 1824 continue;
1823 } 1825 }
1824 if (!buffer_uptodate(bh) && !buffer_delay(bh) && 1826 if (!buffer_uptodate(bh) && !buffer_delay(bh) &&
1827 !buffer_unwritten(bh) &&
1825 (block_start < from || block_end > to)) { 1828 (block_start < from || block_end > to)) {
1826 ll_rw_block(READ, 1, &bh); 1829 ll_rw_block(READ, 1, &bh);
1827 *wait_bh++=bh; 1830 *wait_bh++=bh;
@@ -2543,7 +2546,7 @@ int block_truncate_page(struct address_space *mapping,
2543 if (PageUptodate(page)) 2546 if (PageUptodate(page))
2544 set_buffer_uptodate(bh); 2547 set_buffer_uptodate(bh);
2545 2548
2546 if (!buffer_uptodate(bh) && !buffer_delay(bh)) { 2549 if (!buffer_uptodate(bh) && !buffer_delay(bh) && !buffer_unwritten(bh)) {
2547 err = -EIO; 2550 err = -EIO;
2548 ll_rw_block(READ, 1, &bh); 2551 ll_rw_block(READ, 1, &bh);
2549 wait_on_buffer(bh); 2552 wait_on_buffer(bh);