176 int locked = 0;
177
178 count = read_seqcount_begin(&xip_sparse_seq);
179
180 page = __xip_sparse_page;
181 if (!page)
182 return;
183
184retry:
185 spin_lock(&mapping->i_mmap_lock);
186 vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) {
187 mm = vma->vm_mm;
188 address = vma->vm_start +
189 ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
190 BUG_ON(address < vma->vm_start || address >= vma->vm_end);
191 pte = page_check_address(page, mm, address, &ptl, 1);
192 if (pte) {
193
194 flush_cache_page(vma, address, pte_pfn(*pte));
195 pteval = ptep_clear_flush_notify(vma, address, pte);
196 page_remove_rmap(page, vma);
197 dec_mm_counter(mm, file_rss);
198 BUG_ON(pte_dirty(pteval));
199 pte_unmap_unlock(pte, ptl);
200 page_cache_release(page);
201 }
202 }
203 spin_unlock(&mapping->i_mmap_lock);
204
205 if (locked) {
206 mutex_unlock(&xip_sparse_mutex);
207 } else if (read_seqcount_retry(&xip_sparse_seq, count)) {
208 mutex_lock(&xip_sparse_mutex);
209 locked = 1;
210 goto retry;
211 }
212}
213
214
215
216