Automatic merge with /usr/src/ntfs-2.6.git
[sfrench/cifs-2.6.git] / fs / buffer.c
index 6f2c3303a443f05adc535596d84bcf8032c3d04e..7e9e409feaa744d13e471c1209318a0a9ef138d3 100644 (file)
@@ -1210,7 +1210,7 @@ grow_buffers(struct block_device *bdev, sector_t block, int size)
        return 1;
 }
 
-struct buffer_head *
+static struct buffer_head *
 __getblk_slow(struct block_device *bdev, sector_t block, int size)
 {
        /* Size must be multiple of hard sectorsize */
@@ -1751,7 +1751,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
        int err;
        sector_t block;
        sector_t last_block;
-       struct buffer_head *bh, *head, *last_bh = NULL;
+       struct buffer_head *bh, *head;
        int nr_underway = 0;
 
        BUG_ON(!PageLocked(page));
@@ -1826,7 +1826,6 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
                }
                if (test_clear_buffer_dirty(bh)) {
                        mark_buffer_async_write(bh);
-                       last_bh = bh;
                } else {
                        unlock_buffer(bh);
                }
@@ -1844,12 +1843,9 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
                if (buffer_async_write(bh)) {
                        submit_bh(WRITE, bh);
                        nr_underway++;
-                       if (bh == last_bh)
-                               break;
                }
                bh = next;
        } while (bh != head);
-       bh = head;
        unlock_page(page);
 
        err = 0;
@@ -1892,7 +1888,6 @@ recover:
                if (buffer_mapped(bh) && buffer_dirty(bh)) {
                        lock_buffer(bh);
                        mark_buffer_async_write(bh);
-                       last_bh = bh;
                } else {
                        /*
                         * The buffer may have been set dirty during
@@ -1911,12 +1906,9 @@ recover:
                        clear_buffer_dirty(bh);
                        submit_bh(WRITE, bh);
                        nr_underway++;
-                       if (bh == last_bh)
-                               break;
                }
                bh = next;
        } while (bh != head);
-       bh = head;
        goto done;
 }
 
@@ -2102,9 +2094,12 @@ int block_read_full_page(struct page *page, get_block_t *get_block)
                        continue;
 
                if (!buffer_mapped(bh)) {
+                       int err = 0;
+
                        fully_mapped = 0;
                        if (iblock < lblock) {
-                               if (get_block(inode, iblock, bh, 0))
+                               err = get_block(inode, iblock, bh, 0);
+                               if (err)
                                        SetPageError(page);
                        }
                        if (!buffer_mapped(bh)) {
@@ -2112,7 +2107,8 @@ int block_read_full_page(struct page *page, get_block_t *get_block)
                                memset(kaddr + i * blocksize, 0, blocksize);
                                flush_dcache_page(page);
                                kunmap_atomic(kaddr, KM_USER0);
-                               set_buffer_uptodate(bh);
+                               if (!err)
+                                       set_buffer_uptodate(bh);
                                continue;
                        }
                        /*