Merge remote-tracking branch 'asoc/fix/si476x' into asoc-next
[firefly-linux-kernel-4.4.55.git] / mm / hugetlb.c
index cdb64e4d238acb2f4a9ae8629adffc59e52c0a1f..ca9a7c6d7e973c5db4bbecd7e72139d5c9529b72 100644 (file)
@@ -127,7 +127,7 @@ static inline struct hugepage_subpool *subpool_inode(struct inode *inode)
 
 static inline struct hugepage_subpool *subpool_vma(struct vm_area_struct *vma)
 {
-       return subpool_inode(vma->vm_file->f_dentry->d_inode);
+       return subpool_inode(file_inode(vma->vm_file));
 }
 
 /*
@@ -2124,8 +2124,12 @@ int hugetlb_report_node_meminfo(int nid, char *buf)
 /* Return the number pages of memory we physically have, in PAGE_SIZE units. */
 unsigned long hugetlb_total_pages(void)
 {
-       struct hstate *h = &default_hstate;
-       return h->nr_huge_pages * pages_per_huge_page(h);
+       struct hstate *h;
+       unsigned long nr_total_pages = 0;
+
+       for_each_hstate(h)
+               nr_total_pages += h->nr_huge_pages * pages_per_huge_page(h);
+       return nr_total_pages;
 }
 
 static int hugetlb_acct_memory(struct hstate *h, long delta)
@@ -2479,7 +2483,7 @@ static int unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma,
        address = address & huge_page_mask(h);
        pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) +
                        vma->vm_pgoff;
-       mapping = vma->vm_file->f_dentry->d_inode->i_mapping;
+       mapping = file_inode(vma->vm_file)->i_mapping;
 
        /*
         * Take the mapping lock for the duration of the table walk. As