From patchwork Wed Jul 7 22:11:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yehuda Sadeh X-Patchwork-Id: 110735 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o67LphMN031422 for ; Wed, 7 Jul 2010 21:52:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758103Ab0GGVvg (ORCPT ); Wed, 7 Jul 2010 17:51:36 -0400 Received: from mail.hq.newdream.net ([66.33.206.127]:34452 "EHLO mail.hq.newdream.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757838Ab0GGVu1 (ORCPT ); Wed, 7 Jul 2010 17:50:27 -0400 Received: from mail.hq.newdream.net (localhost [127.0.0.1]) by mail.hq.newdream.net (Postfix) with ESMTP id 8A5AF27066; Wed, 7 Jul 2010 14:50:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=hq.newdream.net; h=from:to :cc:subject:date:message-id:in-reply-to:references:in-reply-to :references; s=drama; bh=J4kEJotWhtLyNpeeY1SHLJRPcRg=; b=Txyl8TJ RD8friiQpHhynOQ0GDR2ACPmbqBv7aaeT7J4Jam9c7H/Ubuob3nMPzRmp8p6tswK KQwLM6DgoxW1QAwkOw8Xh4e93IyL1vKfBkB08yu30Efem+751hJJVFOYvJFbpKI+ pYIIEZ8FSbRvw2oN4qs9ZGhIXi9t6KS4x9Dk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=hq.newdream.net; h=from:to :cc:subject:date:message-id:in-reply-to:references:in-reply-to :references; q=dns; s=drama; b=ih9ddB8AqcCEQzs/ppGJpuHsgqS90eLUb Kipmclo2Ws1ouqnsvWj5f2/Ipe+8T5DqeqdsMzQA6t7sf4rHNBj0BQw+mwMcJ4SD KXOfU4naRnRAUIALl+RlmoGDNo2LIY4ZWGRfyI1SnH0nySiKgXtF7Tz2B0PLW17o ZyJbEdPJz0= Received: from localhost.localdomain (ip-66-33-206-8.dreamhost.com [66.33.206.8]) by mail.hq.newdream.net (Postfix) with ESMTP id 6FF3927065; Wed, 7 Jul 2010 14:50:26 -0700 (PDT) From: Yehuda Sadeh To: linux-kernel@vger.kernel.org Cc: ceph-devel@vger.kernel.org, linux-fsdevel@vger.kernel.org, sage@newdream.net, 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: X-Mailer: git-send-email 1.5.6.5 In-Reply-To: References: In-Reply-To: References: Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 07 Jul 2010 21:52:17 +0000 (UTC) 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);