Skip to content
Browse files

free LE_to_PE with all other data, prepare to keep it in program_params

  • Loading branch information...
1 parent 905a285 commit c21c62b9a2828cf3b346c40b3bd461ea9e51412d @tomato42 committed Aug 2, 2012
Showing with 11 additions and 8 deletions.
  1. +5 −4 lvmls.c
  2. +1 −1 lvmls.h
  3. +1 −1 lvmtscat.c
  4. +4 −1 lvmtsd.c
  5. +0 −1 volumes.c
View
9 lvmls.c
@@ -36,6 +36,7 @@ struct pv_allocations {
uint64_t lv_start; // starting extent of this segment in LV
};
+// TODO move to program_params
struct pv_allocations *pv_segments=NULL;
size_t pv_segments_num=0;
@@ -381,7 +382,7 @@ uint64_t get_pe_size(const char *vg_name)
}
// free allocated memory and objects
-void le_to_pe_exit()
+void le_to_pe_exit(struct program_params *pp)
{
for(size_t i=0; i<pv_segments_num; i++){
free(pv_segments[i].pv_name);
@@ -409,7 +410,7 @@ void init_le_to_pe(struct program_params *pp)
// int r;
if(pv_segments)
- le_to_pe_exit();
+ le_to_pe_exit(pp);
vg_pe_sizes = NULL;
vg_pe_sizes_len = 0;
@@ -502,7 +503,7 @@ int main(int argc, char **argv)
if (argc != 4) {
printf("Usage: %s VolumeGroupName LogicalVolumeName"
" LogicalVolumeExtent\n", argv[0]);
- le_to_pe_exit();
+ le_to_pe_exit(&pp);
return 1;
}
@@ -543,7 +544,7 @@ int main(int argc, char **argv)
pv_info_free(pv_info);
- le_to_pe_exit();
+ le_to_pe_exit(&pp);
lvm2_exit(pp.lvm2_handle);
View
2 lvmls.h
@@ -22,7 +22,7 @@
void init_le_to_pe(struct program_params *pp);
-void le_to_pe_exit(void);
+void le_to_pe_exit(struct program_params *pp);
struct pv_info {
char *pv_name;
View
2 lvmtscat.c
@@ -239,7 +239,7 @@ main(int argc, char **argv)
as = NULL;
if (!print_le) {
- le_to_pe_exit();
+ le_to_pe_exit(&pp);
}
return ret;
View
5 lvmtsd.c
@@ -67,6 +67,8 @@ free_program_params(struct program_params *pp)
if (pp->lvm2_handle)
lvm2_exit(pp->lvm2_handle);
+ le_to_pe_exit(pp);
+
free(pp);
}
@@ -201,7 +203,8 @@ main_loop(struct program_params *pp)
// always leave 5 extents worth of free space so that we always
// can move cold extents from higher tier
- off_t available_extents = free_space / get_extent_size(pp, lv_name) - 5;
+ off_t available_extents = free_space
+ / get_extent_size(pp, lv_name) - 5;
if (available_extents < 0)
available_extents = 0;
View
1 volumes.c
@@ -174,7 +174,6 @@ get_volume_stats(struct program_params *pp, const char *lv_name, struct extent_s
}
// clean up
- le_to_pe_exit();
destroy_activity_stats(as);
// sort according to score

0 comments on commit c21c62b

Please sign in to comment.
Something went wrong with that request. Please try again.