1 |
/* A data structure to remember modifications to a memory region |
/* A data structure to remember modifications to a memory region |
2 |
|
|
3 |
Copyright (C) 1995 Free Software Foundation, Inc. |
Copyright (C) 1995, 1996, 2005 Free Software Foundation, Inc. |
4 |
|
|
5 |
Written by Miles Bader <miles@gnu.ai.mit.edu> |
Written by Miles Bader <miles@gnu.ai.mit.edu> |
6 |
|
|
67 |
vm_offset_t p_offs = pl->offset; |
vm_offset_t p_offs = pl->offset; |
68 |
vm_size_t p_end = p_offs + pl->length; |
vm_size_t p_end = p_offs + pl->length; |
69 |
|
|
70 |
if (p_offs == offset && p_end == end) |
if (p_offs <= offset && end <= p_end) |
71 |
break; |
{ |
72 |
|
if (pokel->image == disk_cache) |
73 |
|
for (vm_offset_t i = offset; i < end; i += block_size) |
74 |
|
buffer_put (disk_cache + i); |
75 |
|
|
76 |
|
break; |
77 |
|
} |
78 |
else if (p_end >= offset && end >= p_offs) |
else if (p_end >= offset && end >= p_offs) |
79 |
{ |
{ |
80 |
pl->offset = offset < p_offs ? offset : p_offs; |
pl->offset = offset < p_offs ? offset : p_offs; |
81 |
pl->length = (end > p_end ? end : p_end) - pl->offset; |
pl->length = (end > p_end ? end : p_end) - pl->offset; |
82 |
|
|
83 |
|
if (pokel->image == disk_cache) |
84 |
|
{ |
85 |
|
vm_offset_t i_begin = p_offs > offset ? p_offs : offset; |
86 |
|
vm_offset_t i_end = p_end < end ? p_end : end; |
87 |
|
for (vm_offset_t i = i_begin; i < i_end; i += block_size) |
88 |
|
buffer_put (disk_cache + i); |
89 |
|
} |
90 |
|
|
91 |
ext2_debug ("extended 0x%x[%ul] to 0x%x[%ul]", |
ext2_debug ("extended 0x%x[%ul] to 0x%x[%ul]", |
92 |
p_offs, p_end - p_offs, pl->offset, pl->length); |
p_offs, p_end - p_offs, pl->offset, pl->length); |
93 |
break; |
break; |
121 |
_pokel_exec (struct pokel *pokel, int sync, int wait) |
_pokel_exec (struct pokel *pokel, int sync, int wait) |
122 |
{ |
{ |
123 |
struct poke *pl, *pokes, *last = NULL; |
struct poke *pl, *pokes, *last = NULL; |
124 |
|
|
125 |
spin_lock (&pokel->lock); |
spin_lock (&pokel->lock); |
126 |
pokes = pokel->pokes; |
pokes = pokel->pokes; |
127 |
pokel->pokes = NULL; |
pokel->pokes = NULL; |
128 |
spin_unlock (&pokel->lock); |
spin_unlock (&pokel->lock); |
129 |
|
|
130 |
for (pl = pokes; pl; last = pl, pl = pl->next) |
for (pl = pokes; pl; last = pl, pl = pl->next) |
131 |
if (sync) |
{ |
132 |
{ |
if (sync) |
133 |
ext2_debug ("syncing 0x%x[%ul]", pl->offset, pl->length); |
{ |
134 |
pager_sync_some (pokel->pager, pl->offset, pl->length, wait); |
ext2_debug ("syncing 0x%x[%ul]", pl->offset, pl->length); |
135 |
} |
pager_sync_some (pokel->pager, pl->offset, pl->length, wait); |
136 |
|
} |
137 |
|
|
138 |
|
if (pokel->image == disk_cache) |
139 |
|
{ |
140 |
|
vm_offset_t begin = trunc_block (pl->offset); |
141 |
|
vm_offset_t end = round_block (pl->offset + pl->length); |
142 |
|
for (vm_offset_t i = begin; i != end; i += block_size) |
143 |
|
buffer_put (pokel->image + i); |
144 |
|
} |
145 |
|
} |
146 |
|
|
147 |
if (last) |
if (last) |
148 |
{ |
{ |