From patchwork Tue Jan 22 21:57:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2020971 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 835D840E35 for ; Tue, 22 Jan 2013 21:58:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754965Ab3AVV6G (ORCPT ); Tue, 22 Jan 2013 16:58:06 -0500 Received: from mail-ie0-f180.google.com ([209.85.223.180]:64110 "EHLO mail-ie0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753858Ab3AVV6C (ORCPT ); Tue, 22 Jan 2013 16:58:02 -0500 Received: by mail-ie0-f180.google.com with SMTP id c10so12344275ieb.39 for ; Tue, 22 Jan 2013 13:58:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=EsLgwlw62/aR+G2BPFInD6kcmUql/nCX8d157QZXNGU=; b=ZdeCyM7/DYRKCWJB92Z8dj/j9/zBFyXlgrVMxuxpW6/3iqCPLf6TQmjFogHaVWQoUU 9rvNvgNhMMhiDsHKIQtvJImoHPVhSvOkN9AZWnXNS/GeWY/mL4g1I/gObf5JRW77ggD2 8aRsb/TDvWCEU85jTuzsdh0nSVoXRPibzZe9DphoHALLTBmexcXJDCz7FUobxBu+F3gb 6VfYG1VBs9a49ppaWR52paVonNRxsUsPeWWp1BDsDNE/9yEM1BJhDrDEjzII8X+XjTpf VrjgZRIdeMXCqZnk+MKbXzAzgaIwl+L7tP7upwFVUPQrJnooJ6P1NoVQJn6AeVhmWbmx RDFg== X-Received: by 10.50.16.235 with SMTP id j11mr13308714igd.78.1358891881637; Tue, 22 Jan 2013 13:58:01 -0800 (PST) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id gs6sm12895620igc.11.2013.01.22.13.57.59 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Jan 2013 13:58:00 -0800 (PST) Message-ID: <50FF0B66.20805@inktank.com> Date: Tue, 22 Jan 2013 15:57:58 -0600 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: "ceph-devel@vger.kernel.org" Subject: [PATCH 1/3] rbd: small changes References: <50FF0B22.5060201@inktank.com> In-Reply-To: <50FF0B22.5060201@inktank.com> X-Gm-Message-State: ALoCoQkEVf9P3nCizFlP1SBZIR3nBODjP7jfzI0/P6GOP30Nk/4O2m/Zfb4ax8Zvw2aJLkwIxcwb Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org A few very minor changes to the rbd code: - RBD_MAX_OPT_LEN is unused, so get rid of it - Consolidate rbd options definitions - Make rbd_segment_name() return pointer to const char Signed-off-by: Alex Elder Reviewed-by: Dan Mick Reviewed-by: Josh Durgin --- drivers/block/rbd.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) u64 segment; @@ -1338,7 +1337,7 @@ static int rbd_do_op(struct request *rq, struct rbd_req_coll *coll, int coll_index) { - char *seg_name; + const char *seg_name; u64 seg_ofs; u64 seg_len; int ret; diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 007b726..4ed0741 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -69,7 +69,6 @@ (NAME_MAX - (sizeof (RBD_SNAP_DEV_NAME_PREFIX) - 1)) #define RBD_MAX_SNAP_COUNT 510 /* allows max snapc to fit in 4KB */ -#define RBD_MAX_OPT_LEN 1024 #define RBD_SNAP_HEAD_NAME "-" @@ -96,8 +95,6 @@ #define DEV_NAME_LEN 32 #define MAX_INT_FORMAT_WIDTH ((5 * sizeof (int)) / 2 + 1) -#define RBD_READ_ONLY_DEFAULT false - /* * block device image metadata (in-memory version) */ @@ -156,10 +153,6 @@ struct rbd_spec { struct kref kref; }; -struct rbd_options { - bool read_only; -}; - /* * an instance of the client. multiple devices may share an rbd client. */ @@ -475,6 +468,12 @@ static match_table_t rbd_opts_tokens = { {-1, NULL} }; +struct rbd_options { + bool read_only; +}; + +#define RBD_READ_ONLY_DEFAULT false + static int parse_rbd_opts_token(char *c, void *private) { struct rbd_options *rbd_opts = private; @@ -773,7 +772,7 @@ static void rbd_header_free(struct rbd_image_header *header) header->snapc = NULL; } -static char *rbd_segment_name(struct rbd_device *rbd_dev, u64 offset) +static const char *rbd_segment_name(struct rbd_device *rbd_dev, u64 offset) { char *name;