X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/4363af719caa631efcf827b9074df44f6066b023..c89ed64561aae9407492da7bbfbbd14b49add8bb:/target/linux/generic-2.6/patches-2.6.27/065-rootfs_split.patch diff --git a/target/linux/generic-2.6/patches-2.6.27/065-rootfs_split.patch b/target/linux/generic-2.6/patches-2.6.27/065-rootfs_split.patch index aff95ccec..c05d79181 100644 --- a/target/linux/generic-2.6/patches-2.6.27/065-rootfs_split.patch +++ b/target/linux/generic-2.6/patches-2.6.27/065-rootfs_split.patch @@ -373,57 +373,53 @@ return err; } -@@ -210,7 +246,12 @@ static int block2mtd_write(struct mtd_in +@@ -210,52 +246,29 @@ static int block2mtd_write(struct mtd_in static void block2mtd_sync(struct mtd_info *mtd) { struct block2mtd_dev *dev = mtd->priv; - sync_blockdev(dev->blkdev); -+ -+ read_lock(&dev->bdev_mutex); -+ if (dev->blkdev) -+ sync_blockdev(dev->blkdev); -+ read_unlock(&dev->bdev_mutex); -+ - return; - } - -@@ -288,47 +288,17 @@ static void block2mtd_sync(struct mtd_info *mtd) - } - - +- return; +-} +- +- -static void block2mtd_free_device(struct block2mtd_dev *dev) -{ - if (!dev) - return; - - kfree(dev->mtd.name); -- + - if (dev->blkdev) { - invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping, - 0, -1); - close_bdev_excl(dev->blkdev); - } -- ++ read_lock(&dev->bdev_mutex); ++ if (dev->blkdev) ++ sync_blockdev(dev->blkdev); ++ read_unlock(&dev->bdev_mutex); + - kfree(dev); --} -- -- ++ return; + } + + -/* FIXME: ensure that mtd->size % erase_size == 0 */ -static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname) +static int _open_bdev(struct block2mtd_dev *dev) { struct block_device *bdev; -- struct block2mtd_dev *dev; -- struct mtd_partition *part; -- char *name; - +- struct block2mtd_dev *dev; +- struct mtd_partition *part; +- char *name; +- - if (!devname) - return NULL; - - dev = kzalloc(sizeof(struct block2mtd_dev), GFP_KERNEL); - if (!dev) - return NULL; -- + /* Get a handle on the device */ - bdev = open_bdev_excl(devname, O_RDWR, NULL); + bdev = open_bdev_excl(dev->devname, O_RDWR, NULL); @@ -438,7 +434,7 @@ if (devt) { bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ); } -@@ -263,17 +295,97 @@ static struct block2mtd_dev *add_device( +@@ -263,17 +276,97 @@ static struct block2mtd_dev *add_device( #endif if (IS_ERR(bdev)) { @@ -539,7 +535,7 @@ if (!mtdname) mtdname = devname; -@@ -297,6 +408,7 @@ static struct block2mtd_dev *add_device( +@@ -297,6 +390,7 @@ static struct block2mtd_dev *add_device( dev->mtd.read = block2mtd_read; dev->mtd.priv = dev; dev->mtd.owner = THIS_MODULE;