]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
makefile: make --with-debug work, fix build errors
authorSage Weil <sage@newdream.net>
Fri, 31 Oct 2008 18:52:25 +0000 (11:52 -0700)
committerSage Weil <sage@newdream.net>
Fri, 31 Oct 2008 19:49:46 +0000 (12:49 -0700)
configure.ac
src/Makefile.am
src/crush/CrushWrapper.h
src/crushtool.pl [deleted file]
src/fakefuse.cc
src/fakesyn.cc
src/msg/FakeMessenger.cc
src/psim.cc

index dfb322213a2bcd386de7dffaebfcf5822c4ace91..6ed01f6750baffd34e8d90d21d7b23a64ea0ee7e 100644 (file)
@@ -34,9 +34,9 @@ AC_CHECK_LIB([pthread], [pthread_create])
 # debug crap?
 AC_ARG_WITH([debug],
             [AS_HELP_STRING([--with-debug], [build extra debug binaries])],
-            [],
+            [with_debug=yes],
             [with_debug=no])
-AM_CONDITIONAL(WITH_DEBUG, [test "WITH_DEBUG" = "1"])
+AM_CONDITIONAL(WITH_DEBUG, test "$with_debug" = "yes")
 
 # fuse?
 AC_ARG_WITH([fuse],
index c704285dd51257d889f7e8c88f7c9e8ccee5f12c..d14dc2d9cd838f1bb0bdddf6842c8dff46b72b78 100644 (file)
@@ -18,7 +18,7 @@ monmaptool_LDADD = libcommon.a
 crushtool_SOURCES = crushtool.cc
 crushtool_LDADD = libcommon.a libcrush.a
 osdmaptool_SOURCES = osdmaptool.cc
-osdmaptool_LDADD = libmon.a libcommon.a libcrush.a
+osdmaptool_LDADD = libcommon.a libcrush.a
 
 # mds
 cmds_SOURCES = cmds.cc msg/SimpleMessenger.cc
index 3cbee456ce5951c2a589d8782fd7b3c360dfe67b..d2f81a745786b5a35d1a0c3563ac704f2f9e7b2b 100644 (file)
@@ -5,7 +5,7 @@
 #define __CRUSH_WRAPPER_H
 
 #define BUG_ON(x) assert(!(x))
-#include "include/inttypes.h"  /* just for int types */
+#include "include/types.h"
 
 extern "C" {
 #include "crush.h"
diff --git a/src/crushtool.pl b/src/crushtool.pl
deleted file mode 100755 (executable)
index 01e1758..0000000
+++ /dev/null
@@ -1,277 +0,0 @@
-#!/usr/bin/perl
-
-use Config::General;
-use Tie::IxHash;
-use Data::Dumper;
-
-use strict;
-
-use CrushWrapper;
-
-my $usage = "crushtool infile\n";
-my $fn = shift @ARGV || die $usage;
-
-my $alg_types = {
-       uniform => 1,
-       list => 2, 
-       tree => 3, 
-       straw => 4
-};
-my $alg_names = {
-    1 => 'uniform',
-    2 => 'list',
-    3 => 'tree',
-    4 => 'straw' };
-
-my $wrap = new CrushWrapper::CrushWrapper;
-
-&compile_crush($fn, "$fn.out");
-&decompile_crush("$fn.out", "$fn.out.out");
-
-# find lowest id number used
-sub get_lowest {
-    my $item = shift;
-    return unless ref $item;
-    
-    my $lowest = 0;
-    
-    if (ref $item eq 'HASH') { 
-       $lowest = $item->{'id'} if $lowest > $item->{'id'};
-       foreach my $key (keys %{$item}) { 
-           #next if grep { $key eq $_ } qw(type rule);
-           my $sublowest = get_lowest($item->{$key});
-           $lowest = $sublowest if $lowest > $sublowest;
-       }
-    } elsif (ref $item eq 'ARRAY') { 
-       foreach my $element (@{$item}) { 
-           my $sublowest = get_lowest($element);
-           $lowest = $sublowest if $lowest > $sublowest;
-       }
-    } 
-    
-    return $lowest;
-}
-
-
-sub decompile_crush {
-    my $infn = shift @_;
-    my $outfn = shift @_;
-
-    $wrap->create();
-
-    print "reading from $infn...\n";
-    my $r = $wrap->read_from_file($infn);
-    print "read, r = $r.\n";
-
-    die "can't read file $infn ($r)\n" if ($r != 0);
-
-    my $arr;
-
-    # types
-    my $types = $wrap->get_num_type_names();
-    my %type_map;
-    for (my $id=0; $types > 0; $id++) {
-       my $name = $wrap->get_type_name($id);
-       next if $name eq '';
-       $types--;
-       $type_map{$id} = $name;
-       print "type $id is '$name'\n";
-       $arr->{'types'}->{'type'}->{$name}->{'type_id'} = $id;
-    }
-    
-    # devices
-    my $max_devices = $wrap->get_max_devices();
-    print "max $max_devices\n";
-    my %device_weight;
-    my %name_map;
-    for (my $id=0; $id < $max_devices; $id++) {
-       my $name = $wrap->get_item_name($id);
-       $name ||= "device$id";
-       #next if $name eq '';
-       $name_map{$id} = $name;
-       print "device $id '$name'\n";
-       $arr->{'devices'}->{$type_map{0}}->{$name}->{'id'} = $id;
-       my $off = $wrap->get_device_offload($id);
-       if ($off) {
-           my $off = (0x10000 - $off) / 0x10000; 
-           $arr->{'devices'}->{$type_map{0}}->{$name}->{'offload'} = $off;
-       }
-    }
-
-    # get bucket names
-    my $max_buckets = $wrap->get_max_buckets();
-    for (my $id=-1; $id > -1-$max_buckets; $id--) {
-       my $name = $wrap->get_item_name($id);
-       next if $name eq '';
-       $name_map{$id} = $name;
-    }
-
-    # do buckets
-    my $max_buckets = $wrap->get_max_buckets();
-    for (my $id=-1; $id > -1-$max_buckets; $id--) {
-       my $name = $wrap->get_item_name($id);
-       next if $name eq '';
-       print "bucket $id '$name'\n";
-       my $alg = $wrap->get_bucket_alg($id);
-       my $type = $wrap->get_bucket_type($id);
-       $arr->{'buckets'}->{$type_map{$type}}->{$name}->{'id'} = $id;
-       $arr->{'buckets'}->{$type_map{$type}}->{$name}->{'alg'} = $alg_names->{$alg};
-       my $n = $wrap->get_bucket_size($id);
-       for (my $i=0; $i<$n; $i++) {
-           my $item = $wrap->get_bucket_item($id, $i);
-           my $weight = $wrap->get_bucket_item_weight($id, $i);
-           next unless $weight;
-           $weight /= 0x10000;
-           $arr->{'buckets'}->{$type_map{$type}}->{$name}->{'item'}->{$name_map{$item}}->{'weight'} = $weight;
-       }
-    }
-
-    
-
-    print Dumper $arr;
-
-}
-
-sub compile_crush {
-    my $infn = shift @_;
-    my $outfn = shift @_;
-
-    $wrap->create();
-
-    tie my %conf, "Tie::IxHash";
-    %conf = Config::General::ParseConfig( -ConfigFile => $fn,
-                                         -Tie => "Tie::IxHash",
-                                         -MergeDuplicateBlocks => 1 );
-    
-    my $arr = \%conf;
-    print Dumper $arr;
-
-    my $lowest = get_lowest($arr);
-    print "lowest is $lowest\n";
-    
-    my %weights;  # item id -> weight
-    
-    # types
-    my %type_ids;
-    foreach my $item_type (keys %{$arr->{'types'}->{'type'}}) {
-       my $type_id = $arr->{'types'}->{'type'}->{$item_type}->{'type_id'};
-       print "type $type_id '$item_type'\n";
-       $type_ids{$item_type} = $type_id;
-       $wrap->set_type_name($type_id, $item_type);
-    }
-    
-    # build device table
-    my %device_ids;  # name -> id
-    foreach my $item_type (keys %{$arr->{'devices'}}) {
-       foreach my $name (keys %{$arr->{'devices'}->{$item_type}}) {
-           my $id = $arr->{'devices'}->{$item_type}->{$name}->{'id'};
-           if (!defined $id || $id < 0) { 
-               die "invalid device id for $item_type $name: id is required and must be non-negative";
-           }
-           $wrap->set_item_name($id, $name);
-           
-           my $w = $arr->{'devices'}->{$item_type}->{$name}->{'weight'};
-           $weights{$id} = $w;
-           $device_ids{$name} = $id;
-           print "device $id '$name' weight $w\n";
-       }
-    }
-    
-    # build bucket table
-    my %bucket_ids;
-    foreach my $bucket_type (keys %{$arr->{'buckets'}}) {
-       foreach my $name (keys %{$arr->{'buckets'}->{$bucket_type}}) {
-           # verify type
-           unless (defined $type_ids{$bucket_type}) {
-               die "invalid bucket type $bucket_type\n";
-           }
-           
-           # id
-           my $id = $arr->{'buckets'}->{$bucket_type}->{$name}->{'id'};
-           if (defined $id && $id > -1) { 
-               die "invalid bucket id for $bucket_type $name: id must be negative";
-           } elsif (!defined $id) { 
-               # get the next lower ID number and inject it into the config hash
-               $id = --$lowest;
-               $arr->{'buckets'}->{$bucket_type}->{$name}->{'id'} = $id;
-           }
-           
-           $wrap->set_item_name($id, $name);
-           $bucket_ids{$name} = $id;
-           
-           my @item_ids;
-           my @weights;
-           my $myweight;
-           foreach my $item_name (keys %{$arr->{'buckets'}->{$bucket_type}->{$name}->{'item'}}) {
-               my $id = $wrap->get_item_id($item_name);
-               push @item_ids, $id;
-               my $weight = $arr->{'buckets'}->{$bucket_type}->{$name}->{'item'}->{$item_name}->{'weight'};
-               $weight ||= $weights{$id};
-               push(@weights, $weight * 65536);  # 16.16 fixed point
-               $myweight += $weight;
-           }
-           
-           my $alg = $arr->{'buckets'}->{$bucket_type}->{$name}->{'alg'};
-           $alg = 'straw' if !$alg;
-           die "invalid bucket alg $alg\n"
-               unless $alg_types->{$alg};
-           
-           my $typeid = $type_ids{$bucket_type};
-           my $algid = $alg_types->{$alg};
-           print "\tid $id\n";
-           print "\talg $alg ($algid)\n";
-           print "\ttype $bucket_type ($typeid)\n";
-           print "\titems @item_ids\n";
-           print "\tweights @weights\n";
-           
-           # id, alg, type, size, items, weights
-           #TODO: pass the correct value for type to add_bucket
-           my $result = $wrap->add_bucket($id, $algid, $typeid,
-                                      scalar(@item_ids), \@item_ids, \@weights);
-           #print "\t.. $result\n\n";
-           print "\tweight $myweight\n";
-           $weights{$id} = $myweight;
-       }
-    }
-
-    # rules
-    for my $rule_name (keys %{$arr->{'rules'}->{'rule'}}) {
-       my $r = $arr->{'rules'}->{'rule'}->{$rule_name};
-       my $pool = $r->{'pool'};
-       #my $typeid = $rule_types{$r->{'type'}};
-       my $min_size = $r->{'min_size'};
-       my $max_size = $r->{'max_size'};
-               
-    }
-
-    $wrap->finalize;
-    $wrap->write_to_file($outfn);
-    1;
-}
-
-
-
-print "Line: " . __LINE__ ."\n";
-
-
-=item
-
-/*** BUCKETS ***/
-enum {
-    CRUSH_BUCKET_UNIFORM = 1,
-    CRUSH_BUCKET_LIST = 2,
-    CRUSH_BUCKET_TREE = 3,
-    CRUSH_BUCKET_STRAW = 4
-};
-
-/*** RULES ***/
-enum {
-    CRUSH_RULE_NOOP = 0,
-    CRUSH_RULE_TAKE = 1,          /* arg1 = value to start with */
-    CRUSH_RULE_CHOOSE_FIRSTN = 2, /* arg1 = num items to pick */
-                                  /* arg2 = type */
-    CRUSH_RULE_CHOOSE_INDEP = 3,  /* same */
-    CRUSH_RULE_EMIT = 4           /* no args */
-};
-
-=cut
index 9dce514d28577ac173228764d1e8938fa2a9ffb2..db4356e7aa53e103a350890622840c755fea7767 100644 (file)
@@ -123,7 +123,7 @@ int main(int argc, const char **argv) {
   // build initial osd map
   {
     OSDMap map;
-    map.build_simple(0, monmap->fsid, g_conf.num_osd, g_conf.osd_pg_bits, 0);
+    map.build_simple(0, monmap->fsid, g_conf.num_osd, 0, g_conf.osd_pg_bits, g_conf.osd_lpg_bits, 0);
     bufferlist bl;
     map.encode(bl);
     Messenger *messenger = new FakeMessenger(entity_name_t::ADMIN(-1));
index 213d4285cd3f47ae272c2de6595b96609ab2642e..804826bdb6409842887c61fa701234a27fa86436 100644 (file)
@@ -122,7 +122,8 @@ int main(int argc, const char **argv)
   // build initial osd map
   {
     OSDMap map;
-    map.build_simple(0, monmap->fsid, g_conf.num_osd, g_conf.osd_pg_bits, 0);
+    map.build_simple(0, monmap->fsid, g_conf.num_osd, 0,
+                    g_conf.osd_pg_bits, g_conf.osd_lpg_bits, 0);
     bufferlist bl;
     map.encode(bl);
     Messenger *messenger = new FakeMessenger(entity_name_t::ADMIN(-1));
index c56b980e8e6085f61098d2f06f076b5e32621c58..71b99cff20684e43eac10c154a84a66f151b706a 100644 (file)
@@ -214,7 +214,8 @@ int fakemessenger_do_loop_2()
           // encode
           if (m->empty_payload()) 
             m->encode_payload();
-          ceph_msg_header env = m->get_env();
+          ceph_msg_header head = m->get_header();
+          ceph_msg_footer foot = m->get_footer();
           bufferlist front;
           front.claim( m->get_payload() );
          bufferlist data;
@@ -224,7 +225,7 @@ int fakemessenger_do_loop_2()
           delete m;
           
           // decode
-          m = decode_message(env, front, data);
+          m = decode_message(head, foot, front, data);
           assert(m);
         } 
 
index 46d40f581f2dfef8434a3c4c44dd14eb6ed80ab1..de71dbf1fdb79a99b52ef32dd12714a471949ad6 100644 (file)
@@ -26,7 +26,7 @@ int main(int argc, char **argv)
   }
 
   ceph_file_layout layout = g_default_file_layout;
-  layout.fl_pg_preferred = 2;
+  //layout.fl_pg_preferred = 2;
   for (int f = 1; f < 10000; f++) {  // files
     for (int b = 0; b < 4; b++) {   // blocks
       object_t oid(f, b);