include/asm-x86/voyager.h: checkpatch cleanups - formatting only
[sfrench/cifs-2.6.git] / mm / page_io.c
index d4840ecbf8f9358e1dfc5918802f3604e1f06b93..065c4480eaf0905c8631732540a118c002989f09 100644 (file)
@@ -44,14 +44,11 @@ static struct bio *get_swap_bio(gfp_t gfp_flags, pgoff_t index,
        return bio;
 }
 
-static int end_swap_bio_write(struct bio *bio, unsigned int bytes_done, int err)
+static void end_swap_bio_write(struct bio *bio, int err)
 {
        const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
        struct page *page = bio->bi_io_vec[0].bv_page;
 
-       if (bio->bi_size)
-               return 1;
-
        if (!uptodate) {
                SetPageError(page);
                /*
@@ -71,17 +68,13 @@ static int end_swap_bio_write(struct bio *bio, unsigned int bytes_done, int err)
        }
        end_page_writeback(page);
        bio_put(bio);
-       return 0;
 }
 
-int end_swap_bio_read(struct bio *bio, unsigned int bytes_done, int err)
+void end_swap_bio_read(struct bio *bio, int err)
 {
        const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
        struct page *page = bio->bi_io_vec[0].bv_page;
 
-       if (bio->bi_size)
-               return 1;
-
        if (!uptodate) {
                SetPageError(page);
                ClearPageUptodate(page);
@@ -94,7 +87,6 @@ int end_swap_bio_read(struct bio *bio, unsigned int bytes_done, int err)
        }
        unlock_page(page);
        bio_put(bio);
-       return 0;
 }
 
 /*
@@ -134,7 +126,7 @@ int swap_readpage(struct file *file, struct page *page)
        int ret = 0;
 
        BUG_ON(!PageLocked(page));
-       ClearPageUptodate(page);
+       BUG_ON(PageUptodate(page));
        bio = get_swap_bio(GFP_KERNEL, page_private(page), page,
                                end_swap_bio_read);
        if (bio == NULL) {
@@ -147,48 +139,3 @@ int swap_readpage(struct file *file, struct page *page)
 out:
        return ret;
 }
-
-#ifdef CONFIG_SOFTWARE_SUSPEND
-/*
- * A scruffy utility function to read or write an arbitrary swap page
- * and wait on the I/O.  The caller must have a ref on the page.
- *
- * We use end_swap_bio_read() even for writes, because it happens to do what
- * we want.
- */
-int rw_swap_page_sync(int rw, swp_entry_t entry, struct page *page,
-                       struct bio **bio_chain)
-{
-       struct bio *bio;
-       int ret = 0;
-       int bio_rw;
-
-       lock_page(page);
-
-       bio = get_swap_bio(GFP_KERNEL, entry.val, page, end_swap_bio_read);
-       if (bio == NULL) {
-               unlock_page(page);
-               ret = -ENOMEM;
-               goto out;
-       }
-
-       bio_rw = rw;
-       if (!bio_chain)
-               bio_rw |= (1 << BIO_RW_SYNC);
-       if (bio_chain)
-               bio_get(bio);
-       submit_bio(bio_rw, bio);
-       if (bio_chain == NULL) {
-               wait_on_page_locked(page);
-
-               if (!PageUptodate(page) || PageError(page))
-                       ret = -EIO;
-       }
-       if (bio_chain) {
-               bio->bi_private = *bio_chain;
-               *bio_chain = bio;
-       }
-out:
-       return ret;
-}
-#endif