import mars-121.tgz

This commit is contained in:
Thomas Schoebel-Theuer 2011-08-05 10:26:24 +01:00
parent f51293dced
commit 374f37aca9
4 changed files with 38 additions and 2 deletions

View File

@ -490,8 +490,10 @@ static int bio_switch(struct bio_brick *brick)
q = bdev_get_queue(inode->i_bdev);
CHECK_PTR(q, done);
#if 1
MARS_INF("ra_pages OLD=%lu NEW=%d\n", q->backing_dev_info.ra_pages, brick->ra_pages);
q->backing_dev_info.ra_pages = brick->ra_pages;
#endif
brick->bvec_max = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9);
brick->total_size = inode->i_size;
brick->thread = kthread_create(bio_thread, brick, "mars_bio%d", index++);

View File

@ -209,7 +209,6 @@ static int if_make_request(struct request_queue *q, struct bio *bio)
goto err;
if (unlikely(!bio_sectors(bio))) {
atomic_inc(&input->total_empty_count);
_if_unplug(input);
/* THINK: usually this happens only at write barriers.
* We have no "barrier" operation in MARS, since
@ -222,6 +221,13 @@ static int if_make_request(struct request_queue *q, struct bio *bio)
return 0;
}
#if 1 // provisinary -- we should introduce an equivalent of READA also to the MARS infrastructure
if (bio_rw(bio) == READA) {
atomic_inc(&input->total_reada_count);
bio_endio(bio, -EWOULDBLOCK);
return 0;
}
#endif
if (rw) {
atomic_inc(&input->total_write_count);
} else {
@ -623,8 +629,10 @@ static int if_switch(struct if_brick *brick)
/* we have no partitions. we contain only ourselves. */
input->bdev->bd_contains = input->bdev;
#if 1
MARS_INF("ra_pages OLD = %lu NEW = %d\n", q->backing_dev_info.ra_pages, brick->readahead);
q->backing_dev_info.ra_pages = brick->readahead;
#endif
#ifdef USE_CONGESTED_FN
q->backing_dev_info.congested_fn = mars_congested;
q->backing_dev_info.congested_data = input;
@ -675,13 +683,15 @@ char *if_statistics(struct if_brick *brick, int verbose)
{
struct if_input *input = brick->inputs[0];
char *res = kmalloc(512, GFP_MARS);
int tmp0 = atomic_read(&input->total_reada_count);
int tmp1 = atomic_read(&input->total_read_count);
int tmp2 = atomic_read(&input->total_mref_read_count);
int tmp3 = atomic_read(&input->total_write_count);
int tmp4 = atomic_read(&input->total_mref_write_count);
if (!res)
return NULL;
snprintf(res, 512, "total reads = %d mref_reads = %d (%d%%) writes = %d mref_writes = %d (%d%%) empty = %d | plugged = %d flying = %d (reads = %d writes = %d)\n",
snprintf(res, 512, "total reada = %d reads = %d mref_reads = %d (%d%%) writes = %d mref_writes = %d (%d%%) empty = %d | plugged = %d flying = %d (reads = %d writes = %d)\n",
tmp0,
tmp1,
tmp2,
tmp1 ? tmp2 * 100 / tmp1 : 0,

View File

@ -45,6 +45,7 @@ struct if_input {
// only for statistics
atomic_t read_flying_count;
atomic_t write_flying_count;
atomic_t total_reada_count;
atomic_t total_read_count;
atomic_t total_write_count;
atomic_t total_empty_count;

View File

@ -94,6 +94,17 @@ sub check_primary_gone {
}
}
sub check_status {
my ($res, $key, $val) = @_;
for(;;) {
my $path = "$mars/resource-$res/actual-$host/$key";
my $link = readlink($path) or die "cannot read symlink '$path'\n";
last if $link == $val;
print "waiting until $key reaches the value $val....\n";
sleep(5);
}
}
sub check_splitbrain {
my ($res, $host) = @_;
my @links = glob("$mars/resource-$res/version-[0-9]*-$host");
@ -403,6 +414,17 @@ sub up_res {
}
}
sub fake_local_res {
my ($cmd, $res) = @_;
my $path = "$mars/resource-$res/switch-$host/sync";
_switch($cmd, $res, $path, 0);
#check_status($res, "copy-syncstatus-$host", 0);
my $size = readlink("$mars/resource-$res/size") or die "cannot read size\n";
my $target = "$mars/resource-$res/syncstatus-$host";
symlink($size, "$target.tmp") or die "cannot create faked syncstatus\n";
rename("$target.tmp", $target) or die "cannot reaname symlink\n";
}
sub _primary_res {
my ($res, $host, $pri, $old) = @_;
my $tmp = "$mars/resource-$res/.tmp.primary";
@ -468,6 +490,7 @@ my %cmd_table =
"create-resource" => \&create_res,
"join-resource" => \&create_res,
"logrotate" => \&logrotate_res,
"fake-sync" => \&fake_local_res,
# compatible keywords
"attach" => \&attach_res,