Alexandre Oliva
2014-10-10 05:57:15 UTC
I wanted to script a tmap_to_omap conversion of a few million dirs, but
running the rados program for each inode would have made it take too
long, so I wrote the attached python script, that I'm now running in
multiple copies in parallel with GNU parallel.
Before it would run, however, I found out python bindings of rados's
tmap_to_omap hadn't been implemented. It might have been because it
takes a bool argument, and I couldn't find out how to pass it as such.
I ended up forcing the bool argument to False and passing it as an int
0. This could fail on machines whose ABIs pass bools differently from
ints, but IIRC bools are just aliases to char in C, at least within GCC,
and since char is promoted to int for argument passing, passing an int
should work, especially if it's zero. For nonzero values, endianness
could matter if the argument is passed on the stack, so I settled for
forcing it to zero.
If anyone knows better, please let me know.
running the rados program for each inode would have made it take too
long, so I wrote the attached python script, that I'm now running in
multiple copies in parallel with GNU parallel.
Before it would run, however, I found out python bindings of rados's
tmap_to_omap hadn't been implemented. It might have been because it
takes a bool argument, and I couldn't find out how to pass it as such.
I ended up forcing the bool argument to False and passing it as an int
0. This could fail on machines whose ABIs pass bools differently from
ints, but IIRC bools are just aliases to char in C, at least within GCC,
and since char is promoted to int for argument passing, passing an int
should work, especially if it's zero. For nonzero values, endianness
could matter if the argument is passed on the stack, so I settled for
forcing it to zero.
If anyone knows better, please let me know.