diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/char/ipmi/ipmi_msghandler.c | 46 | ||||
| -rw-r--r-- | drivers/char/ipmi/ipmi_ssif.c | 1 | ||||
| -rw-r--r-- | drivers/md/dm-thin.c | 29 | ||||
| -rw-r--r-- | drivers/md/dm.c | 2 |
4 files changed, 42 insertions, 36 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 5fa83f751378..6b65fa4e0c55 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
| @@ -199,18 +199,6 @@ struct bmc_device { | |||
| 199 | int guid_set; | 199 | int guid_set; |
| 200 | char name[16]; | 200 | char name[16]; |
| 201 | struct kref usecount; | 201 | struct kref usecount; |
| 202 | |||
| 203 | /* bmc device attributes */ | ||
| 204 | struct device_attribute device_id_attr; | ||
| 205 | struct device_attribute provides_dev_sdrs_attr; | ||
| 206 | struct device_attribute revision_attr; | ||
| 207 | struct device_attribute firmware_rev_attr; | ||
| 208 | struct device_attribute version_attr; | ||
| 209 | struct device_attribute add_dev_support_attr; | ||
| 210 | struct device_attribute manufacturer_id_attr; | ||
| 211 | struct device_attribute product_id_attr; | ||
| 212 | struct device_attribute guid_attr; | ||
| 213 | struct device_attribute aux_firmware_rev_attr; | ||
| 214 | }; | 202 | }; |
| 215 | #define to_bmc_device(x) container_of((x), struct bmc_device, pdev.dev) | 203 | #define to_bmc_device(x) container_of((x), struct bmc_device, pdev.dev) |
| 216 | 204 | ||
| @@ -2252,7 +2240,7 @@ static ssize_t device_id_show(struct device *dev, | |||
| 2252 | 2240 | ||
| 2253 | return snprintf(buf, 10, "%u\n", bmc->id.device_id); | 2241 | return snprintf(buf, 10, "%u\n", bmc->id.device_id); |
| 2254 | } | 2242 | } |
| 2255 | DEVICE_ATTR(device_id, S_IRUGO, device_id_show, NULL); | 2243 | static DEVICE_ATTR(device_id, S_IRUGO, device_id_show, NULL); |
| 2256 | 2244 | ||
| 2257 | static ssize_t provides_device_sdrs_show(struct device *dev, | 2245 | static ssize_t provides_device_sdrs_show(struct device *dev, |
| 2258 | struct device_attribute *attr, | 2246 | struct device_attribute *attr, |
| @@ -2263,7 +2251,8 @@ static ssize_t provides_device_sdrs_show(struct device *dev, | |||
| 2263 | return snprintf(buf, 10, "%u\n", | 2251 | return snprintf(buf, 10, "%u\n", |
| 2264 | (bmc->id.device_revision & 0x80) >> 7); | 2252 | (bmc->id.device_revision & 0x80) >> 7); |
| 2265 | } | 2253 | } |
| 2266 | DEVICE_ATTR(provides_device_sdrs, S_IRUGO, provides_device_sdrs_show, NULL); | 2254 | static DEVICE_ATTR(provides_device_sdrs, S_IRUGO, provides_device_sdrs_show, |
| 2255 | NULL); | ||
| 2267 | 2256 | ||
| 2268 | static ssize_t revision_show(struct device *dev, struct device_attribute *attr, | 2257 | static ssize_t revision_show(struct device *dev, struct device_attribute *attr, |
| 2269 | char *buf) | 2258 | char *buf) |
| @@ -2273,7 +2262,7 @@ static ssize_t revision_show(struct device *dev, struct device_attribute *attr, | |||
| 2273 | return snprintf(buf, 20, "%u\n", | 2262 | return snprintf(buf, 20, "%u\n", |
| 2274 | bmc->id.device_revision & 0x0F); | 2263 | bmc->id.device_revision & 0x0F); |
| 2275 | } | 2264 | } |
| 2276 | DEVICE_ATTR(revision, S_IRUGO, revision_show, NULL); | 2265 | static DEVICE_ATTR(revision, S_IRUGO, revision_show, NULL); |
| 2277 | 2266 | ||
| 2278 | static ssize_t firmware_revision_show(struct device *dev, | 2267 | static ssize_t firmware_revision_show(struct device *dev, |
| 2279 | struct device_attribute *attr, | 2268 | struct device_attribute *attr, |
| @@ -2284,7 +2273,7 @@ static ssize_t firmware_revision_show(struct device *dev, | |||
| 2284 | return snprintf(buf, 20, "%u.%x\n", bmc->id.firmware_revision_1, | 2273 | return snprintf(buf, 20, "%u.%x\n", bmc->id.firmware_revision_1, |
| 2285 | bmc->id.firmware_revision_2); | 2274 | bmc->id.firmware_revision_2); |
| 2286 | } | 2275 | } |
| 2287 | DEVICE_ATTR(firmware_revision, S_IRUGO, firmware_revision_show, NULL); | 2276 | static DEVICE_ATTR(firmware_revision, S_IRUGO, firmware_revision_show, NULL); |
| 2288 | 2277 | ||
| 2289 | static ssize_t ipmi_version_show(struct device *dev, | 2278 | static ssize_t ipmi_version_show(struct device *dev, |
| 2290 | struct device_attribute *attr, | 2279 | struct device_attribute *attr, |
| @@ -2296,7 +2285,7 @@ static ssize_t ipmi_version_show(struct device *dev, | |||
| 2296 | ipmi_version_major(&bmc->id), | 2285 | ipmi_version_major(&bmc->id), |
| 2297 | ipmi_version_minor(&bmc->id)); | 2286 | ipmi_version_minor(&bmc->id)); |
| 2298 | } | 2287 | } |
| 2299 | DEVICE_ATTR(ipmi_version, S_IRUGO, ipmi_version_show, NULL); | 2288 | static DEVICE_ATTR(ipmi_version, S_IRUGO, ipmi_version_show, NULL); |
| 2300 | 2289 | ||
| 2301 | static ssize_t add_dev_support_show(struct device *dev, | 2290 | static ssize_t add_dev_support_show(struct device *dev, |
| 2302 | struct device_attribute *attr, | 2291 | struct device_attribute *attr, |
| @@ -2307,7 +2296,8 @@ static ssize_t add_dev_support_show(struct device *dev, | |||
| 2307 | return snprintf(buf, 10, "0x%02x\n", | 2296 | return snprintf(buf, 10, "0x%02x\n", |
| 2308 | bmc->id.additional_device_support); | 2297 | bmc->id.additional_device_support); |
| 2309 | } | 2298 | } |
| 2310 | DEVICE_ATTR(additional_device_support, S_IRUGO, add_dev_support_show, NULL); | 2299 | static DEVICE_ATTR(additional_device_support, S_IRUGO, add_dev_support_show, |
| 2300 | NULL); | ||
| 2311 | 2301 | ||
| 2312 | static ssize_t manufacturer_id_show(struct device *dev, | 2302 | static ssize_t manufacturer_id_show(struct device *dev, |
| 2313 | struct device_attribute *attr, | 2303 | struct device_attribute *attr, |
| @@ -2317,7 +2307,7 @@ static ssize_t manufacturer_id_show(struct device *dev, | |||
| 2317 | 2307 | ||
| 2318 | return snprintf(buf, 20, "0x%6.6x\n", bmc->id.manufacturer_id); | 2308 | return snprintf(buf, 20, "0x%6.6x\n", bmc->id.manufacturer_id); |
| 2319 | } | 2309 | } |
| 2320 | DEVICE_ATTR(manufacturer_id, S_IRUGO, manufacturer_id_show, NULL); | 2310 | static DEVICE_ATTR(manufacturer_id, S_IRUGO, manufacturer_id_show, NULL); |
| 2321 | 2311 | ||
| 2322 | static ssize_t product_id_show(struct device *dev, | 2312 | static ssize_t product_id_show(struct device *dev, |
| 2323 | struct device_attribute *attr, | 2313 | struct device_attribute *attr, |
| @@ -2327,7 +2317,7 @@ static ssize_t product_id_show(struct device *dev, | |||
| 2327 | 2317 | ||
| 2328 | return snprintf(buf, 10, "0x%4.4x\n", bmc->id.product_id); | 2318 | return snprintf(buf, 10, "0x%4.4x\n", bmc->id.product_id); |
| 2329 | } | 2319 | } |
| 2330 | DEVICE_ATTR(product_id, S_IRUGO, product_id_show, NULL); | 2320 | static DEVICE_ATTR(product_id, S_IRUGO, product_id_show, NULL); |
| 2331 | 2321 | ||
| 2332 | static ssize_t aux_firmware_rev_show(struct device *dev, | 2322 | static ssize_t aux_firmware_rev_show(struct device *dev, |
| 2333 | struct device_attribute *attr, | 2323 | struct device_attribute *attr, |
| @@ -2341,7 +2331,7 @@ static ssize_t aux_firmware_rev_show(struct device *dev, | |||
| 2341 | bmc->id.aux_firmware_revision[1], | 2331 | bmc->id.aux_firmware_revision[1], |
| 2342 | bmc->id.aux_firmware_revision[0]); | 2332 | bmc->id.aux_firmware_revision[0]); |
| 2343 | } | 2333 | } |
| 2344 | DEVICE_ATTR(aux_firmware_revision, S_IRUGO, aux_firmware_rev_show, NULL); | 2334 | static DEVICE_ATTR(aux_firmware_revision, S_IRUGO, aux_firmware_rev_show, NULL); |
| 2345 | 2335 | ||
| 2346 | static ssize_t guid_show(struct device *dev, struct device_attribute *attr, | 2336 | static ssize_t guid_show(struct device *dev, struct device_attribute *attr, |
| 2347 | char *buf) | 2337 | char *buf) |
| @@ -2352,7 +2342,7 @@ static ssize_t guid_show(struct device *dev, struct device_attribute *attr, | |||
| 2352 | (long long) bmc->guid[0], | 2342 | (long long) bmc->guid[0], |
| 2353 | (long long) bmc->guid[8]); | 2343 | (long long) bmc->guid[8]); |
| 2354 | } | 2344 | } |
| 2355 | DEVICE_ATTR(guid, S_IRUGO, guid_show, NULL); | 2345 | static DEVICE_ATTR(guid, S_IRUGO, guid_show, NULL); |
| 2356 | 2346 | ||
| 2357 | static struct attribute *bmc_dev_attrs[] = { | 2347 | static struct attribute *bmc_dev_attrs[] = { |
| 2358 | &dev_attr_device_id.attr, | 2348 | &dev_attr_device_id.attr, |
| @@ -2392,10 +2382,10 @@ cleanup_bmc_device(struct kref *ref) | |||
| 2392 | 2382 | ||
| 2393 | if (bmc->id.aux_firmware_revision_set) | 2383 | if (bmc->id.aux_firmware_revision_set) |
| 2394 | device_remove_file(&bmc->pdev.dev, | 2384 | device_remove_file(&bmc->pdev.dev, |
| 2395 | &bmc->aux_firmware_rev_attr); | 2385 | &dev_attr_aux_firmware_revision); |
| 2396 | if (bmc->guid_set) | 2386 | if (bmc->guid_set) |
| 2397 | device_remove_file(&bmc->pdev.dev, | 2387 | device_remove_file(&bmc->pdev.dev, |
| 2398 | &bmc->guid_attr); | 2388 | &dev_attr_guid); |
| 2399 | 2389 | ||
| 2400 | platform_device_unregister(&bmc->pdev); | 2390 | platform_device_unregister(&bmc->pdev); |
| 2401 | } | 2391 | } |
| @@ -2422,16 +2412,14 @@ static int create_bmc_files(struct bmc_device *bmc) | |||
| 2422 | int err; | 2412 | int err; |
| 2423 | 2413 | ||
| 2424 | if (bmc->id.aux_firmware_revision_set) { | 2414 | if (bmc->id.aux_firmware_revision_set) { |
| 2425 | bmc->aux_firmware_rev_attr.attr.name = "aux_firmware_revision"; | ||
| 2426 | err = device_create_file(&bmc->pdev.dev, | 2415 | err = device_create_file(&bmc->pdev.dev, |
| 2427 | &bmc->aux_firmware_rev_attr); | 2416 | &dev_attr_aux_firmware_revision); |
| 2428 | if (err) | 2417 | if (err) |
| 2429 | goto out; | 2418 | goto out; |
| 2430 | } | 2419 | } |
| 2431 | if (bmc->guid_set) { | 2420 | if (bmc->guid_set) { |
| 2432 | bmc->guid_attr.attr.name = "guid"; | ||
| 2433 | err = device_create_file(&bmc->pdev.dev, | 2421 | err = device_create_file(&bmc->pdev.dev, |
| 2434 | &bmc->guid_attr); | 2422 | &dev_attr_guid); |
| 2435 | if (err) | 2423 | if (err) |
| 2436 | goto out_aux_firm; | 2424 | goto out_aux_firm; |
| 2437 | } | 2425 | } |
| @@ -2441,7 +2429,7 @@ static int create_bmc_files(struct bmc_device *bmc) | |||
| 2441 | out_aux_firm: | 2429 | out_aux_firm: |
| 2442 | if (bmc->id.aux_firmware_revision_set) | 2430 | if (bmc->id.aux_firmware_revision_set) |
| 2443 | device_remove_file(&bmc->pdev.dev, | 2431 | device_remove_file(&bmc->pdev.dev, |
| 2444 | &bmc->aux_firmware_rev_attr); | 2432 | &dev_attr_aux_firmware_revision); |
| 2445 | out: | 2433 | out: |
| 2446 | return err; | 2434 | return err; |
| 2447 | } | 2435 | } |
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c index e178ac27e73c..fd5a5e85d7dc 100644 --- a/drivers/char/ipmi/ipmi_ssif.c +++ b/drivers/char/ipmi/ipmi_ssif.c | |||
| @@ -52,6 +52,7 @@ | |||
| 52 | #include <linux/dmi.h> | 52 | #include <linux/dmi.h> |
| 53 | #include <linux/kthread.h> | 53 | #include <linux/kthread.h> |
| 54 | #include <linux/acpi.h> | 54 | #include <linux/acpi.h> |
| 55 | #include <linux/ctype.h> | ||
| 55 | 56 | ||
| 56 | #define PFX "ipmi_ssif: " | 57 | #define PFX "ipmi_ssif: " |
| 57 | #define DEVICE_NAME "ipmi_ssif" | 58 | #define DEVICE_NAME "ipmi_ssif" |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 8735543eacdb..493478989dbd 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
| @@ -1127,6 +1127,24 @@ static void schedule_external_copy(struct thin_c *tc, dm_block_t virt_block, | |||
| 1127 | schedule_zero(tc, virt_block, data_dest, cell, bio); | 1127 | schedule_zero(tc, virt_block, data_dest, cell, bio); |
| 1128 | } | 1128 | } |
| 1129 | 1129 | ||
| 1130 | static void set_pool_mode(struct pool *pool, enum pool_mode new_mode); | ||
| 1131 | |||
| 1132 | static void check_for_space(struct pool *pool) | ||
| 1133 | { | ||
| 1134 | int r; | ||
| 1135 | dm_block_t nr_free; | ||
| 1136 | |||
| 1137 | if (get_pool_mode(pool) != PM_OUT_OF_DATA_SPACE) | ||
| 1138 | return; | ||
| 1139 | |||
| 1140 | r = dm_pool_get_free_block_count(pool->pmd, &nr_free); | ||
| 1141 | if (r) | ||
| 1142 | return; | ||
| 1143 | |||
| 1144 | if (nr_free) | ||
| 1145 | set_pool_mode(pool, PM_WRITE); | ||
| 1146 | } | ||
| 1147 | |||
| 1130 | /* | 1148 | /* |
| 1131 | * A non-zero return indicates read_only or fail_io mode. | 1149 | * A non-zero return indicates read_only or fail_io mode. |
| 1132 | * Many callers don't care about the return value. | 1150 | * Many callers don't care about the return value. |
| @@ -1141,6 +1159,8 @@ static int commit(struct pool *pool) | |||
| 1141 | r = dm_pool_commit_metadata(pool->pmd); | 1159 | r = dm_pool_commit_metadata(pool->pmd); |
| 1142 | if (r) | 1160 | if (r) |
| 1143 | metadata_operation_failed(pool, "dm_pool_commit_metadata", r); | 1161 | metadata_operation_failed(pool, "dm_pool_commit_metadata", r); |
| 1162 | else | ||
| 1163 | check_for_space(pool); | ||
| 1144 | 1164 | ||
| 1145 | return r; | 1165 | return r; |
| 1146 | } | 1166 | } |
| @@ -1159,8 +1179,6 @@ static void check_low_water_mark(struct pool *pool, dm_block_t free_blocks) | |||
| 1159 | } | 1179 | } |
| 1160 | } | 1180 | } |
| 1161 | 1181 | ||
| 1162 | static void set_pool_mode(struct pool *pool, enum pool_mode new_mode); | ||
| 1163 | |||
| 1164 | static int alloc_data_block(struct thin_c *tc, dm_block_t *result) | 1182 | static int alloc_data_block(struct thin_c *tc, dm_block_t *result) |
| 1165 | { | 1183 | { |
| 1166 | int r; | 1184 | int r; |
| @@ -2155,7 +2173,7 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) | |||
| 2155 | pool->process_cell = process_cell_read_only; | 2173 | pool->process_cell = process_cell_read_only; |
| 2156 | pool->process_discard_cell = process_discard_cell; | 2174 | pool->process_discard_cell = process_discard_cell; |
| 2157 | pool->process_prepared_mapping = process_prepared_mapping; | 2175 | pool->process_prepared_mapping = process_prepared_mapping; |
| 2158 | pool->process_prepared_discard = process_prepared_discard_passdown; | 2176 | pool->process_prepared_discard = process_prepared_discard; |
| 2159 | 2177 | ||
| 2160 | if (!pool->pf.error_if_no_space && no_space_timeout) | 2178 | if (!pool->pf.error_if_no_space && no_space_timeout) |
| 2161 | queue_delayed_work(pool->wq, &pool->no_space_timeout, no_space_timeout); | 2179 | queue_delayed_work(pool->wq, &pool->no_space_timeout, no_space_timeout); |
| @@ -3814,6 +3832,8 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
| 3814 | r = -EINVAL; | 3832 | r = -EINVAL; |
| 3815 | goto bad; | 3833 | goto bad; |
| 3816 | } | 3834 | } |
| 3835 | atomic_set(&tc->refcount, 1); | ||
| 3836 | init_completion(&tc->can_destroy); | ||
| 3817 | list_add_tail_rcu(&tc->list, &tc->pool->active_thins); | 3837 | list_add_tail_rcu(&tc->list, &tc->pool->active_thins); |
| 3818 | spin_unlock_irqrestore(&tc->pool->lock, flags); | 3838 | spin_unlock_irqrestore(&tc->pool->lock, flags); |
| 3819 | /* | 3839 | /* |
| @@ -3826,9 +3846,6 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
| 3826 | 3846 | ||
| 3827 | dm_put(pool_md); | 3847 | dm_put(pool_md); |
| 3828 | 3848 | ||
| 3829 | atomic_set(&tc->refcount, 1); | ||
| 3830 | init_completion(&tc->can_destroy); | ||
| 3831 | |||
| 3832 | return 0; | 3849 | return 0; |
| 3833 | 3850 | ||
| 3834 | bad: | 3851 | bad: |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 4c06585bf165..b98cd9d84435 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
| @@ -899,7 +899,7 @@ static void disable_write_same(struct mapped_device *md) | |||
| 899 | 899 | ||
| 900 | static void clone_endio(struct bio *bio, int error) | 900 | static void clone_endio(struct bio *bio, int error) |
| 901 | { | 901 | { |
| 902 | int r = 0; | 902 | int r = error; |
| 903 | struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone); | 903 | struct dm_target_io *tio = container_of(bio, struct dm_target_io, clone); |
| 904 | struct dm_io *io = tio->io; | 904 | struct dm_io *io = tio->io; |
| 905 | struct mapped_device *md = tio->io->md; | 905 | struct mapped_device *md = tio->io->md; |
