From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yehuda Sadeh Subject: [PATCH v3 07/10] ceph-rbd: some super.c changes for rbd Date: Wed, 7 Jul 2010 15:11:29 -0700 Message-ID: References: Return-path: In-Reply-To: In-Reply-To: References: Sender: linux-fsdevel-owner@vger.kernel.org To: linux-kernel@vger.kernel.org Cc: ceph-devel@vger.kernel.org, linux-fsdevel@vger.kernel.org, sage@newdream.net, Yehuda Sadeh List-Id: ceph-devel.vger.kernel.org - add 'snap' mount option - add ceph_client_id helper Signed-off-by: Yehuda Sadeh Signed-off-by: Sage Weil --- fs/ceph/super.c | 19 ++++++++++++++++++- fs/ceph/super.h | 2 ++ 2 files changed, 20 insertions(+), 1 deletions(-) diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 43b1589..acff12f 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -342,6 +342,7 @@ enum { Opt_snapdirname, Opt_name, Opt_secret, + Opt_snap, Opt_last_string, /* string args above */ Opt_ip, @@ -374,6 +375,7 @@ static match_table_t arg_tokens = { {Opt_snapdirname, "snapdirname=%s"}, {Opt_name, "name=%s"}, {Opt_secret, "secret=%s"}, + {Opt_snap, "snap=%s"}, /* string args above */ {Opt_ip, "ip=%s"}, {Opt_noshare, "noshare"}, @@ -508,6 +510,11 @@ struct ceph_mount_args *parse_mount_args(int flags, char *options, argstr[0].to-argstr[0].from, GFP_KERNEL); break; + case Opt_snap: + args->snap = kstrndup(argstr[0].from, + argstr[0].to-argstr[0].from, + GFP_KERNEL); + break; /* misc */ case Opt_wsize: @@ -582,6 +589,7 @@ void ceph_destroy_mount_args(struct ceph_mount_args *args) kfree(args->snapdir_name); kfree(args->name); kfree(args->secret); + kfree(args->snap); kfree(args); } @@ -621,6 +629,10 @@ int ceph_compare_mount_args(struct ceph_mount_args *new_args, if (ret) return ret; + ret = strcmp_null(args1->snap, args2->snap); + if (ret) + return ret; + for (i = 0; i < args1->num_mon; i++) { if (ceph_monmap_contains(client->monc.monmap, &args1->mon_addr[i])) @@ -717,6 +729,11 @@ fail: return ERR_PTR(err); } +u64 ceph_client_id(struct ceph_client *client) +{ + return client->monc.auth->global_id; +} + void ceph_destroy_client(struct ceph_client *client) { dout("destroy_client %p\n", client); @@ -767,7 +784,7 @@ int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid) } } else { pr_info("client%lld fsid " FSID_FORMAT "\n", - client->monc.auth->global_id, PR_FSID(fsid)); + ceph_client_id(client), PR_FSID(fsid)); memcpy(&client->fsid, fsid, sizeof(*fsid)); ceph_debugfs_client_init(client); client->have_fsid = true; diff --git a/fs/ceph/super.h b/fs/ceph/super.h index ee67b81..67d5b75 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -74,6 +74,7 @@ struct ceph_mount_args { char *snapdir_name; /* default ".snap" */ char *name; char *secret; + char *snap; /* rbd snapshot */ }; /* @@ -751,6 +752,7 @@ extern int ceph_compare_mount_args(struct ceph_mount_args *new_args, struct ceph_client *client); extern struct ceph_client *ceph_create_client(struct ceph_mount_args *args, int need_mdsc); +extern u64 ceph_client_id(struct ceph_client *client); extern void ceph_destroy_client(struct ceph_client *client); extern int ceph_open_session(struct ceph_client *client); -- 1.5.6.5