-
-static void ll_close_vma(struct vm_area_struct *vma)
-{
- struct inode *inode = vma->vm_file->f_dentry->d_inode;
- struct address_space *mapping = inode->i_mapping;
- unsigned long next, size, end;
- struct ll_async_page *llap;
- struct obd_export *exp;
- struct pagevec pvec;
- int i;
-
- if (!(vma->vm_flags & VM_SHARED))
- return;
-
- /* all pte's are synced to mem_map by the moment
- * we scan backing store and put all dirty pages
- * onto pending list to track flushing */
-
- LASSERT(LLI_DIRTY_HANDLE(inode));
- exp = ll_i2dtexp(inode);
- if (exp == NULL) {
- CERROR("can't get export for the inode\n");
- return;
- }
-
- pagevec_init(&pvec, 0);
- next = vma->vm_pgoff;
- size = (vma->vm_end - vma->vm_start) / PAGE_SIZE;
- end = next + size - 1;
-
- CDEBUG(D_INODE, "close vma 0x%p[%lu/%lu/%lu from %lu/%u]\n", vma,
- next, size, end, inode->i_ino, inode->i_generation);
-
- while (next <= end && pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) {
- for (i = 0; i < pagevec_count(&pvec); i++) {
- struct page *page = pvec.pages[i];
-
- if (page->index > next)
- next = page->index;
- if (next > end)
- continue;
- next++;
-
- lock_page(page);
- if (page->mapping != mapping || !PageDirty(page)) {
- unlock_page(page);
- continue;
- }
-
- llap = llap_from_page(page, LLAP_ORIGIN_COMMIT_WRITE);
- if (IS_ERR(llap)) {
- CERROR("can't get llap\n");
- unlock_page(page);
- continue;
- }
-
- llap_write_pending(inode, llap);
- unlock_page(page);
- }
- pagevec_release(&pvec);
- }
-}
-