i915: Call aops write_begin() and write_end() directly

pagecache_write_begin() and pagecache_write_end() are now trivial
wrappers, so call the aops directly.
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 6e0ee044
...@@ -408,6 +408,7 @@ shmem_pwrite(struct drm_i915_gem_object *obj, ...@@ -408,6 +408,7 @@ shmem_pwrite(struct drm_i915_gem_object *obj,
const struct drm_i915_gem_pwrite *arg) const struct drm_i915_gem_pwrite *arg)
{ {
struct address_space *mapping = obj->base.filp->f_mapping; struct address_space *mapping = obj->base.filp->f_mapping;
const struct address_space_operations *aops = mapping->a_ops;
char __user *user_data = u64_to_user_ptr(arg->data_ptr); char __user *user_data = u64_to_user_ptr(arg->data_ptr);
u64 remain, offset; u64 remain, offset;
unsigned int pg; unsigned int pg;
...@@ -465,8 +466,7 @@ shmem_pwrite(struct drm_i915_gem_object *obj, ...@@ -465,8 +466,7 @@ shmem_pwrite(struct drm_i915_gem_object *obj,
if (err) if (err)
return err; return err;
err = pagecache_write_begin(obj->base.filp, mapping, err = aops->write_begin(obj->base.filp, mapping, offset, len,
offset, len, 0,
&page, &data); &page, &data);
if (err < 0) if (err < 0)
return err; return err;
...@@ -477,9 +477,8 @@ shmem_pwrite(struct drm_i915_gem_object *obj, ...@@ -477,9 +477,8 @@ shmem_pwrite(struct drm_i915_gem_object *obj,
len); len);
kunmap_atomic(vaddr); kunmap_atomic(vaddr);
err = pagecache_write_end(obj->base.filp, mapping, err = aops->write_end(obj->base.filp, mapping, offset, len,
offset, len, len - unwritten, len - unwritten, page, data);
page, data);
if (err < 0) if (err < 0)
return err; return err;
...@@ -622,6 +621,7 @@ i915_gem_object_create_shmem_from_data(struct drm_i915_private *dev_priv, ...@@ -622,6 +621,7 @@ i915_gem_object_create_shmem_from_data(struct drm_i915_private *dev_priv,
{ {
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
struct file *file; struct file *file;
const struct address_space_operations *aops;
resource_size_t offset; resource_size_t offset;
int err; int err;
...@@ -633,14 +633,14 @@ i915_gem_object_create_shmem_from_data(struct drm_i915_private *dev_priv, ...@@ -633,14 +633,14 @@ i915_gem_object_create_shmem_from_data(struct drm_i915_private *dev_priv,
GEM_BUG_ON(obj->write_domain != I915_GEM_DOMAIN_CPU); GEM_BUG_ON(obj->write_domain != I915_GEM_DOMAIN_CPU);
file = obj->base.filp; file = obj->base.filp;
aops = file->f_mapping->a_ops;
offset = 0; offset = 0;
do { do {
unsigned int len = min_t(typeof(size), size, PAGE_SIZE); unsigned int len = min_t(typeof(size), size, PAGE_SIZE);
struct page *page; struct page *page;
void *pgdata, *vaddr; void *pgdata, *vaddr;
err = pagecache_write_begin(file, file->f_mapping, err = aops->write_begin(file, file->f_mapping, offset, len,
offset, len, 0,
&page, &pgdata); &page, &pgdata);
if (err < 0) if (err < 0)
goto fail; goto fail;
...@@ -649,8 +649,7 @@ i915_gem_object_create_shmem_from_data(struct drm_i915_private *dev_priv, ...@@ -649,8 +649,7 @@ i915_gem_object_create_shmem_from_data(struct drm_i915_private *dev_priv,
memcpy(vaddr, data, len); memcpy(vaddr, data, len);
kunmap(page); kunmap(page);
err = pagecache_write_end(file, file->f_mapping, err = aops->write_end(file, file->f_mapping, offset, len, len,
offset, len, len,
page, pgdata); page, pgdata);
if (err < 0) if (err < 0)
goto fail; goto fail;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment