// buffered write?
- if (f->caps & CFILE_CAP_WRBUFFER) {
+ if (false && f->caps & CFILE_CAP_WRBUFFER) {
// buffered write
dout(10) << "buffered/async write" << endl;
break;
case SYNCLIENT_MODE_WRITEFILE:
write_file(sarg1, iarg1);
+ break;
default:
assert(0);
}
int SyntheticClient::write_file(string& fn, int size) // size is in MB
{
- char *buf = new char[1024*1024]; // 1 MB
+ int wrsize = 1024*256;
+ char *buf = new char[wrsize]; // 1 MB
+ int chunks = size * 1024*1024 / wrsize;
- int fd = client->open(fn.c_str(), O_WRONLY);
+ int fd = client->open(fn.c_str(), O_WRONLY|O_CREAT);
dout(5) << "writing to " << fn << " fd " << fd << endl;
if (fd < 0) return fd;
- for (int i=0; i<size; i++) {
- dout(5) << "writing block " << i << "/" << size << endl;
- client->write(fd, buf, 1024*1024, i*1024*1024);
+ for (int i=0; i<chunks; i++) {
+ dout(2) << "writing block " << i << "/" << chunks << endl;
+ client->write(fd, buf, wrsize, i*wrsize);
}
client->close(fd);
else if (strcmp(argv[i], "--mds_bal_interval") == 0)
g_conf.mds_bal_interval = atoi(argv[++i]);
else {
- cout << "passing arg " << argv[i] << endl;
+ //cout << "passing arg " << argv[i] << endl;
nargv[nargc++] = argv[i];
}
}
}
// make a pass on the cache
- dout(7) << "log is empty. flushing cache" << endl;
- trim(0);
-
+ if (g_conf.mds_log_flush_on_shutdown) {
+ dout(7) << "log is empty. flushing cache" << endl;
+ trim(0);
+ }
dout(7) << "cache size now " << lru.lru_get_size() << endl;
// send all imports back to 0.
assert(inode_map.size() == lru.lru_get_size());
// done?
- if (lru.lru_get_size() == 0 && !mds->filer->is_active()) {
+ if ((lru.lru_get_size() == 0 || g_conf.mds_log_flush_on_shutdown == false) &&
+ !mds->filer->is_active()) {
if (mds->get_nodeid() != 0) {
dout(7) << "done, sending shutdown_finish" << endl;
mds->messenger->send_message(new MGenericMessage(MSG_MDS_SHUTDOWNFINISH),
dout(3) << "wiping osds too" << endl;
mds_paused = true;
filer->mkfs(new C_MDS_Unpause(this));
+ waiting_for_unpause.push_back(new C_MDS_RetryMessage(this, m));
+ return;
}
- waiting_for_unpause.push_back(new C_MDS_RetryMessage(this, m));
- return;
}
}