Commit 235a0982 authored by Yan, Zheng's avatar Yan, Zheng Committed by Ilya Dryomov

ceph: multiple filesystem support

To access non-default filesystem, we just need to subscribe to
mdsmap.<MDS_NAMESPACE_ID> and add a new mount option for mds
namespace id.
Signed-off-by: default avatarYan, Zheng <zyan@redhat.com>
[idryomov@gmail.com: switch to a new libceph API]
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 737cc81e
...@@ -108,6 +108,7 @@ static int ceph_sync_fs(struct super_block *sb, int wait) ...@@ -108,6 +108,7 @@ static int ceph_sync_fs(struct super_block *sb, int wait)
* mount options * mount options
*/ */
enum { enum {
Opt_mds_namespace,
Opt_wsize, Opt_wsize,
Opt_rsize, Opt_rsize,
Opt_rasize, Opt_rasize,
...@@ -143,6 +144,7 @@ enum { ...@@ -143,6 +144,7 @@ enum {
}; };
static match_table_t fsopt_tokens = { static match_table_t fsopt_tokens = {
{Opt_mds_namespace, "mds_namespace=%d"},
{Opt_wsize, "wsize=%d"}, {Opt_wsize, "wsize=%d"},
{Opt_rsize, "rsize=%d"}, {Opt_rsize, "rsize=%d"},
{Opt_rasize, "rasize=%d"}, {Opt_rasize, "rasize=%d"},
...@@ -212,6 +214,9 @@ static int parse_fsopt_token(char *c, void *private) ...@@ -212,6 +214,9 @@ static int parse_fsopt_token(char *c, void *private)
break; break;
/* misc */ /* misc */
case Opt_mds_namespace:
fsopt->mds_namespace = intval;
break;
case Opt_wsize: case Opt_wsize:
fsopt->wsize = intval; fsopt->wsize = intval;
break; break;
...@@ -367,6 +372,7 @@ static int parse_mount_options(struct ceph_mount_options **pfsopt, ...@@ -367,6 +372,7 @@ static int parse_mount_options(struct ceph_mount_options **pfsopt,
fsopt->max_readdir = CEPH_MAX_READDIR_DEFAULT; fsopt->max_readdir = CEPH_MAX_READDIR_DEFAULT;
fsopt->max_readdir_bytes = CEPH_MAX_READDIR_BYTES_DEFAULT; fsopt->max_readdir_bytes = CEPH_MAX_READDIR_BYTES_DEFAULT;
fsopt->congestion_kb = default_congestion_kb(); fsopt->congestion_kb = default_congestion_kb();
fsopt->mds_namespace = CEPH_FS_CLUSTER_ID_NONE;
/* /*
* Distinguish the server list from the path in "dev_name". * Distinguish the server list from the path in "dev_name".
...@@ -457,6 +463,8 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root) ...@@ -457,6 +463,8 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
seq_puts(m, ",noacl"); seq_puts(m, ",noacl");
#endif #endif
if (fsopt->mds_namespace != CEPH_FS_CLUSTER_ID_NONE)
seq_printf(m, ",mds_namespace=%d", fsopt->mds_namespace);
if (fsopt->wsize) if (fsopt->wsize)
seq_printf(m, ",wsize=%d", fsopt->wsize); seq_printf(m, ",wsize=%d", fsopt->wsize);
if (fsopt->rsize != CEPH_RSIZE_DEFAULT) if (fsopt->rsize != CEPH_RSIZE_DEFAULT)
...@@ -530,6 +538,7 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, ...@@ -530,6 +538,7 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
goto fail; goto fail;
} }
fsc->client->extra_mon_dispatch = extra_mon_dispatch; fsc->client->extra_mon_dispatch = extra_mon_dispatch;
fsc->client->monc.fs_cluster_id = fsopt->mds_namespace;
ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP, 0, true); ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP, 0, true);
fsc->mount_options = fsopt; fsc->mount_options = fsopt;
......
...@@ -62,6 +62,7 @@ struct ceph_mount_options { ...@@ -62,6 +62,7 @@ struct ceph_mount_options {
int cap_release_safety; int cap_release_safety;
int max_readdir; /* max readdir result (entires) */ int max_readdir; /* max readdir result (entires) */
int max_readdir_bytes; /* max readdir result (bytes) */ int max_readdir_bytes; /* max readdir result (bytes) */
int mds_namespace;
/* /*
* everything above this point can be memcmp'd; everything below * everything above this point can be memcmp'd; everything below
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment