--- rxdsk.c.orig	2011-10-29 16:08:05.000000000 -0500
+++ rxdsk.c	2011-10-29 16:11:38.000000000 -0500
@@ -85,7 +85,7 @@ MODULE_PARM_DESC(max_rxcnt, " Total RAM 
 static int read_proc(char *, char **, off_t, int, int *, void *);
 static int write_proc(struct file *, const char __user *, unsigned long, void *);
 static int rxdsk_do_bvec(struct rxdsk_device *, struct page *, unsigned int, unsigned int, int, sector_t);
-static int rxdsk_ioctl(struct block_device *, fmode_t, unsigned int, unsigned long);
+static int rxdsk_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
 static int rxdsk_make_request(struct request_queue *, struct bio *);
 static int attach_device(int, int); /* disk num, disk size */
 static int detach_device(int);      /* disk num */
@@ -400,15 +400,16 @@ rxdsk_make_request(struct request_queue 
     }
 
 out:
-    bio_endio(bio, err);
+    bio_endio(bio, bio->bi_size, err);
 
     return 0;
 } // rxdsk_make_request //
 
 
 static int
-rxdsk_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg){
+rxdsk_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg){
     loff_t size;
+    struct block_device *bdev = inode->i_bdev;
 
 #if defined (RxD_DEBUG)
     printk(KERN_DEBUG "rxdsk: debug: entering %s with cmd: %d\n", __func__, cmd);
@@ -424,7 +425,6 @@ rxdsk_ioctl(struct block_device *bdev, f
         case BLKGETSIZE64: {
             return copy_to_user ((void __user *)arg, &bdev->bd_inode->i_size, sizeof(bdev->bd_inode->i_size)) ? -EFAULT : 0;
         }
-        case BLKPBSZGET: 
         case BLKBSZGET: 
         case BLKSSZGET: {
             size = BYTES_PER_SECTOR;
@@ -438,7 +438,7 @@ rxdsk_ioctl(struct block_device *bdev, f
 } // rxdsk_ioctl //
 
 
-static const struct block_device_operations rxdsk_fops = {
+static struct block_device_operations rxdsk_fops = {
     .owner = THIS_MODULE,
     .ioctl = rxdsk_ioctl,
 };
@@ -472,7 +472,7 @@ attach_device(int num, int size){
     if(!rxdsk->rxdsk_queue)
         goto out_free_dev;
     blk_queue_make_request(rxdsk->rxdsk_queue, rxdsk_make_request);
-    blk_queue_logical_block_size (rxdsk->rxdsk_queue, BYTES_PER_SECTOR);
+    blk_queue_hardsect_size (rxdsk->rxdsk_queue, BYTES_PER_SECTOR);
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)
     blk_queue_flush(rxdsk->rxdsk_queue, REQ_FLUSH);
 #else
@@ -483,8 +483,6 @@ attach_device(int num, int size){
     rxdsk->rxdsk_queue->limits.discard_granularity = PAGE_SIZE;
     rxdsk->rxdsk_queue->limits.discard_zeroes_data = 1;
 #endif
-    rxdsk->rxdsk_queue->limits.max_discard_sectors = UINT_MAX;
-    queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, rxdsk->rxdsk_queue);
 
     if (!(disk = rxdsk->rxdsk_disk = alloc_disk (1)))
         goto out_free_queue;
