and changed files
[powerpc.git] / drivers / md / dm-table.c
index 4920998..2fc199b 100644 (file)
@@ -425,13 +425,15 @@ static void close_dev(struct dm_dev *d, struct mapped_device *md)
 }
 
 /*
- * If possible (ie. blk_size[major] is set), this checks an area
- * of a destination device is valid.
+ * If possible, this checks an area of a destination device is valid.
  */
 static int check_device_area(struct dm_dev *dd, sector_t start, sector_t len)
 {
-       sector_t dev_size;
-       dev_size = dd->bdev->bd_inode->i_size >> SECTOR_SHIFT;
+       sector_t dev_size = dd->bdev->bd_inode->i_size >> SECTOR_SHIFT;
+
+       if (!dev_size)
+               return 1;
+
        return ((start < dev_size) && (len <= (dev_size - start)));
 }
 
@@ -1001,6 +1003,11 @@ int dm_table_flush_all(struct dm_table *t)
 {
        struct list_head *d, *devices = dm_table_get_devices(t);
        int ret = 0;
+       unsigned i;
+
+       for (i = 0; i < t->num_targets; i++)
+               if (t->targets[i].type->flush)
+                       t->targets[i].type->flush(&t->targets[i]);
 
        for (d = devices->next; d != devices; d = d->next) {
                struct dm_dev *dd = list_entry(d, struct dm_dev, list);