mirror of
https://github.com/ceph/ceph
synced 2025-01-03 09:32:43 +00:00
client describe_layout interface; monitorstore fuse-changes-cwd workaround; osdc debug printer cleanup
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1167 29311d96-e01e-0410-9327-a35deaab8ce9
This commit is contained in:
parent
552137f703
commit
95be0dc467
@ -2651,6 +2651,65 @@ int Client::lazyio_synchronize(int fd, off_t offset, size_t count)
|
||||
}
|
||||
|
||||
|
||||
// =========================================
|
||||
// layout
|
||||
|
||||
|
||||
int Client::describe_layout(int fh, FileLayout *lp)
|
||||
{
|
||||
client_lock.Lock();
|
||||
dout(3) << "op: client->describe_layout(" << fh << ");" << endl;
|
||||
|
||||
assert(fh_map.count(fh));
|
||||
Fh *f = fh_map[fh];
|
||||
Inode *in = f->inode;
|
||||
|
||||
*lp = in->inode.layout;
|
||||
|
||||
client_lock.Unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Client::get_stripe_unit(int fd)
|
||||
{
|
||||
FileLayout layout;
|
||||
describe_layout(fd, &layout);
|
||||
return layout.stripe_size;
|
||||
}
|
||||
|
||||
int Client::get_stripe_width(int fd)
|
||||
{
|
||||
FileLayout layout;
|
||||
describe_layout(fd, &layout);
|
||||
return layout.stripe_size*layout.stripe_count;
|
||||
}
|
||||
|
||||
int Client::get_stripe_period(int fd)
|
||||
{
|
||||
FileLayout layout;
|
||||
describe_layout(fd, &layout);
|
||||
return layout.period();
|
||||
}
|
||||
|
||||
int Client::enumerate_layout(int fh, list<ObjectExtent>& result,
|
||||
off_t length, off_t offset)
|
||||
{
|
||||
client_lock.Lock();
|
||||
dout(3) << "op: client->enumerate_layout(" << fh << ", " << length << ", " << offset << ");" << endl;
|
||||
|
||||
assert(fh_map.count(fh));
|
||||
Fh *f = fh_map[fh];
|
||||
Inode *in = f->inode;
|
||||
|
||||
// map to a list of extents
|
||||
filer->file_to_extents(in->inode, offset, length, result);
|
||||
|
||||
client_lock.Unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Client::ms_handle_failure(Message *m, const entity_inst_t& inst)
|
||||
{
|
||||
entity_name_t dest = inst.name;
|
||||
|
@ -582,8 +582,15 @@ protected:
|
||||
int lazyio_propogate(int fd, off_t offset, size_t count);
|
||||
int lazyio_synchronize(int fd, off_t offset, size_t count);
|
||||
|
||||
int describe_layout(char *fn, list<ObjectExtent>& result);
|
||||
// expose file layout
|
||||
int describe_layout(int fd, FileLayout* layout);
|
||||
int get_stripe_unit(int fd);
|
||||
int get_stripe_width(int fd);
|
||||
int get_stripe_period(int fd);
|
||||
int enumerate_layout(int fd, list<ObjectExtent>& result,
|
||||
off_t length, off_t offset);
|
||||
|
||||
// failure
|
||||
void ms_handle_failure(Message*, const entity_inst_t& inst);
|
||||
};
|
||||
|
||||
|
@ -276,5 +276,8 @@ int ceph_fuse_main(Client *c, int argc, char *argv[])
|
||||
|
||||
// go fuse go
|
||||
cout << "ok, calling fuse_main" << endl;
|
||||
return fuse_main(newargc, newargv, &ceph_oper);
|
||||
cout << "cwd was " << get_current_dir_name() << endl;
|
||||
int r = fuse_main(newargc, newargv, &ceph_oper);
|
||||
cout << "cwd now " << get_current_dir_name() << endl;
|
||||
return r;
|
||||
}
|
||||
|
@ -130,6 +130,7 @@ md_config_t g_conf = {
|
||||
mon_osd_down_out_interval: 5, // seconds
|
||||
mon_lease: 2.000, // seconds
|
||||
mon_stop_with_last_mds: true,
|
||||
mon_store_abspath: false, // make monitorstore use absolute path (to workaround fakefuse idiocy)
|
||||
|
||||
// --- client ---
|
||||
client_cache_size: 300,
|
||||
|
@ -108,6 +108,7 @@ struct md_config_t {
|
||||
int mon_osd_down_out_interval;
|
||||
float mon_lease;
|
||||
bool mon_stop_with_last_mds;
|
||||
bool mon_store_abspath;
|
||||
|
||||
// client
|
||||
int client_cache_size;
|
||||
|
@ -75,6 +75,9 @@ int main(int argc, char **argv) {
|
||||
args = nargs;
|
||||
vec_to_argv(args, argc, argv);
|
||||
|
||||
// make monitorstore use abspath, since fuse seems to screw with the cwd
|
||||
g_conf.mon_store_abspath = true;
|
||||
|
||||
MonMap *monmap = new MonMap(g_conf.num_mon);
|
||||
|
||||
Monitor *mon[g_conf.num_mon];
|
||||
|
@ -53,10 +53,10 @@ void Monitor::init()
|
||||
sprintf(s, "mondata/mon%d", whoami);
|
||||
store = new MonitorStore(s);
|
||||
|
||||
if (g_conf.mkfs)
|
||||
if (g_conf.mkfs)
|
||||
store->mkfs();
|
||||
else
|
||||
store->mount();
|
||||
|
||||
store->mount();
|
||||
|
||||
// create
|
||||
osdmon = new OSDMonitor(this, messenger, lock);
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
void MonitorStore::mount()
|
||||
{
|
||||
@ -35,6 +35,14 @@ void MonitorStore::mount()
|
||||
assert(0);
|
||||
}
|
||||
::closedir(d);
|
||||
|
||||
if (g_conf.mon_store_abspath) {
|
||||
// combine it with the cwd, in case fuse screws things up (i.e. fakefuse)
|
||||
string old = dir;
|
||||
dir = get_current_dir_name();
|
||||
dir += "/";
|
||||
dir += old;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -99,6 +107,7 @@ void MonitorStore::put_int(version_t val, const char *a, const char *b)
|
||||
sprintf(tfn, "%s.new", fn);
|
||||
|
||||
int fd = ::open(tfn, O_WRONLY|O_CREAT);
|
||||
dout(0) << " fd " << fd << " tfn " << tfn << " " << errno << " " << strerror(errno) << " " << get_current_dir_name() << endl;
|
||||
assert(fd > 0);
|
||||
::fchmod(fd, 0644);
|
||||
::write(fd, vs, strlen(vs));
|
||||
|
@ -143,7 +143,7 @@ OSD::OSD(int id, Messenger *m, MonMap *mm, char *dev) : timer(osd_lock)
|
||||
gethostname(hostname,100);
|
||||
|
||||
sprintf(dev_path, "%s/osd%d", ebofs_base_path, whoami);
|
||||
|
||||
|
||||
struct stat sta;
|
||||
if (::lstat(dev_path, &sta) != 0)
|
||||
sprintf(dev_path, "%s/osd.%s", ebofs_base_path, hostname);
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#undef dout
|
||||
#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_filer) cout << g_clock.now() << " " << objecter->messenger->get_myaddr() << ".filer "
|
||||
#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_filer) cout << g_clock.now() << " " << objecter->messenger->get_myname() << ".filer "
|
||||
|
||||
|
||||
class Filer::C_Probe : public Context {
|
||||
|
@ -19,8 +19,8 @@
|
||||
|
||||
#include "config.h"
|
||||
#undef dout
|
||||
#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_objecter) cout << g_clock.now() << " " << objecter->messenger->get_myaddr() << ".journaler "
|
||||
#define derr(x) if (x <= g_conf.debug || x <= g_conf.debug_objecter) cerr << g_clock.now() << " " << objecter->messenger->get_myaddr() << ".journaler "
|
||||
#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_objecter) cout << g_clock.now() << " " << objecter->messenger->get_myname() << ".journaler "
|
||||
#define derr(x) if (x <= g_conf.debug || x <= g_conf.debug_objecter) cerr << g_clock.now() << " " << objecter->messenger->get_myname() << ".journaler "
|
||||
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
/*** ObjectCacher::Object ***/
|
||||
|
||||
#undef dout
|
||||
#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_objectcacher) cout << oc->objecter->messenger->get_myaddr() << ".objectcacher.object(" << oid << ") "
|
||||
#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_objectcacher) cout << g_clock.now() << " " << oc->objecter->messenger->get_myname() << ".objectcacher.object(" << oid << ") "
|
||||
|
||||
|
||||
ObjectCacher::BufferHead *ObjectCacher::Object::split(BufferHead *bh, off_t off)
|
||||
@ -371,7 +371,7 @@ ObjectCacher::BufferHead *ObjectCacher::Object::map_write(Objecter::OSDWrite *wr
|
||||
/*** ObjectCacher ***/
|
||||
|
||||
#undef dout
|
||||
#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_objectcacher) cout << objecter->messenger->get_myaddr() << ".objectcacher "
|
||||
#define dout(l) if (l<=g_conf.debug || l<=g_conf.debug_objectcacher) cout << g_clock.now() << " " << objecter->messenger->get_myname() << ".objectcacher "
|
||||
|
||||
|
||||
/* private */
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
#include "config.h"
|
||||
#undef dout
|
||||
#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_objecter) cout << g_clock.now() << " " << messenger->get_myaddr() << ".objecter "
|
||||
#define derr(x) if (x <= g_conf.debug || x <= g_conf.debug_objecter) cerr << g_clock.now() << " " << messenger->get_myaddr() << ".objecter "
|
||||
#define dout(x) if (x <= g_conf.debug || x <= g_conf.debug_objecter) cout << g_clock.now() << " " << messenger->get_myname() << ".objecter "
|
||||
#define derr(x) if (x <= g_conf.debug || x <= g_conf.debug_objecter) cerr << g_clock.now() << " " << messenger->get_myname() << ".objecter "
|
||||
|
||||
|
||||
// messages ------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user