/[hurd]/hurd/ext2fs/pokel.c
ViewVC logotype

Diff of /hurd/ext2fs/pokel.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by miles, Mon Jan 15 22:28:56 1996 UTC revision 1.15.2.1 by ams, Thu Aug 25 18:34:18 2005 UTC
# Line 1  Line 1 
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    
# Line 67  pokel_add (struct pokel *pokel, void *lo Line 67  pokel_add (struct pokel *pokel, void *lo
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;
# Line 106  void Line 121  void
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      {      {

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.15.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26