NLM: Ensure that nlmclnt_cancel_callback() doesn't loop forever
[pandora-kernel.git] / fs / mpage.c
index 32c7c8f..e431cb3 100644 (file)
@@ -79,15 +79,18 @@ static int mpage_end_io_write(struct bio *bio, unsigned int bytes_done, int err)
                if (--bvec >= bio->bi_io_vec)
                        prefetchw(&bvec->bv_page->flags);
 
-               if (!uptodate)
+               if (!uptodate){
                        SetPageError(page);
+                       if (page->mapping)
+                               set_bit(AS_EIO, &page->mapping->flags);
+               }
                end_page_writeback(page);
        } while (bvec >= bio->bi_io_vec);
        bio_put(bio);
        return 0;
 }
 
-struct bio *mpage_bio_submit(int rw, struct bio *bio)
+static struct bio *mpage_bio_submit(int rw, struct bio *bio)
 {
        bio->bi_end_io = mpage_end_io_read;
        if (rw == WRITE)
@@ -99,7 +102,7 @@ struct bio *mpage_bio_submit(int rw, struct bio *bio)
 static struct bio *
 mpage_alloc(struct block_device *bdev,
                sector_t first_sector, int nr_vecs,
-               unsigned int __nocast gfp_flags)
+               gfp_t gfp_flags)
 {
        struct bio *bio;
 
@@ -181,7 +184,7 @@ do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages,
        if (page_has_buffers(page))
                goto confused;
 
-       block_in_file = page->index << (PAGE_CACHE_SHIFT - blkbits);
+       block_in_file = (sector_t)page->index << (PAGE_CACHE_SHIFT - blkbits);
        last_block = (i_size_read(inode) + blocksize - 1) >> blkbits;
 
        bh.b_page = page;
@@ -463,7 +466,7 @@ __mpage_writepage(struct bio *bio, struct page *page, get_block_t get_block,
         * The page has no buffers: map it to disk
         */
        BUG_ON(!PageUptodate(page));
-       block_in_file = page->index << (PAGE_CACHE_SHIFT - blkbits);
+       block_in_file = (sector_t)page->index << (PAGE_CACHE_SHIFT - blkbits);
        last_block = (i_size - 1) >> blkbits;
        map_bh.b_page = page;
        for (page_block = 0; page_block < blocks_per_page; ) {
@@ -626,15 +629,6 @@ out:
 int
 mpage_writepages(struct address_space *mapping,
                struct writeback_control *wbc, get_block_t get_block)
-{
-       return __mpage_writepages(mapping, wbc, get_block,
-               mapping->a_ops->writepage);
-}
-
-int
-__mpage_writepages(struct address_space *mapping,
-               struct writeback_control *wbc, get_block_t get_block,
-               writepage_t writepage_fn)
 {
        struct backing_dev_info *bdi = mapping->backing_dev_info;
        struct bio *bio = NULL;
@@ -725,9 +719,9 @@ retry:
                        } else {
                                bio = __mpage_writepage(bio, page, get_block,
                                                &last_block_in_bio, &ret, wbc,
-                                               writepage_fn);
+                                               page->mapping->a_ops->writepage);
                        }
-                       if (unlikely(ret == WRITEPAGE_ACTIVATE))
+                       if (unlikely(ret == AOP_WRITEPAGE_ACTIVATE))
                                unlock_page(page);
                        if (ret || (--(wbc->nr_to_write) <= 0))
                                done = 1;
@@ -755,7 +749,6 @@ retry:
        return ret;
 }
 EXPORT_SYMBOL(mpage_writepages);
-EXPORT_SYMBOL(__mpage_writepages);
 
 int mpage_writepage(struct page *page, get_block_t get_block,
        struct writeback_control *wbc)