| 1165 | } |
| 1166 | |
| 1167 | void |
| 1168 | cplist_update() |
| 1169 | { |
| 1170 | /* go through cplist and delete volumes that are not in the volume.config */ |
| 1171 | CacheVol *cp = cp_list.head; |
| 1172 | ConfigVol *config_vol; |
| 1173 | |
| 1174 | while (cp) { |
| 1175 | for (config_vol = config_volumes.cp_queue.head; config_vol; config_vol = config_vol->link.next) { |
| 1176 | if (config_vol->number == cp->vol_number) { |
| 1177 | if (cp->scheme == config_vol->scheme) { |
| 1178 | cp->ramcache_enabled = config_vol->ramcache_enabled; |
| 1179 | cp->avg_obj_size = config_vol->avg_obj_size; |
| 1180 | cp->fragment_size = config_vol->fragment_size; |
| 1181 | config_vol->cachep = cp; |
| 1182 | } else { |
| 1183 | /* delete this volume from all the disks */ |
| 1184 | int d_no; |
| 1185 | int clearCV = 1; |
| 1186 | |
| 1187 | for (d_no = 0; d_no < gndisks; d_no++) { |
| 1188 | if (cp->disk_stripes[d_no]) { |
| 1189 | if (cp->disk_stripes[d_no]->disk->forced_volume_num == cp->vol_number) { |
| 1190 | clearCV = 0; |
| 1191 | config_vol->cachep = cp; |
| 1192 | } else { |
| 1193 | cp->disk_stripes[d_no]->disk->delete_volume(cp->vol_number); |
| 1194 | cp->disk_stripes[d_no] = nullptr; |
| 1195 | } |
| 1196 | } |
| 1197 | } |
| 1198 | if (clearCV) { |
| 1199 | config_vol = nullptr; |
| 1200 | } |
| 1201 | } |
| 1202 | break; |
| 1203 | } |
| 1204 | } |
| 1205 | |
| 1206 | if (!config_vol) { |
| 1207 | // did not find a matching volume in the config file. |
| 1208 | // Delete the volume from the cache vol list |
| 1209 | int d_no; |
| 1210 | for (d_no = 0; d_no < gndisks; d_no++) { |
| 1211 | if (cp->disk_stripes[d_no]) { |
| 1212 | cp->disk_stripes[d_no]->disk->delete_volume(cp->vol_number); |
| 1213 | } |
| 1214 | } |
| 1215 | CacheVol *temp_cp = cp; |
| 1216 | cp = cp->link.next; |
| 1217 | cp_list.remove(temp_cp); |
| 1218 | cp_list_len--; |
| 1219 | delete temp_cp; |
| 1220 | continue; |
| 1221 | } else { |
| 1222 | cp = cp->link.next; |
| 1223 | } |
| 1224 | } |
no test coverage detected