aboutsummaryrefslogtreecommitdiffstats
path: root/mm/fremap.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-11-29 17:03:14 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-29 17:03:14 -0500
commitc9cfcddfd65735437a4cb8563d6b66a6da8a5ed6 (patch)
tree618cdf37baafe8b283bcc9923d9dde89d6428fb5 /mm/fremap.c
parent4168f7a31801bba6acc18662978d24ec850bbbd0 (diff)
VM: add common helper function to create the page tables
This logic was duplicated four times, for no good reason. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/fremap.c')
-rw-r--r--mm/fremap.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/mm/fremap.c b/mm/fremap.c
index f851775e09c2..9f381e58bf44 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -55,20 +55,10 @@ int install_page(struct mm_struct *mm, struct vm_area_struct *vma,
55 pgoff_t size; 55 pgoff_t size;
56 int err = -ENOMEM; 56 int err = -ENOMEM;
57 pte_t *pte; 57 pte_t *pte;
58 pmd_t *pmd;
59 pud_t *pud;
60 pgd_t *pgd;
61 pte_t pte_val; 58 pte_t pte_val;
62 spinlock_t *ptl; 59 spinlock_t *ptl;
63 60
64 pgd = pgd_offset(mm, addr); 61 pte = get_locked_pte(mm, addr, &ptl);
65 pud = pud_alloc(mm, pgd, addr);
66 if (!pud)
67 goto out;
68 pmd = pmd_alloc(mm, pud, addr);
69 if (!pmd)
70 goto out;
71 pte = pte_alloc_map_lock(mm, pmd, addr, &ptl);
72 if (!pte) 62 if (!pte)
73 goto out; 63 goto out;
74 64
@@ -110,20 +100,10 @@ int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma,
110{ 100{
111 int err = -ENOMEM; 101 int err = -ENOMEM;
112 pte_t *pte; 102 pte_t *pte;
113 pmd_t *pmd;
114 pud_t *pud;
115 pgd_t *pgd;
116 pte_t pte_val; 103 pte_t pte_val;
117 spinlock_t *ptl; 104 spinlock_t *ptl;
118 105
119 pgd = pgd_offset(mm, addr); 106 pte = get_locked_pte(mm, addr, &ptl);
120 pud = pud_alloc(mm, pgd, addr);
121 if (!pud)
122 goto out;
123 pmd = pmd_alloc(mm, pud, addr);
124 if (!pmd)
125 goto out;
126 pte = pte_alloc_map_lock(mm, pmd, addr, &ptl);
127 if (!pte) 107 if (!pte)
128 goto out; 108 goto out;
129 109