dm-table.c (418f19ea17a99421b22a64e101e14b6a16bed66d) | dm-table.c (ab4c1424882be9cd70b89abf2b484add355712fa) |
---|---|
1/* 2 * Copyright (C) 2001 Sistina Software (UK) Limited. 3 * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm.h" --- 24 unchanged lines hidden (view full) --- 33 unsigned int counts[MAX_DEPTH]; /* in nodes */ 34 sector_t *index[MAX_DEPTH]; 35 36 unsigned int num_targets; 37 unsigned int num_allocated; 38 sector_t *highs; 39 struct dm_target *targets; 40 | 1/* 2 * Copyright (C) 2001 Sistina Software (UK) Limited. 3 * Copyright (C) 2004 Red Hat, Inc. All rights reserved. 4 * 5 * This file is released under the GPL. 6 */ 7 8#include "dm.h" --- 24 unchanged lines hidden (view full) --- 33 unsigned int counts[MAX_DEPTH]; /* in nodes */ 34 sector_t *index[MAX_DEPTH]; 35 36 unsigned int num_targets; 37 unsigned int num_allocated; 38 sector_t *highs; 39 struct dm_target *targets; 40 |
41 unsigned barriers_supported:1; 42 |
|
41 /* 42 * Indicates the rw permissions for the new logical 43 * device. This should be a combination of FMODE_READ 44 * and FMODE_WRITE. 45 */ 46 fmode_t mode; 47 48 /* a list of devices used by this table */ --- 173 unchanged lines hidden (view full) --- 222{ 223 struct dm_table *t = kzalloc(sizeof(*t), GFP_KERNEL); 224 225 if (!t) 226 return -ENOMEM; 227 228 INIT_LIST_HEAD(&t->devices); 229 atomic_set(&t->holders, 1); | 43 /* 44 * Indicates the rw permissions for the new logical 45 * device. This should be a combination of FMODE_READ 46 * and FMODE_WRITE. 47 */ 48 fmode_t mode; 49 50 /* a list of devices used by this table */ --- 173 unchanged lines hidden (view full) --- 224{ 225 struct dm_table *t = kzalloc(sizeof(*t), GFP_KERNEL); 226 227 if (!t) 228 return -ENOMEM; 229 230 INIT_LIST_HEAD(&t->devices); 231 atomic_set(&t->holders, 1); |
232 t->barriers_supported = 1; |
|
230 231 if (!num_targets) 232 num_targets = KEYS_PER_NODE; 233 234 num_targets = dm_round_up(num_targets, KEYS_PER_NODE); 235 236 if (alloc_targets(t, num_targets)) { 237 kfree(t); --- 485 unchanged lines hidden (view full) --- 723 if (r) 724 goto bad; 725 726 t->highs[t->num_targets++] = tgt->begin + tgt->len - 1; 727 728 /* FIXME: the plan is to combine high here and then have 729 * the merge fn apply the target level restrictions. */ 730 combine_restrictions_low(&t->limits, &tgt->limits); | 233 234 if (!num_targets) 235 num_targets = KEYS_PER_NODE; 236 237 num_targets = dm_round_up(num_targets, KEYS_PER_NODE); 238 239 if (alloc_targets(t, num_targets)) { 240 kfree(t); --- 485 unchanged lines hidden (view full) --- 726 if (r) 727 goto bad; 728 729 t->highs[t->num_targets++] = tgt->begin + tgt->len - 1; 730 731 /* FIXME: the plan is to combine high here and then have 732 * the merge fn apply the target level restrictions. */ 733 combine_restrictions_low(&t->limits, &tgt->limits); |
734 735 if (!(tgt->type->features & DM_TARGET_SUPPORTS_BARRIERS)) 736 t->barriers_supported = 0; 737 |
|
731 return 0; 732 733 bad: 734 DMERR("%s: %s: %s", dm_device_name(t->md), type, tgt->error); 735 dm_put_target_type(tgt->type); 736 return r; 737} 738 --- 28 unchanged lines hidden (view full) --- 767 */ 768int dm_table_complete(struct dm_table *t) 769{ 770 int r = 0; 771 unsigned int leaf_nodes; 772 773 check_for_valid_limits(&t->limits); 774 | 738 return 0; 739 740 bad: 741 DMERR("%s: %s: %s", dm_device_name(t->md), type, tgt->error); 742 dm_put_target_type(tgt->type); 743 return r; 744} 745 --- 28 unchanged lines hidden (view full) --- 774 */ 775int dm_table_complete(struct dm_table *t) 776{ 777 int r = 0; 778 unsigned int leaf_nodes; 779 780 check_for_valid_limits(&t->limits); 781 |
782 /* 783 * We only support barriers if there is exactly one underlying device. 784 */ 785 if (!list_is_singular(&t->devices)) 786 t->barriers_supported = 0; 787 |
|
775 /* how many indexes will the btree have ? */ 776 leaf_nodes = dm_div_up(t->num_targets, KEYS_PER_NODE); 777 t->depth = 1 + int_log(leaf_nodes, CHILDREN_PER_NODE); 778 779 /* leaf layer has already been set up */ 780 t->counts[t->depth - 1] = leaf_nodes; 781 t->index[t->depth - 1] = t->highs; 782 --- 198 unchanged lines hidden (view full) --- 981 982struct mapped_device *dm_table_get_md(struct dm_table *t) 983{ 984 dm_get(t->md); 985 986 return t->md; 987} 988 | 788 /* how many indexes will the btree have ? */ 789 leaf_nodes = dm_div_up(t->num_targets, KEYS_PER_NODE); 790 t->depth = 1 + int_log(leaf_nodes, CHILDREN_PER_NODE); 791 792 /* leaf layer has already been set up */ 793 t->counts[t->depth - 1] = leaf_nodes; 794 t->index[t->depth - 1] = t->highs; 795 --- 198 unchanged lines hidden (view full) --- 994 995struct mapped_device *dm_table_get_md(struct dm_table *t) 996{ 997 dm_get(t->md); 998 999 return t->md; 1000} 1001 |
1002int dm_table_barrier_ok(struct dm_table *t) 1003{ 1004 return t->barriers_supported; 1005} 1006EXPORT_SYMBOL(dm_table_barrier_ok); 1007 |
|
989EXPORT_SYMBOL(dm_vcalloc); 990EXPORT_SYMBOL(dm_get_device); 991EXPORT_SYMBOL(dm_put_device); 992EXPORT_SYMBOL(dm_table_event); 993EXPORT_SYMBOL(dm_table_get_size); 994EXPORT_SYMBOL(dm_table_get_mode); 995EXPORT_SYMBOL(dm_table_get_md); 996EXPORT_SYMBOL(dm_table_put); 997EXPORT_SYMBOL(dm_table_get); 998EXPORT_SYMBOL(dm_table_unplug_all); | 1008EXPORT_SYMBOL(dm_vcalloc); 1009EXPORT_SYMBOL(dm_get_device); 1010EXPORT_SYMBOL(dm_put_device); 1011EXPORT_SYMBOL(dm_table_event); 1012EXPORT_SYMBOL(dm_table_get_size); 1013EXPORT_SYMBOL(dm_table_get_mode); 1014EXPORT_SYMBOL(dm_table_get_md); 1015EXPORT_SYMBOL(dm_table_put); 1016EXPORT_SYMBOL(dm_table_get); 1017EXPORT_SYMBOL(dm_table_unplug_all); |