mtd/drivers/mtd/devices blkmtd-25.c,1.5,1.6

David Woodhouse dwmw2 at infradead.org
Thu Jul 15 11:09:18 EDT 2004


Update of /home/cvs/mtd/drivers/mtd/devices
In directory phoenix.infradead.org:/tmp/cvs-serv5470

Modified Files:
	blkmtd-25.c 
Log Message:
Merge from 2.6

Index: blkmtd-25.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/devices/blkmtd-25.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- blkmtd-25.c	16 Jul 2003 06:48:27 -0000	1.5
+++ blkmtd-25.c	15 Jul 2004 15:09:15 -0000	1.6
@@ -98,7 +98,7 @@
 	if (bio->bi_size)
 		return 1;
 
-	if(!uptodate) 
+	if(!uptodate)
 		err("bi_write_complete: not uptodate\n");
 
 	do {
@@ -123,7 +123,7 @@
 }
 
 
-/* read one page from the block device */                 
+/* read one page from the block device */
 static int blkmtd_readpage(struct blkmtd_dev *dev, struct page *page)
 {
 	struct bio *bio;
@@ -147,8 +147,7 @@
 		bio->bi_private = &event;
 		bio->bi_end_io = bi_read_complete;
 		if(bio_add_page(bio, page, PAGE_SIZE, 0) == PAGE_SIZE) {
-			submit_bio(READ, bio);
-			blk_run_queues();
+			submit_bio(READ_SYNC, bio);
 			wait_for_completion(&event);
 			err = test_bit(BIO_UPTODATE, &bio->bi_flags) ? 0 : -EIO;
 			bio_put(bio);
@@ -179,13 +178,12 @@
 	init_completion(&event);
 	bio->bi_private = &event;
 	bio->bi_end_io = bi_write_complete;
-	submit_bio(WRITE, bio);
-	blk_run_queues();
+	submit_bio(WRITE_SYNC, bio);
 	wait_for_completion(&event);
 	DEBUG(3, "submit_bio completed, bi_vcnt = %d\n", bio->bi_vcnt);
 	err = test_bit(BIO_UPTODATE, &bio->bi_flags) ? 0 : -EIO;
 	bio_put(bio);
-	return err; 
+	return err;
 }
 
 
@@ -550,7 +548,7 @@
 
 		if(dev->blkdev) {
 			invalidate_inode_pages(dev->blkdev->bd_inode->i_mapping);
-			close_bdev_excl(dev->blkdev, BDEV_RAW);
+			close_bdev_excl(dev->blkdev);
 		}
 		kfree(dev);
 	}
@@ -637,10 +635,10 @@
 
 #ifdef MODULE
 	mode = (readonly) ? O_RDONLY : O_RDWR;
-	bdev = open_bdev_excl(devname, mode, BDEV_RAW, NULL);
+	bdev = open_bdev_excl(devname, mode, NULL);
 #else
 	mode = (readonly) ? FMODE_READ : FMODE_WRITE;
-	bdev = open_by_devnum(name_to_dev_t(devname), mode, BDEV_RAW);
+	bdev = open_by_devnum(name_to_dev_t(devname), mode);
 #endif
 	if(IS_ERR(bdev)) {
 		err("error: cannot open device %s", devname);
@@ -653,22 +651,23 @@
 
 	if(MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
 		err("attempting to use an MTD device as a block device");
-		blkdev_put(bdev, BDEV_RAW);
+		blkdev_put(bdev);
 		return NULL;
 	}
 
 	dev = kmalloc(sizeof(struct blkmtd_dev), GFP_KERNEL);
 	if(dev == NULL) {
-		blkdev_put(bdev, BDEV_RAW);
+		blkdev_put(bdev);
 		return NULL;
 	}
 
 	memset(dev, 0, sizeof(struct blkmtd_dev));
+	dev->blkdev = bdev;
+	atomic_set(&(dev->blkdev->bd_inode->i_mapping->truncate_count), 0);
 	if(!readonly) {
 		init_MUTEX(&dev->wrbuf_mutex);
 	}
 
-	dev->blkdev = bdev;
 	dev->mtd_info.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
 
 	/* Setup the MTD structure */





More information about the linux-mtd-cvs mailing list