Subject: Re: [resend take 3 0/4] Distributed storage.

From: Frederik Deweerdt <[email-masked]>
Date: Wed, 26 Nov 2008 00:47:07 +0100

Hello Evgeniy,

The attached patch is needed to compile against 2.6.28-rc6 (changes in
block_devices_operations), I added a few cleanups as well.

Regards,
Frederik

Signed-off-by: Frederik Deweerdt <[email-masked]>
diff --git a/drivers/block/dst/dcore.c b/drivers/block/dst/dcore.c
index fea201b..cd84435 100644
--- a/drivers/block/dst/dcore.c
+++ b/drivers/block/dst/dcore.c
@@ -109,17 +109,17 @@ static int dst_request(struct request_queue *q, struct bio *bio)
 /*
  * Open/close callbacks for appropriate block device.
  */
-static int dst_bdev_open(struct inode *inode, struct file *filp)
+static int dst_bdev_open(struct block_device *bdev, fmode_t mode)
 {
-	struct dst_node *n = inode->i_bdev->bd_disk->private_data;
+	struct dst_node *n = bdev->bd_disk->private_data;
 
 	dst_node_get(n);
 	return 0;
 }
 
-static int dst_bdev_release(struct inode *inode, struct file *filp)
+static int dst_bdev_release(struct gendisk *disk, fmode_t mode)
 {
-	struct dst_node *n = inode->i_bdev->bd_disk->private_data;
+	struct dst_node *n = disk->private_data;
 
 	dst_node_put(n);
 	return 0;
@@ -377,7 +377,7 @@ static void dst_node_cleanup(struct dst_node *n)
 
 	if (n->bdev) {
 		sync_blockdev(n->bdev);
-		blkdev_put(n->bdev);
+		blkdev_put(n->bdev, FMODE_READ|FMODE_WRITE);
 	}
 
 	dst_state_lock(st);
@@ -502,7 +502,7 @@ static int dst_setup_export(struct dst_node *n, struct dst_ctl *ctl,
 	return 0;
 
 err_out_cleanup:
-	blkdev_put(n->bdev);
+	blkdev_put(n->bdev, FMODE_READ|FMODE_WRITE);
 	n->bdev = NULL;
 
 	return err;
diff --git a/drivers/block/dst/export.c b/drivers/block/dst/export.c
index c6bb0a5..122fe75 100644
--- a/drivers/block/dst/export.c
+++ b/drivers/block/dst/export.c
@@ -271,13 +271,13 @@ static void dst_state_cleanup_export(struct dst_state *st)
 
 			if (p)
 				bio_put(p->bio);
-			
+
 			dprintk("%s: st: %p, refcnt: %d, list_empty: %d, p: %p.\n",
 				__func__, st, atomic_read(&st->refcnt),
 				list_empty(&st->request_list), p);
 		}
 	}
-	
+
 	dst_state_put(st);
 }
 
@@ -288,14 +288,14 @@ static void dst_state_cleanup_export(struct dst_state *st)
  */
 static int dst_accept(void *init_data, void *schedule_data)
 {
-	struct dst_state *main = schedule_data;
+	struct dst_state *main_st = schedule_data;
 	struct dst_node *n = init_data;
 	struct dst_state *st;
 	int err;
 
-	while (n->trans_scan_timeout && !main->need_exit) {
-		dprintk("%s: main: %p, n: %p.\n", __func__, main, n);
-		st = dst_accept_client(main);
+	while (n->trans_scan_timeout && !main_st->need_exit) {
+		dprintk("%s: main_st: %p, n: %p.\n", __func__, main_st, n);
+		st = dst_accept_client(main_st);
 		if (IS_ERR(st))
 			continue;
 
@@ -326,14 +326,14 @@ static int dst_accept(void *init_data, void *schedule_data)
 		dst_state_cleanup_export(st);
 	}
 
-	dprintk("%s: freeing listening socket st: %p.\n", __func__, main);
-	
-	dst_state_lock(main);
-	dst_poll_exit(main);
-	dst_state_socket_release(main);
-	dst_state_unlock(main);
-	dst_state_put(main);
-	dprintk("%s: freed listening socket st: %p.\n", __func__, main);
+	dprintk("%s: freeing listening socket st: %p.\n", __func__, main_st);
+
+	dst_state_lock(main_st);
+	dst_poll_exit(main_st);
+	dst_state_socket_release(main_st);
+	dst_state_unlock(main_st);
+	dst_state_put(main_st);
+	dprintk("%s: freed listening socket st: %p.\n", __func__, main_st);
 
 	return 0;
 }