with ino=1.
Also, translate root inode properly in fuse_ll.
.TP
\fB\-m\fI monaddress[:port]\fR
Connect to specified monitor (instead of looking through \fIceph.conf\fR).
+.TP
+\fB\-r\fI root_directory\fR
+Use root_directory as the mounted root, rather than the full Ceph tree.
.SH AVAILABILITY
.B cfuse
is part of the Ceph distributed file system. Please refer to the Ceph wiki at
// start up fuse
// use my argc, argv (make sure you pass a mount point!)
- int r = client->mount();
+ int r = client->mount(g_conf.client_mountpoint);
if (r < 0) {
cerr << "cfuse[" << getpid() << "]: ceph mount failed with " << strerror(-r) << std::endl;
goto out_shutdown;
else {
in = new Inode(st->vino, &st->layout);
inode_map[st->vino] = in;
- if (in->ino == 1) {
+ bool new_root = false;
+ if (!root) {
+ new_root = true;
root = in;
cwd = root;
cwd->get();
in->snapid = st->vino.snapid;
in->rdev = st->rdev;
in->mode = st->mode & S_IFMT;
+ if (new_root) dout(10) << "setting this inode as root! " << *in << "; ino: " << root->ino << "; snapid" << root->snapid << dendl;
if (in->is_symlink())
in->symlink = st->symlink;
}
// -------------------
// MOUNT
-int Client::mount()
+int Client::mount(const char *mount_root)
{
Mutex::Locker lock(client_lock);
// fuse assumes it's always there.
MetaRequest *req = new MetaRequest(CEPH_MDS_OP_GETATTR);
filepath fp(CEPH_INO_ROOT);
+ if (mount_root) fp = filepath(mount_root);
req->set_filepath(fp);
req->head.args.getattr.mask = CEPH_STAT_CAP_INODE_ALL;
int res = make_request(req, -1, -1);
void tear_down_cache();
client_t get_nodeid() { return whoami; }
+ inodeno_t get_root_ino() { return root->ino; }
void init();
void shutdown();
Dentry **pdn, bool expect_null=false);
public:
- int mount();
+ int mount(const char *mount_root = NULL);
int unmount();
// these shoud (more or less) mirror the actual system calls.
}
static vinodeno_t fino_vino(inodeno_t fino)
{
+ if (fino.val == 1) {
+ fino = inodeno_t(client->get_root_ino());
+ }
vinodeno_t vino(FINO_INO(fino), fino_snap(fino));
//cout << "fino_vino " << fino << " -> " << vino << std::endl;
return vino;
OPTION(client_readahead_max_bytes, 0, OPT_LONGLONG, 0), //8 * 1024*1024,
OPTION(client_readahead_max_periods, 0, OPT_LONGLONG, 4), // as multiple of file layout period (object size * num stripes)
OPTION(client_snapdir, 0, OPT_STR, ".snap"),
+ OPTION(client_mountpoint, 'r', OPT_STR, "/"),
OPTION(fuse_direct_io, 0, OPT_INT, 0),
OPTION(fuse_ll, 0, OPT_BOOL, true),
OPTION(client_oc, 0, OPT_BOOL, true),
long long client_readahead_max_bytes;
long long client_readahead_max_periods;
const char *client_snapdir;
+ const char *client_mountpoint;
int fuse_direct_io;
bool fuse_ll;