ia64/xen-unstable

changeset 6371:9dc059239e2a

Remove blkback 2.4 support since we don't support 2.4 dom0 anymore.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue Aug 23 17:51:57 2005 +0000 (2005-08-23)
parents d760699356fd
children e21f101cc054 5f39234a9ac4
files linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c linux-2.6-xen-sparse/drivers/xen/blkback/common.h linux-2.6-xen-sparse/drivers/xen/blkback/interface.c linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Tue Aug 23 17:33:11 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Tue Aug 23 17:51:57 2005 +0000
     1.3 @@ -65,9 +65,6 @@ typedef unsigned int PEND_RING_IDX;
     1.4  static PEND_RING_IDX pending_prod, pending_cons;
     1.5  #define NR_PENDING_REQS (MAX_PENDING_REQS - pending_prod + pending_cons)
     1.6  
     1.7 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
     1.8 -static kmem_cache_t *buffer_head_cachep;
     1.9 -#else
    1.10  static request_queue_t *plugged_queue;
    1.11  static inline void flush_plugged_queue(void)
    1.12  {
    1.13 @@ -80,7 +77,6 @@ static inline void flush_plugged_queue(v
    1.14          plugged_queue = NULL;
    1.15      }
    1.16  }
    1.17 -#endif
    1.18  
    1.19  /* When using grant tables to map a frame for device access then the
    1.20   * handle returned must be used to unmap the frame. This is needed to
    1.21 @@ -184,11 +180,7 @@ static int blkio_schedule(void *arg)
    1.22      blkif_t          *blkif;
    1.23      struct list_head *ent;
    1.24  
    1.25 -    daemonize(
    1.26 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
    1.27 -        "xenblkd"
    1.28 -#endif
    1.29 -        );
    1.30 +    daemonize("xenblkd");
    1.31  
    1.32      for ( ; ; )
    1.33      {
    1.34 @@ -215,11 +207,7 @@ static int blkio_schedule(void *arg)
    1.35          }
    1.36  
    1.37          /* Push the batch through to disc. */
    1.38 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
    1.39 -        run_task_queue(&tq_disk);
    1.40 -#else
    1.41          flush_plugged_queue();
    1.42 -#endif
    1.43      }
    1.44  }
    1.45  
    1.46 @@ -268,13 +256,6 @@ static void __end_block_io_op(pending_re
    1.47      }
    1.48  }
    1.49  
    1.50 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
    1.51 -static void end_block_io_op(struct buffer_head *bh, int uptodate)
    1.52 -{
    1.53 -    __end_block_io_op(bh->b_private, uptodate);
    1.54 -    kmem_cache_free(buffer_head_cachep, bh);
    1.55 -}
    1.56 -#else
    1.57  static int end_block_io_op(struct bio *bio, unsigned int done, int error)
    1.58  {
    1.59      if ( bio->bi_size != 0 )
    1.60 @@ -283,7 +264,6 @@ static int end_block_io_op(struct bio *b
    1.61      bio_put(bio);
    1.62      return error;
    1.63  }
    1.64 -#endif
    1.65  
    1.66  
    1.67  /******************************************************************************
    1.68 @@ -357,13 +337,9 @@ static void dispatch_rw_block_io(blkif_t
    1.69          unsigned long buf; unsigned int nsec;
    1.70      } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
    1.71      unsigned int nseg;
    1.72 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
    1.73 -    struct buffer_head *bh;
    1.74 -#else
    1.75      struct bio *bio = NULL, *biolist[BLKIF_MAX_SEGMENTS_PER_REQUEST];
    1.76      int nbio = 0;
    1.77      request_queue_t *q;
    1.78 -#endif
    1.79  
    1.80      /* Check that number of segments is sane. */
    1.81      nseg = req->nr_segments;
    1.82 @@ -435,49 +411,6 @@ static void dispatch_rw_block_io(blkif_t
    1.83      pending_req->status    = BLKIF_RSP_OKAY;
    1.84      pending_req->nr_pages  = nseg;
    1.85  
    1.86 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
    1.87 -
    1.88 -    atomic_set(&pending_req->pendcnt, nseg);
    1.89 -    pending_cons++;
    1.90 -    blkif_get(blkif);
    1.91 -
    1.92 -    for ( i = 0; i < nseg; i++ )
    1.93 -    {
    1.94 -        bh = kmem_cache_alloc(buffer_head_cachep, GFP_KERNEL);
    1.95 -        if ( unlikely(bh == NULL) )
    1.96 -        {
    1.97 -            __end_block_io_op(pending_req, 0);
    1.98 -            continue;
    1.99 -        }
   1.100 -
   1.101 -        memset(bh, 0, sizeof (struct buffer_head));
   1.102 -
   1.103 -        init_waitqueue_head(&bh->b_wait);
   1.104 -        bh->b_size          = seg[i].nsec << 9;
   1.105 -        bh->b_dev           = preq.dev;
   1.106 -        bh->b_rdev          = preq.dev;
   1.107 -        bh->b_rsector       = (unsigned long)preq.sector_number;
   1.108 -        bh->b_data          = (char *)MMAP_VADDR(pending_idx, i) +
   1.109 -            (seg[i].buf & ~PAGE_MASK);
   1.110 -        bh->b_page          = virt_to_page(MMAP_VADDR(pending_idx, i));
   1.111 -        bh->b_end_io        = end_block_io_op;
   1.112 -        bh->b_private       = pending_req;
   1.113 -
   1.114 -        bh->b_state = (1 << BH_Mapped) | (1 << BH_Lock) | 
   1.115 -            (1 << BH_Req) | (1 << BH_Launder);
   1.116 -        if ( operation == WRITE )
   1.117 -            bh->b_state |= (1 << BH_JBD) | (1 << BH_Req) | (1 << BH_Uptodate);
   1.118 -
   1.119 -        atomic_set(&bh->b_count, 1);
   1.120 -
   1.121 -        /* Dispatch a single request. We'll flush it to disc later. */
   1.122 -        generic_make_request(operation, bh);
   1.123 -
   1.124 -        preq.sector_number += seg[i].nsec;
   1.125 -    }
   1.126 -
   1.127 -#else
   1.128 -
   1.129      for ( i = 0; i < nseg; i++ )
   1.130      {
   1.131          if ( ((int)preq.sector_number|(int)seg[i].nsec) &
   1.132 @@ -526,8 +459,6 @@ static void dispatch_rw_block_io(blkif_t
   1.133      for ( i = 0; i < nbio; i++ )
   1.134          submit_bio(operation, biolist[i]);
   1.135  
   1.136 -#endif
   1.137 -
   1.138      return;
   1.139  
   1.140   bad_descriptor:
   1.141 @@ -595,12 +526,6 @@ static int __init blkif_init(void)
   1.142      if ( kernel_thread(blkio_schedule, 0, CLONE_FS | CLONE_FILES) < 0 )
   1.143          BUG();
   1.144  
   1.145 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
   1.146 -    buffer_head_cachep = kmem_cache_create(
   1.147 -        "buffer_head_cache", sizeof(struct buffer_head),
   1.148 -        0, SLAB_HWCACHE_ALIGN, NULL, NULL);
   1.149 -#endif
   1.150 -
   1.151      blkif_xenbus_init();
   1.152  
   1.153      memset( pending_grant_handles,  BLKBACK_INVALID_HANDLE, MMAP_PAGES );
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h	Tue Aug 23 17:33:11 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h	Tue Aug 23 17:51:57 2005 +0000
     2.3 @@ -29,10 +29,6 @@
     2.4  #define DPRINTK(_f, _a...) ((void)0)
     2.5  #endif
     2.6  
     2.7 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
     2.8 -struct block_device;
     2.9 -#endif
    2.10 -
    2.11  struct vbd {
    2.12      blkif_vdev_t   handle;      /* what the domain refers to this vbd as */
    2.13      unsigned char  readonly;    /* Non-zero -> read-only */
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Tue Aug 23 17:33:11 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Tue Aug 23 17:51:57 2005 +0000
     3.3 @@ -9,10 +9,6 @@
     3.4  #include "common.h"
     3.5  #include <asm-xen/evtchn.h>
     3.6  
     3.7 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     3.8 -#define VMALLOC_VMADDR(x) ((unsigned long)(x))
     3.9 -#endif
    3.10 -
    3.11  static kmem_cache_t *blkif_cachep;
    3.12  
    3.13  blkif_t *alloc_blkif(domid_t domid)
    3.14 @@ -76,7 +72,7 @@ int blkif_map(blkif_t *blkif, unsigned l
    3.15      if ( (vma = get_vm_area(PAGE_SIZE, VM_IOREMAP)) == NULL )
    3.16  	return -ENOMEM;
    3.17  
    3.18 -    err = map_frontend_page(blkif, VMALLOC_VMADDR(vma->addr), shared_page);
    3.19 +    err = map_frontend_page(blkif, (unsigned long)vma->addr, shared_page);
    3.20      if (err) {
    3.21          vfree(vma->addr);
    3.22  	return err;
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c	Tue Aug 23 17:33:11 2005 +0000
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c	Tue Aug 23 17:51:57 2005 +0000
     4.3 @@ -9,7 +9,6 @@
     4.4  #include "common.h"
     4.5  #include <asm-xen/xenbus.h>
     4.6  
     4.7 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     4.8  static inline dev_t vbd_map_devnum(blkif_pdev_t cookie)
     4.9  {
    4.10      return MKDEV(BLKIF_MAJOR(cookie), BLKIF_MINOR(cookie));
    4.11 @@ -17,11 +16,6 @@ static inline dev_t vbd_map_devnum(blkif
    4.12  #define vbd_sz(_v)   ((_v)->bdev->bd_part ? \
    4.13      (_v)->bdev->bd_part->nr_sects : (_v)->bdev->bd_disk->capacity)
    4.14  #define bdev_put(_b) blkdev_put(_b)
    4.15 -#else
    4.16 -#define vbd_sz(_v)   (blk_size[MAJOR((_v)->pdevice)][MINOR((_v)->pdevice)]*2)
    4.17 -#define bdev_put(_b) ((void)0)
    4.18 -#define bdev_hardsect_size(_b) 512
    4.19 -#endif
    4.20  
    4.21  unsigned long vbd_size(struct vbd *vbd)
    4.22  {
    4.23 @@ -56,7 +50,6 @@ int vbd_create(blkif_t *blkif, blkif_vde
    4.24  
    4.25      vbd->pdevice  = pdevice;
    4.26  
    4.27 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
    4.28      vbd->bdev = open_by_devnum(
    4.29          vbd_map_devnum(vbd->pdevice),
    4.30          vbd->readonly ? FMODE_READ : FMODE_WRITE);
    4.31 @@ -77,13 +70,6 @@ int vbd_create(blkif_t *blkif, blkif_vde
    4.32          vbd->type |= VDISK_CDROM;
    4.33      if ( vbd->bdev->bd_disk->flags & GENHD_FL_REMOVABLE )
    4.34          vbd->type |= VDISK_REMOVABLE;
    4.35 -#else
    4.36 -    if ( (blk_size[MAJOR(vbd->pdevice)] == NULL) || (vbd_sz(vbd) == 0) )
    4.37 -    {
    4.38 -        DPRINTK("vbd_creat: device %08x doesn't exist.\n", vbd->pdevice);
    4.39 -        return -ENOENT;
    4.40 -    }
    4.41 -#endif
    4.42  
    4.43      DPRINTK("Successful creation of handle=%04x (dom=%u)\n",
    4.44              handle, blkif->domid);