diff options
author | Milan Broz <mbroz@redhat.com> | 2006-10-03 04:15:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-03 11:04:15 -0400 |
commit | 8757b7764f13e336f3c0eb1f634440d4ee4c3a67 (patch) | |
tree | c91b00ace6ee438a9e447bce311808a698e9d487 /drivers/md/dm-table.c | |
parent | cc1092019ce3d9b3e85a285b41e852ff94a6b590 (diff) |
[PATCH] dm table: add target preresume
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>
Diffstat (limited to 'drivers/md/dm-table.c')
-rw-r--r-- | drivers/md/dm-table.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 75fe9493e6af..47412ae98fb9 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -939,9 +939,20 @@ void dm_table_postsuspend_targets(struct dm_table *t) | |||
939 | return suspend_targets(t, 1); | 939 | return suspend_targets(t, 1); |
940 | } | 940 | } |
941 | 941 | ||
942 | void dm_table_resume_targets(struct dm_table *t) | 942 | int dm_table_resume_targets(struct dm_table *t) |
943 | { | 943 | { |
944 | int i; | 944 | int i, r = 0; |
945 | |||
946 | for (i = 0; i < t->num_targets; i++) { | ||
947 | struct dm_target *ti = t->targets + i; | ||
948 | |||
949 | if (!ti->type->preresume) | ||
950 | continue; | ||
951 | |||
952 | r = ti->type->preresume(ti); | ||
953 | if (r) | ||
954 | return r; | ||
955 | } | ||
945 | 956 | ||
946 | for (i = 0; i < t->num_targets; i++) { | 957 | for (i = 0; i < t->num_targets; i++) { |
947 | struct dm_target *ti = t->targets + i; | 958 | struct dm_target *ti = t->targets + i; |
@@ -949,6 +960,8 @@ void dm_table_resume_targets(struct dm_table *t) | |||
949 | if (ti->type->resume) | 960 | if (ti->type->resume) |
950 | ti->type->resume(ti); | 961 | ti->type->resume(ti); |
951 | } | 962 | } |
963 | |||
964 | return 0; | ||
952 | } | 965 | } |
953 | 966 | ||
954 | int dm_table_any_congested(struct dm_table *t, int bdi_bits) | 967 | int dm_table_any_congested(struct dm_table *t, int bdi_bits) |