mm/mmap.c: remove the first mapping check

Remove the first mapping check for vma_link.  Move the mutex_lock into the
braces when vma->vm_file is true.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Huang Shijie 2014-06-04 16:07:33 -07:00 committed by syphyr
parent 67771bea33
commit 283fc8f680

View file

@ -667,11 +667,10 @@ static void vma_link(struct mm_struct *mm, struct vm_area_struct *vma,
{ {
struct address_space *mapping = NULL; struct address_space *mapping = NULL;
if (vma->vm_file) if (vma->vm_file) {
mapping = vma->vm_file->f_mapping; mapping = vma->vm_file->f_mapping;
if (mapping)
mutex_lock(&mapping->i_mmap_mutex); mutex_lock(&mapping->i_mmap_mutex);
}
__vma_link(mm, vma, prev, rb_link, rb_parent); __vma_link(mm, vma, prev, rb_link, rb_parent);
__vma_link_file(vma); __vma_link_file(vma);