tg3: Supply a nicaddr for 57765 jumbo RCB
[safe/jmp/linux-2.6] / drivers / md / dm-snap-transient.c
index 77f58be..a0898a6 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include "dm-exception-store.h"
-#include "dm-snap.h"
 
 #include <linux/mm.h>
 #include <linux/pagemap.h>
@@ -37,22 +36,22 @@ static int transient_read_metadata(struct dm_exception_store *store,
 }
 
 static int transient_prepare_exception(struct dm_exception_store *store,
-                                      struct dm_snap_exception *e)
+                                      struct dm_exception *e)
 {
        struct transient_c *tc = store->context;
-       sector_t size = get_dev_size(store->cow->bdev);
+       sector_t size = get_dev_size(dm_snap_cow(store->snap)->bdev);
 
        if (size < (tc->next_free + store->chunk_size))
                return -1;
 
-       e->new_chunk = sector_to_chunk(store->snap, tc->next_free);
+       e->new_chunk = sector_to_chunk(store, tc->next_free);
        tc->next_free += store->chunk_size;
 
        return 0;
 }
 
 static void transient_commit_exception(struct dm_exception_store *store,
-                                      struct dm_snap_exception *e,
+                                      struct dm_exception *e,
                                       void (*callback) (void *, int success),
                                       void *callback_context)
 {
@@ -60,11 +59,14 @@ static void transient_commit_exception(struct dm_exception_store *store,
        callback(callback_context, 1);
 }
 
-static void transient_fraction_full(struct dm_exception_store *store,
-                                   sector_t *numerator, sector_t *denominator)
+static void transient_usage(struct dm_exception_store *store,
+                           sector_t *total_sectors,
+                           sector_t *sectors_allocated,
+                           sector_t *metadata_sectors)
 {
-       *numerator = ((struct transient_c *) store->context)->next_free;
-       *denominator = get_dev_size(store->cow->bdev);
+       *sectors_allocated = ((struct transient_c *) store->context)->next_free;
+       *total_sectors = get_dev_size(dm_snap_cow(store->snap)->bdev);
+       *metadata_sectors = 0;
 }
 
 static int transient_ctr(struct dm_exception_store *store,
@@ -82,11 +84,18 @@ static int transient_ctr(struct dm_exception_store *store,
        return 0;
 }
 
-static int transient_status(struct dm_exception_store *store,
-                           status_type_t status, char *result,
-                           unsigned maxlen)
+static unsigned transient_status(struct dm_exception_store *store,
+                                status_type_t status, char *result,
+                                unsigned maxlen)
 {
-       int sz = 0;
+       unsigned sz = 0;
+
+       switch (status) {
+       case STATUSTYPE_INFO:
+               break;
+       case STATUSTYPE_TABLE:
+               DMEMIT(" N %llu", (unsigned long long)store->chunk_size);
+       }
 
        return sz;
 }
@@ -99,7 +108,7 @@ static struct dm_exception_store_type _transient_type = {
        .read_metadata = transient_read_metadata,
        .prepare_exception = transient_prepare_exception,
        .commit_exception = transient_commit_exception,
-       .fraction_full = transient_fraction_full,
+       .usage = transient_usage,
        .status = transient_status,
 };
 
@@ -111,7 +120,7 @@ static struct dm_exception_store_type _transient_compat_type = {
        .read_metadata = transient_read_metadata,
        .prepare_exception = transient_prepare_exception,
        .commit_exception = transient_commit_exception,
-       .fraction_full = transient_fraction_full,
+       .usage = transient_usage,
        .status = transient_status,
 };