diff options
author | Wanpeng Li <liwanp@linux.vnet.ibm.com> | 2013-09-11 17:22:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-11 18:58:02 -0400 |
commit | 762216ab4e175f49d17bc7ad778c57b9028184e6 (patch) | |
tree | e7b2fa9eede0285cf270ad7ce798241ed351fe06 /mm/vmalloc.c | |
parent | 7d9f073b8da45a894bb7148433bd84d21eed6757 (diff) |
mm/vmalloc: use wrapper function get_vm_area_size to caculate size of vm area
Use wrapper function get_vm_area_size to calculate size of vm area.
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Fengguang Wu <fengguang.wu@intel.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: David Rientjes <rientjes@google.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r-- | mm/vmalloc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 93d3182c3300..107454312d5e 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -1258,7 +1258,7 @@ void unmap_kernel_range(unsigned long addr, unsigned long size) | |||
1258 | int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages) | 1258 | int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages) |
1259 | { | 1259 | { |
1260 | unsigned long addr = (unsigned long)area->addr; | 1260 | unsigned long addr = (unsigned long)area->addr; |
1261 | unsigned long end = addr + area->size - PAGE_SIZE; | 1261 | unsigned long end = addr + get_vm_area_size(area); |
1262 | int err; | 1262 | int err; |
1263 | 1263 | ||
1264 | err = vmap_page_range(addr, end, prot, *pages); | 1264 | err = vmap_page_range(addr, end, prot, *pages); |
@@ -1553,7 +1553,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, | |||
1553 | unsigned int nr_pages, array_size, i; | 1553 | unsigned int nr_pages, array_size, i; |
1554 | gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO; | 1554 | gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO; |
1555 | 1555 | ||
1556 | nr_pages = (area->size - PAGE_SIZE) >> PAGE_SHIFT; | 1556 | nr_pages = get_vm_area_size(area) >> PAGE_SHIFT; |
1557 | array_size = (nr_pages * sizeof(struct page *)); | 1557 | array_size = (nr_pages * sizeof(struct page *)); |
1558 | 1558 | ||
1559 | area->nr_pages = nr_pages; | 1559 | area->nr_pages = nr_pages; |
@@ -1985,7 +1985,7 @@ long vread(char *buf, char *addr, unsigned long count) | |||
1985 | 1985 | ||
1986 | vm = va->vm; | 1986 | vm = va->vm; |
1987 | vaddr = (char *) vm->addr; | 1987 | vaddr = (char *) vm->addr; |
1988 | if (addr >= vaddr + vm->size - PAGE_SIZE) | 1988 | if (addr >= vaddr + get_vm_area_size(vm)) |
1989 | continue; | 1989 | continue; |
1990 | while (addr < vaddr) { | 1990 | while (addr < vaddr) { |
1991 | if (count == 0) | 1991 | if (count == 0) |
@@ -1995,7 +1995,7 @@ long vread(char *buf, char *addr, unsigned long count) | |||
1995 | addr++; | 1995 | addr++; |
1996 | count--; | 1996 | count--; |
1997 | } | 1997 | } |
1998 | n = vaddr + vm->size - PAGE_SIZE - addr; | 1998 | n = vaddr + get_vm_area_size(vm) - addr; |
1999 | if (n > count) | 1999 | if (n > count) |
2000 | n = count; | 2000 | n = count; |
2001 | if (!(vm->flags & VM_IOREMAP)) | 2001 | if (!(vm->flags & VM_IOREMAP)) |
@@ -2067,7 +2067,7 @@ long vwrite(char *buf, char *addr, unsigned long count) | |||
2067 | 2067 | ||
2068 | vm = va->vm; | 2068 | vm = va->vm; |
2069 | vaddr = (char *) vm->addr; | 2069 | vaddr = (char *) vm->addr; |
2070 | if (addr >= vaddr + vm->size - PAGE_SIZE) | 2070 | if (addr >= vaddr + get_vm_area_size(vm)) |
2071 | continue; | 2071 | continue; |
2072 | while (addr < vaddr) { | 2072 | while (addr < vaddr) { |
2073 | if (count == 0) | 2073 | if (count == 0) |
@@ -2076,7 +2076,7 @@ long vwrite(char *buf, char *addr, unsigned long count) | |||
2076 | addr++; | 2076 | addr++; |
2077 | count--; | 2077 | count--; |
2078 | } | 2078 | } |
2079 | n = vaddr + vm->size - PAGE_SIZE - addr; | 2079 | n = vaddr + get_vm_area_size(vm) - addr; |
2080 | if (n > count) | 2080 | if (n > count) |
2081 | n = count; | 2081 | n = count; |
2082 | if (!(vm->flags & VM_IOREMAP)) { | 2082 | if (!(vm->flags & VM_IOREMAP)) { |