From: John Stultz <john.stultz@xxxxxxxxxx> Like with the mm_struct, this patch adds basic support for volatile ranges on file address_space structures. This allows for volatile ranges to be set on mmapped files that can be shared between processes. The semantics on the volatile range sharing is that the volatility is shared, just as the data is shared. Thus if one process marks the range as volatile, the data is volatile in all processes that have those pages mapped. It is advised that processes coordinate when using volatile ranges on shared mappings (much as they must coordinate when writing to shared data). Cc: Dave Chinner <david@xxxxxxxxxxxxx> Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Mel Gorman <mel@xxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Dave Hansen <dave.hansen@xxxxxxxxx> Cc: Rik van Riel <riel@xxxxxxxxxx> Cc: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxx> Cc: Michel Lespinasse <walken@xxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx> Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx> --- fs/inode.c | 4 ++++ include/linux/fs.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/fs/inode.c b/fs/inode.c index b33ba8e021cc..b029472134ea 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -18,6 +18,7 @@ #include <linux/buffer_head.h> /* for inode_has_buffers */ #include <linux/ratelimit.h> #include <linux/list_lru.h> +#include <linux/vrange.h> #include "internal.h" /* @@ -353,6 +354,7 @@ void address_space_init_once(struct address_space *mapping) spin_lock_init(&mapping->private_lock); mapping->i_mmap = RB_ROOT; INIT_LIST_HEAD(&mapping->i_mmap_nonlinear); + vrange_root_init(&mapping->vroot, VRANGE_FILE, mapping); } EXPORT_SYMBOL(address_space_init_once); @@ -1388,6 +1390,8 @@ static void iput_final(struct inode *inode) inode_lru_list_del(inode); spin_unlock(&inode->i_lock); + vrange_root_cleanup(&inode->i_mapping->vroot); + evict(inode); } diff --git a/include/linux/fs.h b/include/linux/fs.h index 3f40547ba191..19b70288e219 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -29,6 +29,7 @@ #include <linux/lockdep.h> #include <linux/percpu-rwsem.h> #include <linux/blk_types.h> +#include <linux/vrange_types.h> #include <asm/byteorder.h> #include <uapi/linux/fs.h> @@ -414,6 +415,9 @@ struct address_space { struct rb_root i_mmap; /* tree of private and shared mappings */ struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ struct mutex i_mmap_mutex; /* protect tree, count, list */ +#ifdef CONFIG_MMU + struct vrange_root vroot; +#endif /* Protected by tree_lock together with the radix tree */ unsigned long nrpages; /* number of total pages */ pgoff_t writeback_index;/* writeback starts here */ -- 1.7.9.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>