diff options
author | Alasdair G Kergon <agk@redhat.com> | 2010-08-11 23:13:52 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2010-08-11 23:13:52 -0400 |
commit | 094ea9a071f68bd6f56c3f8cdeb5263727b68ce9 (patch) | |
tree | 26455271959efc8241adaee9f49c31e87606c9ff /drivers/md | |
parent | 6be544940109b4c45f560785fe5798ce3fdc1922 (diff) |
dm ioctl: make __dev_status void
__dev_status() cannot fail so make it void and simplify callers.
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-ioctl.c | 67 |
1 files changed, 31 insertions, 36 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index 70f83071e9ab..4bc4c4fca90d 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c | |||
@@ -573,7 +573,7 @@ static struct dm_table *dm_get_live_or_inactive_table(struct mapped_device *md, | |||
573 | * Fills in a dm_ioctl structure, ready for sending back to | 573 | * Fills in a dm_ioctl structure, ready for sending back to |
574 | * userland. | 574 | * userland. |
575 | */ | 575 | */ |
576 | static int __dev_status(struct mapped_device *md, struct dm_ioctl *param) | 576 | static void __dev_status(struct mapped_device *md, struct dm_ioctl *param) |
577 | { | 577 | { |
578 | struct gendisk *disk = dm_disk(md); | 578 | struct gendisk *disk = dm_disk(md); |
579 | struct dm_table *table; | 579 | struct dm_table *table; |
@@ -617,8 +617,6 @@ static int __dev_status(struct mapped_device *md, struct dm_ioctl *param) | |||
617 | dm_table_put(table); | 617 | dm_table_put(table); |
618 | } | 618 | } |
619 | } | 619 | } |
620 | |||
621 | return 0; | ||
622 | } | 620 | } |
623 | 621 | ||
624 | static int dev_create(struct dm_ioctl *param, size_t param_size) | 622 | static int dev_create(struct dm_ioctl *param, size_t param_size) |
@@ -638,14 +636,14 @@ static int dev_create(struct dm_ioctl *param, size_t param_size) | |||
638 | return r; | 636 | return r; |
639 | 637 | ||
640 | r = dm_hash_insert(param->name, *param->uuid ? param->uuid : NULL, md); | 638 | r = dm_hash_insert(param->name, *param->uuid ? param->uuid : NULL, md); |
641 | if (r) { | 639 | if (r) |
642 | dm_put(md); | 640 | goto out; |
643 | return r; | ||
644 | } | ||
645 | 641 | ||
646 | param->flags &= ~DM_INACTIVE_PRESENT_FLAG; | 642 | param->flags &= ~DM_INACTIVE_PRESENT_FLAG; |
647 | 643 | ||
648 | r = __dev_status(md, param); | 644 | __dev_status(md, param); |
645 | |||
646 | out: | ||
649 | dm_put(md); | 647 | dm_put(md); |
650 | 648 | ||
651 | return r; | 649 | return r; |
@@ -841,13 +839,17 @@ static int do_suspend(struct dm_ioctl *param) | |||
841 | if (param->flags & DM_NOFLUSH_FLAG) | 839 | if (param->flags & DM_NOFLUSH_FLAG) |
842 | suspend_flags |= DM_SUSPEND_NOFLUSH_FLAG; | 840 | suspend_flags |= DM_SUSPEND_NOFLUSH_FLAG; |
843 | 841 | ||
844 | if (!dm_suspended_md(md)) | 842 | if (!dm_suspended_md(md)) { |
845 | r = dm_suspend(md, suspend_flags); | 843 | r = dm_suspend(md, suspend_flags); |
844 | if (r) | ||
845 | goto out; | ||
846 | } | ||
846 | 847 | ||
847 | if (!r) | 848 | __dev_status(md, param); |
848 | r = __dev_status(md, param); | ||
849 | 849 | ||
850 | out: | ||
850 | dm_put(md); | 851 | dm_put(md); |
852 | |||
851 | return r; | 853 | return r; |
852 | } | 854 | } |
853 | 855 | ||
@@ -909,7 +911,7 @@ static int do_resume(struct dm_ioctl *param) | |||
909 | dm_table_destroy(old_map); | 911 | dm_table_destroy(old_map); |
910 | 912 | ||
911 | if (!r) | 913 | if (!r) |
912 | r = __dev_status(md, param); | 914 | __dev_status(md, param); |
913 | 915 | ||
914 | dm_put(md); | 916 | dm_put(md); |
915 | return r; | 917 | return r; |
@@ -933,16 +935,16 @@ static int dev_suspend(struct dm_ioctl *param, size_t param_size) | |||
933 | */ | 935 | */ |
934 | static int dev_status(struct dm_ioctl *param, size_t param_size) | 936 | static int dev_status(struct dm_ioctl *param, size_t param_size) |
935 | { | 937 | { |
936 | int r; | ||
937 | struct mapped_device *md; | 938 | struct mapped_device *md; |
938 | 939 | ||
939 | md = find_device(param); | 940 | md = find_device(param); |
940 | if (!md) | 941 | if (!md) |
941 | return -ENXIO; | 942 | return -ENXIO; |
942 | 943 | ||
943 | r = __dev_status(md, param); | 944 | __dev_status(md, param); |
944 | dm_put(md); | 945 | dm_put(md); |
945 | return r; | 946 | |
947 | return 0; | ||
946 | } | 948 | } |
947 | 949 | ||
948 | /* | 950 | /* |
@@ -1017,7 +1019,7 @@ static void retrieve_status(struct dm_table *table, | |||
1017 | */ | 1019 | */ |
1018 | static int dev_wait(struct dm_ioctl *param, size_t param_size) | 1020 | static int dev_wait(struct dm_ioctl *param, size_t param_size) |
1019 | { | 1021 | { |
1020 | int r; | 1022 | int r = 0; |
1021 | struct mapped_device *md; | 1023 | struct mapped_device *md; |
1022 | struct dm_table *table; | 1024 | struct dm_table *table; |
1023 | 1025 | ||
@@ -1038,9 +1040,7 @@ static int dev_wait(struct dm_ioctl *param, size_t param_size) | |||
1038 | * changed to trigger the event, so we may as well tell | 1040 | * changed to trigger the event, so we may as well tell |
1039 | * him and save an ioctl. | 1041 | * him and save an ioctl. |
1040 | */ | 1042 | */ |
1041 | r = __dev_status(md, param); | 1043 | __dev_status(md, param); |
1042 | if (r) | ||
1043 | goto out; | ||
1044 | 1044 | ||
1045 | table = dm_get_live_or_inactive_table(md, param); | 1045 | table = dm_get_live_or_inactive_table(md, param); |
1046 | if (table) { | 1046 | if (table) { |
@@ -1048,8 +1048,9 @@ static int dev_wait(struct dm_ioctl *param, size_t param_size) | |||
1048 | dm_table_put(table); | 1048 | dm_table_put(table); |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | out: | 1051 | out: |
1052 | dm_put(md); | 1052 | dm_put(md); |
1053 | |||
1053 | return r; | 1054 | return r; |
1054 | } | 1055 | } |
1055 | 1056 | ||
@@ -1184,7 +1185,7 @@ static int table_load(struct dm_ioctl *param, size_t param_size) | |||
1184 | up_write(&_hash_lock); | 1185 | up_write(&_hash_lock); |
1185 | 1186 | ||
1186 | param->flags |= DM_INACTIVE_PRESENT_FLAG; | 1187 | param->flags |= DM_INACTIVE_PRESENT_FLAG; |
1187 | r = __dev_status(md, param); | 1188 | __dev_status(md, param); |
1188 | 1189 | ||
1189 | out: | 1190 | out: |
1190 | dm_put(md); | 1191 | dm_put(md); |
@@ -1194,7 +1195,6 @@ out: | |||
1194 | 1195 | ||
1195 | static int table_clear(struct dm_ioctl *param, size_t param_size) | 1196 | static int table_clear(struct dm_ioctl *param, size_t param_size) |
1196 | { | 1197 | { |
1197 | int r; | ||
1198 | struct hash_cell *hc; | 1198 | struct hash_cell *hc; |
1199 | struct mapped_device *md; | 1199 | struct mapped_device *md; |
1200 | 1200 | ||
@@ -1214,11 +1214,12 @@ static int table_clear(struct dm_ioctl *param, size_t param_size) | |||
1214 | 1214 | ||
1215 | param->flags &= ~DM_INACTIVE_PRESENT_FLAG; | 1215 | param->flags &= ~DM_INACTIVE_PRESENT_FLAG; |
1216 | 1216 | ||
1217 | r = __dev_status(hc->md, param); | 1217 | __dev_status(hc->md, param); |
1218 | md = hc->md; | 1218 | md = hc->md; |
1219 | up_write(&_hash_lock); | 1219 | up_write(&_hash_lock); |
1220 | dm_put(md); | 1220 | dm_put(md); |
1221 | return r; | 1221 | |
1222 | return 0; | ||
1222 | } | 1223 | } |
1223 | 1224 | ||
1224 | /* | 1225 | /* |
@@ -1263,7 +1264,6 @@ static void retrieve_deps(struct dm_table *table, | |||
1263 | 1264 | ||
1264 | static int table_deps(struct dm_ioctl *param, size_t param_size) | 1265 | static int table_deps(struct dm_ioctl *param, size_t param_size) |
1265 | { | 1266 | { |
1266 | int r = 0; | ||
1267 | struct mapped_device *md; | 1267 | struct mapped_device *md; |
1268 | struct dm_table *table; | 1268 | struct dm_table *table; |
1269 | 1269 | ||
@@ -1271,9 +1271,7 @@ static int table_deps(struct dm_ioctl *param, size_t param_size) | |||
1271 | if (!md) | 1271 | if (!md) |
1272 | return -ENXIO; | 1272 | return -ENXIO; |
1273 | 1273 | ||
1274 | r = __dev_status(md, param); | 1274 | __dev_status(md, param); |
1275 | if (r) | ||
1276 | goto out; | ||
1277 | 1275 | ||
1278 | table = dm_get_live_or_inactive_table(md, param); | 1276 | table = dm_get_live_or_inactive_table(md, param); |
1279 | if (table) { | 1277 | if (table) { |
@@ -1281,9 +1279,9 @@ static int table_deps(struct dm_ioctl *param, size_t param_size) | |||
1281 | dm_table_put(table); | 1279 | dm_table_put(table); |
1282 | } | 1280 | } |
1283 | 1281 | ||
1284 | out: | ||
1285 | dm_put(md); | 1282 | dm_put(md); |
1286 | return r; | 1283 | |
1284 | return 0; | ||
1287 | } | 1285 | } |
1288 | 1286 | ||
1289 | /* | 1287 | /* |
@@ -1292,7 +1290,6 @@ static int table_deps(struct dm_ioctl *param, size_t param_size) | |||
1292 | */ | 1290 | */ |
1293 | static int table_status(struct dm_ioctl *param, size_t param_size) | 1291 | static int table_status(struct dm_ioctl *param, size_t param_size) |
1294 | { | 1292 | { |
1295 | int r; | ||
1296 | struct mapped_device *md; | 1293 | struct mapped_device *md; |
1297 | struct dm_table *table; | 1294 | struct dm_table *table; |
1298 | 1295 | ||
@@ -1300,9 +1297,7 @@ static int table_status(struct dm_ioctl *param, size_t param_size) | |||
1300 | if (!md) | 1297 | if (!md) |
1301 | return -ENXIO; | 1298 | return -ENXIO; |
1302 | 1299 | ||
1303 | r = __dev_status(md, param); | 1300 | __dev_status(md, param); |
1304 | if (r) | ||
1305 | goto out; | ||
1306 | 1301 | ||
1307 | table = dm_get_live_or_inactive_table(md, param); | 1302 | table = dm_get_live_or_inactive_table(md, param); |
1308 | if (table) { | 1303 | if (table) { |
@@ -1310,9 +1305,9 @@ static int table_status(struct dm_ioctl *param, size_t param_size) | |||
1310 | dm_table_put(table); | 1305 | dm_table_put(table); |
1311 | } | 1306 | } |
1312 | 1307 | ||
1313 | out: | ||
1314 | dm_put(md); | 1308 | dm_put(md); |
1315 | return r; | 1309 | |
1310 | return 0; | ||
1316 | } | 1311 | } |
1317 | 1312 | ||
1318 | /* | 1313 | /* |