drm/ttm: use shmem_read_mapping_page
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>
This commit is contained in:
committed by
Linus Torvalds
parent
a39bce7bf6
commit
3142b651ad
@@ -31,6 +31,7 @@
|
|||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/highmem.h>
|
#include <linux/highmem.h>
|
||||||
#include <linux/pagemap.h>
|
#include <linux/pagemap.h>
|
||||||
|
#include <linux/shmem_fs.h>
|
||||||
#include <linux/file.h>
|
#include <linux/file.h>
|
||||||
#include <linux/swap.h>
|
#include <linux/swap.h>
|
||||||
#include <linux/slab.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;
|
swap_space = swap_storage->f_path.dentry->d_inode->i_mapping;
|
||||||
|
|
||||||
for (i = 0; i < ttm->num_pages; ++i) {
|
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)) {
|
if (IS_ERR(from_page)) {
|
||||||
ret = PTR_ERR(from_page);
|
ret = PTR_ERR(from_page);
|
||||||
goto out_err;
|
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];
|
from_page = ttm->pages[i];
|
||||||
if (unlikely(from_page == NULL))
|
if (unlikely(from_page == NULL))
|
||||||
continue;
|
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))) {
|
if (unlikely(IS_ERR(to_page))) {
|
||||||
ret = PTR_ERR(to_page);
|
ret = PTR_ERR(to_page);
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
Reference in New Issue
Block a user