mirror of
https://github.com/drasko/codezero.git
synced 2026-03-01 02:03:29 +01:00
Fixed 2 bugs in vma_merge_object().
Looks like it had never been called before.
This commit is contained in:
@@ -148,7 +148,7 @@ int vma_merge_object(struct vm_object *redundant)
|
|||||||
/* The redundant shadow object */
|
/* The redundant shadow object */
|
||||||
struct vm_object *front; /* Shadow in front of redundant */
|
struct vm_object *front; /* Shadow in front of redundant */
|
||||||
struct vm_obj_link *last_link;
|
struct vm_obj_link *last_link;
|
||||||
struct page *p1, *p2;
|
struct page *p1, *p2, *n;
|
||||||
|
|
||||||
/* Check link and shadow count is really 1 */
|
/* Check link and shadow count is really 1 */
|
||||||
BUG_ON(redundant->nlinks != 1);
|
BUG_ON(redundant->nlinks != 1);
|
||||||
@@ -159,10 +159,10 @@ int vma_merge_object(struct vm_object *redundant)
|
|||||||
struct vm_object, shref);
|
struct vm_object, shref);
|
||||||
|
|
||||||
/* Move all non-intersecting pages to front shadow. */
|
/* Move all non-intersecting pages to front shadow. */
|
||||||
list_for_each_entry(p1, &redundant->page_cache, list) {
|
list_for_each_entry_safe(p1, n, &redundant->page_cache, list) {
|
||||||
/* Page doesn't exist in front, move it there */
|
/* Page doesn't exist in front, move it there */
|
||||||
if (!(p2 = find_page(front, p1->offset))) {
|
if (!(p2 = find_page(front, p1->offset))) {
|
||||||
list_del(&p1->list);
|
list_del_init(&p1->list);
|
||||||
spin_lock(&p1->lock);
|
spin_lock(&p1->lock);
|
||||||
p1->owner = front;
|
p1->owner = front;
|
||||||
spin_unlock(&p1->lock);
|
spin_unlock(&p1->lock);
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ int insert_page_olist(struct page *this, struct vm_object *vmo)
|
|||||||
list_add_tail(&this->list, &vmo->page_cache);
|
list_add_tail(&this->list, &vmo->page_cache);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Else find the right interval */
|
/* Else find the right interval */
|
||||||
list_for_each_entry(before, &vmo->page_cache, list) {
|
list_for_each_entry(before, &vmo->page_cache, list) {
|
||||||
after = list_entry(before->list.next, struct page, list);
|
after = list_entry(before->list.next, struct page, list);
|
||||||
|
|||||||
Reference in New Issue
Block a user