From patchwork Wed Jul 7 22:11:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yehuda Sadeh X-Patchwork-Id: 110725 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 o67LoVk7031188 for ; Wed, 7 Jul 2010 21:50:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758069Ab0GGVu3 (ORCPT ); Wed, 7 Jul 2010 17:50:29 -0400 Received: from mail.hq.newdream.net ([66.33.206.127]:34443 "EHLO mail.hq.newdream.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757619Ab0GGVu0 (ORCPT ); Wed, 7 Jul 2010 17:50:26 -0400 Received: from mail.hq.newdream.net (localhost [127.0.0.1]) by mail.hq.newdream.net (Postfix) with ESMTP id 61E2E27062; 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=8iUfQg3Bk0WheJjboVNtzFd9VjE=; b=ZjOQYh8 /KJGvjglrIlmJIREjzBZow2gjZ1tcy9o3ZDiRaendJbZq1lXdS3gTWTk7CkY4T0l LXXNz0O+G5jI3i5/FHKH9MJKjw5/lZSOtBO/NDzKunZ/qnBqiTbXCJXbH0EfATje lVXoy0oSgbJm+xviwNOTIyGghhhDWF/FnsrY= 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=hYq+UR4jl8G1cgAbkWtKXCYTMo2J9ipCs 0WMuJZ+nFR42EyakdJVp4GbHVPi202c3ny8AvYGvj8mPi7EqECjCRdvHh+aTz0dw f/iX7C0wGXquakMBCCaE3khkoxr4S4iQSor+VCW3Hs/EmB3xqOh7kgQ+6OUPB5su jNITr3Kmrc= Received: from localhost.localdomain (ip-66-33-206-8.dreamhost.com [66.33.206.8]) by mail.hq.newdream.net (Postfix) with ESMTP id 508A627060; 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 04/10] ceph-rbd: enable creation of clients that don't need mds Date: Wed, 7 Jul 2010 15:11:26 -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:50:31 +0000 (UTC) diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c index 3be33fb..c5d6a01 100644 --- a/fs/ceph/debugfs.c +++ b/fs/ceph/debugfs.c @@ -440,9 +440,14 @@ int ceph_debugfs_client_init(struct ceph_client *client) if (!client->debugfs_congestion_kb) goto out; - sprintf(name, "../../bdi/%s", dev_name(client->sb->s_bdi->dev)); - client->debugfs_bdi = debugfs_create_symlink("bdi", client->debugfs_dir, - name); + if (client->backing_dev_info.dev) { + sprintf(name, "../../bdi/%s", + dev_name(client->backing_dev_info.dev)); + client->debugfs_bdi = + debugfs_create_symlink("bdi", + client->debugfs_dir, + name); + } return 0; diff --git a/fs/ceph/mon_client.c b/fs/ceph/mon_client.c index 07a5399..4e022ed 100644 --- a/fs/ceph/mon_client.c +++ b/fs/ceph/mon_client.c @@ -787,7 +787,8 @@ static void dispatch(struct ceph_connection *con, struct ceph_msg *msg) break; case CEPH_MSG_MDS_MAP: - ceph_mdsc_handle_map(&monc->client->mdsc, msg); + if (monc->client->have_mdsc) + ceph_mdsc_handle_map(&monc->client->mdsc, msg); break; case CEPH_MSG_OSD_MAP: diff --git a/fs/ceph/super.c b/fs/ceph/super.c index fa87f51..14c8f5a 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -584,7 +584,8 @@ static void destroy_mount_args(struct ceph_mount_args *args) /* * create a fresh client instance */ -static struct ceph_client *ceph_create_client(struct ceph_mount_args *args) +struct ceph_client *ceph_create_client(struct ceph_mount_args *args, + int need_mdsc) { struct ceph_client *client; int err = -ENOMEM; @@ -639,9 +640,13 @@ static struct ceph_client *ceph_create_client(struct ceph_mount_args *args) err = ceph_osdc_init(&client->osdc, client); if (err < 0) goto fail_monc; - err = ceph_mdsc_init(&client->mdsc, client); - if (err < 0) - goto fail_osdc; + if (need_mdsc) { + err = ceph_mdsc_init(&client->mdsc, client); + if (err < 0) + goto fail_osdc; + client->have_mdsc = 1; + } + return client; fail_osdc: @@ -668,7 +673,8 @@ static void ceph_destroy_client(struct ceph_client *client) dout("destroy_client %p\n", client); /* unmount */ - ceph_mdsc_stop(&client->mdsc); + if (client->have_mdsc) + ceph_mdsc_stop(&client->mdsc); ceph_osdc_stop(&client->osdc); /* @@ -963,7 +969,7 @@ static int ceph_get_sb(struct file_system_type *fs_type, } /* create client (which we may/may not use) */ - client = ceph_create_client(args); + client = ceph_create_client(args, 1); if (IS_ERR(client)) { err = PTR_ERR(client); goto out_final; diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 10a4a40..2602248 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -139,6 +139,8 @@ struct ceph_client { int min_caps; /* min caps i added */ + int have_mdsc; + struct ceph_messenger *msgr; /* messenger instance */ struct ceph_mon_client monc; struct ceph_mds_client mdsc;