drm/ttm: use shmem_read_mapping_page
authorHugh Dickins <hughd@google.com>
Mon, 27 Jun 2011 23:18:17 +0000 (16:18 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 28 Jun 2011 01:00:13 +0000 (18:00 -0700)
Soon tmpfs will stop supporting ->readpage and read_mapping_page(): once
"tmpfs: add shmem_read_mapping_page_gfp" has been applied, this patch can
be applied to ease the transition.

ttm_tt_swapin() and ttm_tt_swapout() use shmem_read_mapping_page() in
place of read_mapping_page(), since their swap_space has been created with
shmem_file_setup().

Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/gpu/drm/ttm/ttm_tt.c

index 90e23e0bfadb054ffbcf8ee65c6cbac98881790a..58c271ebc0f73f6829dae7cffa9d680480ad0dd1 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/sched.h>
 #include <linux/highmem.h>
 #include <linux/pagemap.h>
+#include <linux/shmem_fs.h>
 #include <linux/file.h>
 #include <linux/swap.h>
 #include <linux/slab.h>
@@ -484,7 +485,7 @@ static int ttm_tt_swapin(struct ttm_tt *ttm)
        swap_space = swap_storage->f_path.dentry->d_inode->i_mapping;
 
        for (i = 0; i < ttm->num_pages; ++i) {
-               from_page = read_mapping_page(swap_space, i, NULL);
+               from_page = shmem_read_mapping_page(swap_space, i);
                if (IS_ERR(from_page)) {
                        ret = PTR_ERR(from_page);
                        goto out_err;
@@ -557,7 +558,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage)
                from_page = ttm->pages[i];
                if (unlikely(from_page == NULL))
                        continue;
-               to_page = read_mapping_page(swap_space, i, NULL);
+               to_page = shmem_read_mapping_page(swap_space, i);
                if (unlikely(IS_ERR(to_page))) {
                        ret = PTR_ERR(to_page);
                        goto out_err;