ia64/xen-unstable

changeset 3996:8d624c9b6a90

bitkeeper revision 1.1236.1.64 (422c8a46Ahc4JfjN3Avhf5LSRWyn8g)

fix write-in-place problem -- radix tree wasn't returning writable bit on
lookups.

signed-off-by: andrew.warfield@cl.cam.ac.uk
author akw27@arcadians.cl.cam.ac.uk
date Mon Mar 07 17:07:18 2005 +0000 (2005-03-07)
parents 7d6b08b325ff
children 205e127344e9
files tools/blktap/parallax.c tools/blktap/radix.c tools/blktap/vdi.c tools/blktap/vdi_snap_list.c
line diff
     1.1 --- a/tools/blktap/parallax.c	Mon Mar 07 15:16:00 2005 +0000
     1.2 +++ b/tools/blktap/parallax.c	Mon Mar 07 17:07:18 2005 +0000
     1.3 @@ -390,9 +390,7 @@ int parallax_write(blkif_request_t *req,
     1.4                   blkif_first_sect(req->frame_and_sects[i]) + 1
     1.5                 ) << SECTOR_SHIFT;
     1.6          start = blkif_first_sect(req->frame_and_sects[i]) << SECTOR_SHIFT;
     1.7 -/*       
     1.8 -if (( gblock != 0 ) && ( writable == 0 )) printf("*");
     1.9 -*/
    1.10 +
    1.11          DPRINTF("ParallaxWrite: sect: %lld (%ld,%ld),  "
    1.12                  "vblock %llx, gblock %llx, "
    1.13                  "size %lx\n", 
    1.14 @@ -407,19 +405,19 @@ if (( gblock != 0 ) && ( writable == 0 )
    1.15              printf("]\n] STRANGE WRITE!\n]\n");
    1.16              goto err;
    1.17          }
    1.18 -/* Disable write-in-place till radix is sorted out.
    1.19 +
    1.20          if (( gblock == 0 ) || ( writable == 0 )) {
    1.21 -*/          
    1.22 +         
    1.23              gblock = allocblock(spage);
    1.24              vdi_update_block(vdi, vblock, gblock);
    1.25 -#if 0            
    1.26 +            
    1.27          } else {
    1.28              
    1.29              /* write-in-place, no need to change mappings. */
    1.30              writeblock(gblock, spage);
    1.31              
    1.32          }
    1.33 -#endif
    1.34 +
    1.35      }
    1.36  
    1.37      rsp = (blkif_response_t *)req;
     2.1 --- a/tools/blktap/radix.c	Mon Mar 07 15:16:00 2005 +0000
     2.2 +++ b/tools/blktap/radix.c	Mon Mar 07 17:07:18 2005 +0000
     2.3 @@ -76,6 +76,7 @@ radix_tree_node cloneblock(radix_tree_no
     2.4   */
     2.5  u64 lookup(int height, u64 root, u64 key) {
     2.6      radix_tree_node node;
     2.7 +    u64 mask = ONE;
     2.8      
     2.9      assert(key >> height == 0);
    2.10  
    2.11 @@ -101,10 +102,11 @@ u64 lookup(int height, u64 root, u64 key
    2.12              return ZERO;
    2.13  
    2.14          root = node[(key >> height) & RADIX_TREE_MAP_MASK];
    2.15 +        mask &= root;
    2.16          freeblock(node);
    2.17  
    2.18          if (height == 0)
    2.19 -            return root;
    2.20 +            return ( root & ONEMASK ) | mask;
    2.21  
    2.22          height -= RADIX_TREE_MAP_SHIFT;
    2.23      }
     3.1 --- a/tools/blktap/vdi.c	Mon Mar 07 15:16:00 2005 +0000
     3.2 +++ b/tools/blktap/vdi.c	Mon Mar 07 17:07:18 2005 +0000
     3.3 @@ -136,8 +136,6 @@ u64 vdi_lookup_block(vdi_t *vdi, u64 vdi
     3.4      gblock = lookup(VDI_HEIGHT, vdi->radix_root, vdi_block);
     3.5      
     3.6      if (writable != NULL) *writable = iswritable(gblock);
     3.7 -printf("lu: root: %11Ld, gblock: %11Ld, id: %11Ld, wr: %Ld\n",
     3.8 -        vdi->radix_root, gblock, getid(gblock), iswritable(gblock));
     3.9  
    3.10      return getid(gblock);
    3.11  }
     4.1 --- a/tools/blktap/vdi_snap_list.c	Mon Mar 07 15:16:00 2005 +0000
     4.2 +++ b/tools/blktap/vdi_snap_list.c	Mon Mar 07 17:07:18 2005 +0000
     4.3 @@ -49,8 +49,8 @@ int main(int argc, char *argv[])
     4.4      sid = vdi->snap;
     4.5      sid.index--;
     4.6      
     4.7 -    //printf("%6s%4s%21s %12s\n", "Block", "idx", "timestamp", "radix root");
     4.8 -    printf("%6s%4s%37s %12s\n", "Block", "idx", "timestamp", "radix root");
     4.9 +    //printf("%8s%4s%21s %12s\n", "Block", "idx", "timestamp", "radix root");
    4.10 +    printf("%8s%4s%37s %12s\n", "Block", "idx", "timestamp", "radix root");
    4.11       
    4.12      while (sid.block != 0) {
    4.13          blk = snap_get_block(sid.block);
    4.14 @@ -61,8 +61,8 @@ int main(int argc, char *argv[])
    4.15              }
    4.16              t = ctime(&blk->snaps[i].timestamp.tv_sec);
    4.17              t[strlen(t)-1] = '\0';
    4.18 -            //printf("%6Ld%4u%14lu.%06lu %12Ld\n",
    4.19 -            printf("%6Ld%4u%30s %06lu %12Ld\n",
    4.20 +            //printf("%8Ld%4u%14lu.%06lu %12Ld\n",
    4.21 +            printf("%8Ld%4u%30s %06lu %12Ld\n",
    4.22                      sid.block, i, 
    4.23                      //blk->snaps[i].timestamp.tv_sec,
    4.24                      t,