blob: 59c7d94545ea8730bfd184e58a628ab7e45b8d8d [file] [log] [blame]
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1614,7 +1614,13 @@ i915_gem_object_truncate(struct drm_i915
* backing pages, *now*.
*/
inode = file_inode(obj->base.filp);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0))
shmem_truncate_range(inode, 0, (loff_t)-1);
+#else
+ truncate_inode_pages(inode->i_mapping, 0);
+ if (inode->i_op->truncate_range)
+ inode->i_op->truncate_range(inode, 0, (loff_t)-1);
+#endif
obj->madv = __I915_MADV_PURGED;
}