]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] dm table: add target preresume
authorMilan Broz <mbroz@redhat.com>
Tue, 3 Oct 2006 08:15:36 +0000 (01:15 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 3 Oct 2006 15:04:15 +0000 (08:04 -0700)
This patch adds a target preresume hook.

It is called before the targets are resumed and if it returns an error the
resume gets cancelled.

The crypt target will use this to indicate that it is unable to process I/O
because no encryption key has been supplied.

Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/md/dm-table.c
drivers/md/dm.c
drivers/md/dm.h
include/linux/device-mapper.h
include/linux/dm-ioctl.h

index 75fe9493e6af47059dbe79819b16683455304be8..47412ae98fb9f7c490698bf9548ff6a257e8ae44 100644 (file)
@@ -939,9 +939,20 @@ void dm_table_postsuspend_targets(struct dm_table *t)
        return suspend_targets(t, 1);
 }
 
-void dm_table_resume_targets(struct dm_table *t)
+int dm_table_resume_targets(struct dm_table *t)
 {
-       int i;
+       int i, r = 0;
+
+       for (i = 0; i < t->num_targets; i++) {
+               struct dm_target *ti = t->targets + i;
+
+               if (!ti->type->preresume)
+                       continue;
+
+               r = ti->type->preresume(ti);
+               if (r)
+                       return r;
+       }
 
        for (i = 0; i < t->num_targets; i++) {
                struct dm_target *ti = t->targets + i;
@@ -949,6 +960,8 @@ void dm_table_resume_targets(struct dm_table *t)
                if (ti->type->resume)
                        ti->type->resume(ti);
        }
+
+       return 0;
 }
 
 int dm_table_any_congested(struct dm_table *t, int bdi_bits)
index 883860c3565bb4081672dbd87e78515d7dfedee6..aeb63a3ac3308f68b9e40be73a7db75048d76108 100644 (file)
@@ -1360,7 +1360,9 @@ int dm_resume(struct mapped_device *md)
        if (!map || !dm_table_get_size(map))
                goto out;
 
-       dm_table_resume_targets(map);
+       r = dm_table_resume_targets(map);
+       if (r)
+               goto out;
 
        down_write(&md->io_lock);
        clear_bit(DMF_BLOCK_IO, &md->flags);
index fe701c4834fe8980a4a58d8f718aa499271bd3cf..a48ec5e3c1f478ea9523424f87b0db21fc8ab06d 100644 (file)
@@ -57,7 +57,7 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q);
 struct list_head *dm_table_get_devices(struct dm_table *t);
 void dm_table_presuspend_targets(struct dm_table *t);
 void dm_table_postsuspend_targets(struct dm_table *t);
-void dm_table_resume_targets(struct dm_table *t);
+int dm_table_resume_targets(struct dm_table *t);
 int dm_table_any_congested(struct dm_table *t, int bdi_bits);
 void dm_table_unplug_all(struct dm_table *t);
 int dm_table_flush_all(struct dm_table *t);
index d44a99650af390f64ec6d6c2ffc9c09769e7c03c..8cbc46b8e3dbdd5701be3b8710493096f59a3419 100644 (file)
@@ -57,6 +57,7 @@ typedef int (*dm_endio_fn) (struct dm_target *ti,
 
 typedef void (*dm_presuspend_fn) (struct dm_target *ti);
 typedef void (*dm_postsuspend_fn) (struct dm_target *ti);
+typedef int (*dm_preresume_fn) (struct dm_target *ti);
 typedef void (*dm_resume_fn) (struct dm_target *ti);
 
 typedef int (*dm_status_fn) (struct dm_target *ti, status_type_t status_type,
@@ -92,6 +93,7 @@ struct target_type {
        dm_endio_fn end_io;
        dm_presuspend_fn presuspend;
        dm_postsuspend_fn postsuspend;
+       dm_preresume_fn preresume;
        dm_resume_fn resume;
        dm_status_fn status;
        dm_message_fn message;
index b349b768df35603e0d3eeef4cefcd60f38ef70bb..f28b5c87aa6bb3683e3ef415f4366c38b2e0c842 100644 (file)
@@ -285,9 +285,9 @@ typedef char ioctl_struct[308];
 #define DM_DEV_SET_GEOMETRY    _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
 
 #define DM_VERSION_MAJOR       4
-#define DM_VERSION_MINOR       8
+#define DM_VERSION_MINOR       9
 #define DM_VERSION_PATCHLEVEL  0
-#define DM_VERSION_EXTRA       "-ioctl (2006-06-24)"
+#define DM_VERSION_EXTRA       "-ioctl (2006-09-14)"
 
 /* Status bits */
 #define DM_READONLY_FLAG       (1 << 0) /* In/Out */