buffer::read_file into pages to avoid c++ allocator's disagreement with perl

This commit is contained in:
Sage Weil 2008-03-19 15:57:27 -07:00
parent f6f54a2f93
commit e7d366a7f9
4 changed files with 4 additions and 5 deletions

1
src/.gitignore vendored
View File

@ -9,7 +9,6 @@ fakefuse
fakesyn
mkmonmap
monmaptool
crushtool
newsyn
dev
mondata

View File

@ -40,7 +40,7 @@ public:
pthread_mutex_init(&_m,NULL);
}
}
virtual ~Mutex() {
~Mutex() {
assert(nlock == 0);
pthread_mutex_destroy(&_m);
}

View File

@ -38,7 +38,8 @@ int buffer::list::read_file(const char *fn)
return -errno;
}
::fstat(fd, &st);
bufferptr bp(st.st_size);
int s = ROUND_UP_TO(st.st_size, PAGE_SIZE);
bufferptr bp = buffer::create_page_aligned(s);
append(bp);
::read(fd, (void*)c_str(), length());
::close(fd);

View File

@ -165,8 +165,7 @@ sub compile_crush {
}
}
#$wrap->write_to_file($outfn);
$wrap->read_from_file($outfn);
$wrap->write_to_file($outfn);
1;
}